2018-12-06 18:54:16 +01:00
|
|
|
@use plume_models::blogs::Blog;
|
2019-04-09 15:33:34 +02:00
|
|
|
@use plume_models::instance::Instance;
|
2018-12-06 18:54:16 +01:00
|
|
|
@use plume_models::posts::Post;
|
|
|
|
@use plume_models::users::User;
|
2020-01-27 23:45:09 +01:00
|
|
|
@use rocket::http::RawStr;
|
2019-08-21 00:42:04 +02:00
|
|
|
@use std::path::Path;
|
2020-01-27 23:45:09 +01:00
|
|
|
@use std::path::PathBuf;
|
2020-01-21 07:02:03 +01:00
|
|
|
@use crate::templates::{base, partials::post_card};
|
|
|
|
@use crate::template_utils::*;
|
|
|
|
@use crate::routes::*;
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2019-03-22 19:51:36 +01:00
|
|
|
@(ctx: BaseContext, blog: Blog, authors: &[User], page: i32, n_pages: i32, posts: Vec<Post>)
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2019-04-09 15:33:34 +02:00
|
|
|
@:base(ctx, blog.title.clone(), {
|
|
|
|
<meta content="profile" property="og:type" />
|
|
|
|
<meta content="120" property="og:image:width" />
|
|
|
|
<meta content="120" property="og:image:height" />
|
|
|
|
<meta content="summary" property="twitter:card" />
|
2019-05-10 22:59:34 +02:00
|
|
|
<meta content="'@Instance::get_local().unwrap().name" property="og:site_name" />
|
2019-04-09 15:33:34 +02:00
|
|
|
<meta content="@blog.ap_url" property="og:url" />
|
|
|
|
<meta content="@blog.fqn" property="profile:username" />
|
|
|
|
<meta content="@blog.title" property="og:title" />
|
|
|
|
<meta content="@blog.summary_html" name="description">
|
|
|
|
<meta content="@blog.summary_html" property="og:description" />
|
2019-04-19 20:13:11 +02:00
|
|
|
<meta content="@blog.icon_url(ctx.0)" property="og:image" />
|
2019-04-09 15:33:34 +02:00
|
|
|
|
2019-05-10 22:59:34 +02:00
|
|
|
<link href='@Instance::get_local().unwrap().compute_box("~", &blog.fqn, "atom.xml")' rel='alternate' type='application/atom+xml'>
|
2019-04-09 15:33:34 +02:00
|
|
|
<link href='@blog.ap_url' rel='alternate' type='application/activity+json'>
|
2019-12-16 22:55:02 +01:00
|
|
|
<link href='@blog.ap_url' rel='canonical'>
|
2019-08-21 00:42:04 +02:00
|
|
|
@if !ctx.2.clone().map(|u| u.hide_custom_css).unwrap_or(false) {
|
|
|
|
@if let Some(ref theme) = blog.theme {
|
|
|
|
<link rel="stylesheet" href="@uri!(plume_static_files: file = Path::new("css").join(theme).join("theme.css"), _build_id = CACHE_NAME)">
|
|
|
|
}
|
|
|
|
}
|
2019-04-09 15:33:34 +02:00
|
|
|
}, {
|
2019-07-11 09:34:27 +02:00
|
|
|
<a href="@uri!(blogs::details: name = &blog.fqn, page = _)" dir="auto">@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">
|
2019-03-06 18:28:10 +01:00
|
|
|
<span class="p-name">@author.name()</span>
|
2018-12-08 21:52:46 +01:00
|
|
|
<a class="u-url" href="@author.ap_url"></a>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
<div class="h-feed">
|
2019-03-22 19:51:36 +01: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">
|
2019-07-11 09:34:27 +02:00
|
|
|
<div class="flex wrap" dir="auto">
|
2019-03-22 19:51:36 +01:00
|
|
|
<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>
|
2019-07-11 09:34:27 +02:00
|
|
|
<small dir="auto">~@blog.fqn</small>
|
2019-03-22 19:51:36 +01:00
|
|
|
</h1>
|
|
|
|
|
|
|
|
@if ctx.2.clone().and_then(|u| u.is_author_in(ctx.0, &blog).ok()).unwrap_or(false) {
|
2019-07-11 09:34:27 +02:00
|
|
|
<a href="@uri!(posts::new: blog = &blog.fqn)" class="button" dir="auto">@i18n!(ctx.1, "New article")</a>
|
|
|
|
<a href="@uri!(blogs::edit: name = &blog.fqn)" class="button" dir="auto">@i18n!(ctx.1, "Edit")</a>
|
2019-03-22 19:51:36 +01:00
|
|
|
}
|
|
|
|
</div>
|
2019-12-16 22:55:02 +01:00
|
|
|
|
2019-07-11 09:34:27 +02:00
|
|
|
<main class="user-summary" dir="auto">
|
2019-03-22 19:51:36 +01:00
|
|
|
<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 {, }
|
2019-07-11 09:34:27 +02:00
|
|
|
<a class="author p-author" href="@uri!(user::details: name = &author.fqn)" dir="auto">@author.name()</a>}
|
2019-03-22 19:51:36 +01:00
|
|
|
</p>
|
|
|
|
@Html(blog.summary_html.clone())
|
|
|
|
</main>
|
|
|
|
</div>
|
2018-12-06 18:54:16 +01:00
|
|
|
|
|
|
|
<section>
|
2019-07-11 09:34:27 +02:00
|
|
|
<h2 dir="auto">
|
2018-12-06 18:54:16 +01:00
|
|
|
@i18n!(ctx.1, "Latest articles")
|
2019-03-06 18:28:10 +01:00
|
|
|
<small><a href="@uri!(blogs::atom_feed: name = &blog.fqn)" title="Atom feed">@icon!("rss")</a></small>
|
2018-12-06 18:54:16 +01:00
|
|
|
</h2>
|
2019-03-19 14:37:56 +01:00
|
|
|
@if posts.is_empty() {
|
2019-07-11 09:34:27 +02:00
|
|
|
<p dir="auto">@i18n!(ctx.1, "No posts to see here yet.")</p>
|
2018-12-06 18:54:16 +01:00
|
|
|
}
|
2019-05-18 14:09:51 +02:00
|
|
|
<div class="cards">
|
2018-12-06 18:54:16 +01:00
|
|
|
@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
|
|
|
})
|