Add a fqn field to blogs and users (#457)

Fixes #319
This commit is contained in:
Baptiste Gelez
2019-03-06 18:28:10 +01:00
committed by GitHub
parent eff2698664
commit fe6e69d7c4
39 changed files with 258 additions and 141 deletions
+8 -8
View File
@@ -5,26 +5,26 @@
@use template_utils::*;
@use routes::*;
@(ctx: BaseContext, blog: Blog, fqn: String, authors: &Vec<User>, total_articles: i64, page: i32, n_pages: i32, is_author: bool, posts: Vec<Post>)
@(ctx: BaseContext, blog: Blog, authors: &Vec<User>, total_articles: i64, page: i32, n_pages: i32, is_author: bool, posts: Vec<Post>)
@:base(ctx, blog.title.clone(), {}, {
<a href="@uri!(blogs::details: name = &fqn, page = _)">@blog.title</a>
<a href="@uri!(blogs::details: name = &blog.fqn, page = _)">@blog.title</a>
}, {
<div class="hidden">
@for author in authors {
<div class="h-card">
<span class="p-name">@author.name(ctx.0)</span>
<span class="p-name">@author.name()</span>
<a class="u-url" href="@author.ap_url"></a>
</div>
}
</div>
<div class="h-feed">
<h1><span class="p-name">@blog.title</span> <small>~@fqn</small></h1>
<h1><span class="p-name">@blog.title</span> <small>~@blog.fqn</small></h1>
<p>@blog.summary</p>
<p>
@i18n!(ctx.1, "There's one author on this blog: ", "There are {0} authors on this blog: "; authors.len())
@for author in authors {
<a class="author p-author" href="@uri!(user::details: name = author.get_fqn(ctx.0))">@author.name(ctx.0)</a>
<a class="author p-author" href="@uri!(user::details: name = &author.fqn)">@author.name()</a>
}
</p>
<p>
@@ -34,13 +34,13 @@
<section>
<h2>
@i18n!(ctx.1, "Latest articles")
<small><a href="@uri!(blogs::atom_feed: name = &fqn)" title="Atom feed">@icon!("rss")</a></small>
<small><a href="@uri!(blogs::atom_feed: name = &blog.fqn)" title="Atom feed">@icon!("rss")</a></small>
</h2>
@if posts.len() < 1 {
<p>@i18n!(ctx.1, "No posts to see here yet.")</p>
}
@if is_author {
<a href="@uri!(posts::new: blog = &fqn)" class="button inline-block">@i18n!(ctx.1, "New article")</a>
<a href="@uri!(posts::new: blog = &blog.fqn)" class="button inline-block">@i18n!(ctx.1, "New article")</a>
}
<div class="cards">
@for article in posts {
@@ -53,7 +53,7 @@
@if is_author {
<h2>@i18n!(ctx.1, "Danger zone")</h2>
<p>@i18n!(ctx.1, "Be very careful, any action taken here can't be reversed.")</p>
<form method="post" action="@uri!(blogs::delete: name = &fqn)">
<form method="post" action="@uri!(blogs::delete: name = &blog.fqn)">
<input type="submit" class="inline-block button destructive" value="@i18n!(ctx.1, "Permanently delete this blog")">
</form>
}