2018-12-06 17:54:16 +00: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 11:05:01 +00:00
|
|
|
@use routes::*;
|
2018-12-06 17:54:16 +00:00
|
|
|
|
2019-03-22 18:51:36 +00:00
|
|
|
@(ctx: BaseContext, blog: Blog, authors: &[User], page: i32, n_pages: i32, posts: Vec<Post>)
|
2018-12-06 17:54:16 +00:00
|
|
|
|
2019-02-02 14:23:50 +00:00
|
|
|
@:base(ctx, blog.title.clone(), {}, {
|
2019-03-06 17:28:10 +00:00
|
|
|
<a href="@uri!(blogs::details: name = &blog.fqn, page = _)">@blog.title</a>
|
2018-12-06 17:54:16 +00:00
|
|
|
}, {
|
2018-12-08 20:52:46 +00:00
|
|
|
<div class="hidden">
|
|
|
|
@for author in authors {
|
|
|
|
<div class="h-card">
|
2019-03-06 17:28:10 +00:00
|
|
|
<span class="p-name">@author.name()</span>
|
2018-12-08 20:52:46 +00:00
|
|
|
<a class="u-url" href="@author.ap_url"></a>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
<div class="h-feed">
|
2019-03-22 18:51:36 +00:00
|
|
|
@if let Some(banner_url) = blog.banner_url(ctx.0) {
|
|
|
|
<div class="cover" style="background-image: url('@Html(banner_url.clone())')"></div>
|
|
|
|
<img class="hidden u-photo" src="@banner_url"/>
|
|
|
|
}
|
|
|
|
<div class="h-card">
|
|
|
|
<div class="user">
|
|
|
|
<div class="flex wrap">
|
|
|
|
<div class="avatar medium" style="background-image: url('@blog.icon_url(ctx.0)');" aria-label="@i18n!(ctx.1, "{}'s icon"; &blog.title)"></div>
|
|
|
|
<img class="hidden u-photo" src="@blog.icon_url(ctx.0)"/>
|
|
|
|
|
|
|
|
<h1 class="grow flex vertical">
|
|
|
|
<span class="p-name">@blog.title</span>
|
|
|
|
<small>~@blog.fqn</small>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
@if ctx.2.clone().and_then(|u| u.is_author_in(ctx.0, &blog).ok()).unwrap_or(false) {
|
|
|
|
<a href="@uri!(posts::new: blog = &blog.fqn)" class="button">@i18n!(ctx.1, "New article")</a>
|
|
|
|
<a href="@uri!(blogs::edit: name = &blog.fqn)" class="button">@i18n!(ctx.1, "Edit")</a>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<main class="user-summary">
|
|
|
|
<p>
|
|
|
|
@i18n!(ctx.1, "There's one author on this blog: ", "There are {0} authors on this blog: "; authors.len())
|
|
|
|
@for (i, author) in authors.iter().enumerate() {@if i >= 1 {, }
|
|
|
|
<a class="author p-author" href="@uri!(user::details: name = &author.fqn)">@author.name()</a>}
|
|
|
|
</p>
|
|
|
|
@Html(blog.summary_html.clone())
|
|
|
|
</main>
|
|
|
|
</div>
|
2018-12-06 17:54:16 +00:00
|
|
|
|
|
|
|
<section>
|
|
|
|
<h2>
|
|
|
|
@i18n!(ctx.1, "Latest articles")
|
2019-03-06 17:28:10 +00:00
|
|
|
<small><a href="@uri!(blogs::atom_feed: name = &blog.fqn)" title="Atom feed">@icon!("rss")</a></small>
|
2018-12-06 17:54:16 +00:00
|
|
|
</h2>
|
2019-03-19 13:37:56 +00:00
|
|
|
@if posts.is_empty() {
|
2018-12-06 17:54:16 +00:00
|
|
|
<p>@i18n!(ctx.1, "No posts to see here yet.")</p>
|
|
|
|
}
|
|
|
|
<div class="cards">
|
|
|
|
@for article in posts {
|
|
|
|
@:post_card(ctx, article)
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
@paginate(ctx.1, page, n_pages)
|
|
|
|
</section>
|
2018-12-08 20:52:46 +00:00
|
|
|
</div>
|
2018-12-06 17:54:16 +00:00
|
|
|
})
|