2018-12-06 18:54:16 +01:00
|
|
|
@use template_utils::*;
|
|
|
|
@use plume_models::comments::Comment;
|
|
|
|
@use plume_models::users::User;
|
2018-12-07 12:05:01 +01:00
|
|
|
@use routes::*;
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2018-12-23 11:13:36 +01:00
|
|
|
@(ctx: BaseContext, comm: &Comment, author: User, in_reply_to: Option<&str>, blog: &str, slug: &str)
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2018-12-08 21:52:46 +01:00
|
|
|
<div class="comment u-comment h-cite" id="comment-@comm.id">
|
|
|
|
<a class="author u-author h-card" href="@uri!(user::details: name = author.get_fqn(ctx.0))">
|
2018-12-06 18:54:16 +01:00
|
|
|
@avatar(ctx.0, &author, Size::Small, true, ctx.1)
|
2018-12-08 21:52:46 +01:00
|
|
|
<span class="display-name p-name">@author.name(ctx.0)</span>
|
2018-12-06 18:54:16 +01:00
|
|
|
<small>@author.get_fqn(ctx.0)</small>
|
2018-12-23 11:13:36 +01:00
|
|
|
</a>
|
2018-12-08 21:52:46 +01:00
|
|
|
@if let Some(ref ap_url) = comm.ap_url {
|
|
|
|
<a class="u-url" href="@ap_url"></a>
|
|
|
|
}
|
|
|
|
@if let Some(ref in_reply_to) = in_reply_to {
|
|
|
|
<a class="u-in-reply-to" href="@in_reply_to"></a>
|
|
|
|
}
|
|
|
|
<div class="text p-content">
|
2018-12-06 18:54:16 +01:00
|
|
|
@if comm.sensitive {
|
|
|
|
<details>
|
|
|
|
<summary>@comm.spoiler_text</summary>
|
|
|
|
}
|
|
|
|
@Html(&comm.content)
|
|
|
|
@if comm.sensitive {
|
|
|
|
</details>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
<a class="button icon icon-message-circle" href="?responding_to=@comm.id">@i18n!(ctx.1, "Respond")</a>
|
2018-12-23 11:13:36 +01:00
|
|
|
@if ctx.2.clone().map(|u| u.id == author.id).unwrap_or(false) {
|
|
|
|
<form class="inline icon icon-trash" method="post" action="@uri!(comments::delete: blog = blog, slug = slug, id = comm.id)">
|
|
|
|
<input onclick="return confirm('Are you sure you?')" type="submit" value="@i18n!(ctx.1, "Delete this comment")">
|
|
|
|
</form>
|
|
|
|
}
|
2018-12-06 18:54:16 +01:00
|
|
|
@for res in comm.get_responses(ctx.0) {
|
2018-12-23 11:13:36 +01:00
|
|
|
@:comment(ctx, &res, res.get_author(ctx.0), comm.ap_url.as_ref().map(|u| &**u), blog, slug)
|
2018-12-06 18:54:16 +01:00
|
|
|
}
|
|
|
|
</div>
|