Works on template

Use uri! to generate links instead of hardcoded urls
Fix #110
Fix invalid links needing to be POST forms
Translate login message for boost and like directly from template
Put js for search in its own file
This commit is contained in:
Trinity Pointard
2018-12-07 12:05:01 +01:00
parent 70af57c6e1
commit b4e4b497ee
30 changed files with 218 additions and 175 deletions
+2 -1
View File
@@ -1,11 +1,12 @@
@use template_utils::*;
@use plume_models::comments::Comment;
@use plume_models::users::User;
@use routes::*;
@(ctx: BaseContext, comm: &Comment, author: User)
<div class="comment" id="comment-@comm.id">
<a class="author" href="/@@/@author.get_fqn(ctx.0)/">
<a class="author" href="@uri!(user::details: name = author.get_fqn(ctx.0))">
@avatar(ctx.0, &author, Size::Small, true, ctx.1)
<span class="display-name">@author.name(ctx.0)</span>
<small>@author.get_fqn(ctx.0)</small>
@@ -1,5 +1,6 @@
@use template_utils::*;
@use plume_models::instance::Instance;
@use routes::*;
@(ctx: BaseContext, instance: Instance, n_users: i32, n_articles: i32)
@@ -12,7 +13,7 @@
<p>@i18n!(ctx.1, "Authors can manage various blogs from an unique website.")</p>
<p>@i18n!(ctx.1, "Articles are also visible on other Plume websites, and you can interact with them directly from other platforms like Mastodon.")</p>
</main>
<a href="/users/new">@i18n!(ctx.1, "Create your account")</a>
<a href="@uri!(user::new)">@i18n!(ctx.1, "Create your account")</a>
</div>
<div class="presentation card">
<h2>@i18n!(ctx.1, "About {0}"; instance.name)</h2>
@@ -27,7 +28,7 @@
</div>
</section>
</main>
<a href="/about">@i18n!(ctx.1, "Read the detailed rules")</a>
<a href="@uri!(instance::about)">@i18n!(ctx.1, "Read the detailed rules")</a>
</div>
</div>
</section>
+6 -5
View File
@@ -1,5 +1,6 @@
@use template_utils::*;
@use plume_models::posts::Post;
@use template_utils::*;
@use routes::*;
@(ctx: BaseContext, article: Post)
@@ -7,20 +8,20 @@
@if article.cover_id.is_some() {
<div class="cover" style="background-image: url('@Html(article.cover_url(ctx.0).unwrap_or_default())')"></div>
}
<h3><a href="@article.url(ctx.0)">@article.title</a></h3>
<h3><a href="@uri!(posts::details: blog = article.get_blog(ctx.0).get_fqn(ctx.0), slug = &article.slug)">@article.title</a></h3>
<main>
<p>@article.subtitle</p>
</main>
<p class="author">
@Html(i18n!(ctx.1, "By {0}"; format!(
"<a href=\"/@/{}/\">{}</a>",
escape(&article.get_authors(ctx.0)[0].get_fqn(ctx.0)),
"<a href=\"{}\">{}</a>",
uri!(user::details: name = article.get_authors(ctx.0)[0].get_fqn(ctx.0)),
escape(&article.get_authors(ctx.0)[0].name(ctx.0))
)))
@if article.published {
⋅ @article.creation_date.format("%B %e, %Y")
}
<a href="/~/@article.get_blog(ctx.0).get_fqn(ctx.0)/">@article.get_blog(ctx.0).title</a>
<a href="@uri!(blogs::details: name = article.get_blog(ctx.0).get_fqn(ctx.0))">@article.get_blog(ctx.0).title</a>
@if !article.published {
⋅ @i18n!(ctx.1, "Draft")
}