2018-12-06 18:54:16 +01:00
|
|
|
@use plume_models::blogs::Blog;
|
|
|
|
@use plume_models::posts::Post;
|
|
|
|
@use plume_models::users::User;
|
|
|
|
@use templates::{base, partials::post_card};
|
|
|
|
@use template_utils::*;
|
2018-12-07 12:05:01 +01:00
|
|
|
@use routes::*;
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2018-12-14 23:16:18 +01:00
|
|
|
@(ctx: BaseContext, blog: Blog, fqn: String, authors: &Vec<User>, total_articles: i64, page: i32, n_pages: i32, is_author: bool, posts: Vec<Post>)
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2019-02-02 15:23:50 +01:00
|
|
|
@:base(ctx, blog.title.clone(), {}, {
|
2018-12-13 22:20:19 +01:00
|
|
|
<a href="@uri!(blogs::details: name = &fqn, page = _)">@blog.title</a>
|
2018-12-06 18:54:16 +01:00
|
|
|
}, {
|
2018-12-08 21:52:46 +01:00
|
|
|
<div class="hidden">
|
|
|
|
@for author in authors {
|
|
|
|
<div class="h-card">
|
|
|
|
<span class="p-name">@author.name(ctx.0)</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>
|
2018-12-06 18:54:16 +01:00
|
|
|
<p>@blog.summary</p>
|
|
|
|
<p>
|
2019-02-02 15:23:50 +01:00
|
|
|
@i18n!(ctx.1, "There's one author on this blog: ", "There are {0} authors on this blog: "; authors.len())
|
2018-12-06 18:54:16 +01:00
|
|
|
@for author in authors {
|
2018-12-08 21:52:46 +01:00
|
|
|
<a class="author p-author" href="@uri!(user::details: name = author.get_fqn(ctx.0))">@author.name(ctx.0)</a>
|
2018-12-06 18:54:16 +01:00
|
|
|
}
|
|
|
|
</p>
|
|
|
|
<p>
|
2019-02-02 15:23:50 +01:00
|
|
|
@i18n!(ctx.1, "There's one article on this blog", "There are {0} articles on this blog"; total_articles)
|
2018-12-06 18:54:16 +01:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<h2>
|
|
|
|
@i18n!(ctx.1, "Latest articles")
|
2018-12-07 12:05:01 +01:00
|
|
|
<small><a href="@uri!(blogs::atom_feed: name = &fqn)" title="Atom feed">@icon!("rss")</a></small>
|
2018-12-06 18:54:16 +01:00
|
|
|
</h2>
|
|
|
|
@if posts.len() < 1 {
|
|
|
|
<p>@i18n!(ctx.1, "No posts to see here yet.")</p>
|
|
|
|
}
|
|
|
|
@if is_author {
|
2018-12-07 12:05:01 +01:00
|
|
|
<a href="@uri!(posts::new: blog = &fqn)" class="button inline-block">@i18n!(ctx.1, "New article")</a>
|
2018-12-06 18:54:16 +01:00
|
|
|
}
|
|
|
|
<div class="cards">
|
|
|
|
@for article in posts {
|
|
|
|
@:post_card(ctx, article)
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
@paginate(ctx.1, page, n_pages)
|
|
|
|
</section>
|
2018-12-08 21:52:46 +01:00
|
|
|
</div>
|
2018-12-06 18:54:16 +01:00
|
|
|
@if is_author {
|
|
|
|
<h2>@i18n!(ctx.1, "Danger zone")</h2>
|
2018-12-25 15:55:18 +01:00
|
|
|
<p>@i18n!(ctx.1, "Be very careful, any action taken here can't be reversed.")</p>
|
2018-12-07 12:05:01 +01:00
|
|
|
<form method="post" action="@uri!(blogs::delete: name = &fqn)">
|
2018-12-25 15:55:18 +01:00
|
|
|
<input type="submit" class="inline-block button destructive" value="@i18n!(ctx.1, "Permanently delete this blog")">
|
2018-12-06 18:54:16 +01:00
|
|
|
</form>
|
|
|
|
}
|
|
|
|
})
|