2018-12-24 10:23:04 +00:00
|
|
|
@use plume_models::comments::CommentTree;
|
2020-01-21 06:02:03 +00:00
|
|
|
@use crate::template_utils::*;
|
|
|
|
@use crate::routes::*;
|
2018-12-06 17:54:16 +00:00
|
|
|
|
2018-12-24 10:23:04 +00:00
|
|
|
@(ctx: BaseContext, comment_tree: &CommentTree, in_reply_to: Option<&str>, blog: &str, slug: &str)
|
2018-12-06 17:54:16 +00:00
|
|
|
|
2018-12-24 10:23:04 +00:00
|
|
|
@if let Some(ref comm) = Some(&comment_tree.comment) {
|
2019-03-19 13:37:56 +00:00
|
|
|
@if let Ok(author) = comm.get_author(ctx.0) {
|
2018-12-08 20:52:46 +00:00
|
|
|
<div class="comment u-comment h-cite" id="comment-@comm.id">
|
2019-05-18 12:09:51 +00:00
|
|
|
<main class="content">
|
|
|
|
<header>
|
2019-07-11 07:34:27 +00:00
|
|
|
<a class="author u-author h-card" href="@uri!(user::details: name = &author.fqn)" dir="auto">
|
2019-05-18 12:09:51 +00:00
|
|
|
@avatar(ctx.0, &author, Size::Small, true, ctx.1)
|
|
|
|
<span class="display-name p-name">@author.name()</span>
|
|
|
|
<small>@author.fqn</small>
|
|
|
|
</a>
|
|
|
|
<p class="dt-published" datetime="@comm.creation_date.format("%F %T")">
|
|
|
|
@if let Some(ref ap_url) = comm.ap_url {
|
|
|
|
<a class="u-url" href="@ap_url">@comm.creation_date.format("%B %e, %Y %H:%M")</a>
|
|
|
|
}
|
|
|
|
</p>
|
|
|
|
|
|
|
|
@if let Some(ref in_reply_to) = in_reply_to {
|
|
|
|
<a class="u-in-reply-to hidden" href="@in_reply_to"></a>
|
|
|
|
}
|
|
|
|
</header>
|
|
|
|
<div class="text p-content">
|
|
|
|
@if comm.sensitive {
|
|
|
|
<details>
|
2019-07-11 07:34:27 +00:00
|
|
|
<summary dir="auto">@comm.spoiler_text</summary>
|
2019-05-18 12:09:51 +00:00
|
|
|
}
|
|
|
|
@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>
|
|
|
|
@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('@i18n!(ctx.1, "Are you sure?")')" type="submit" value="@i18n!(ctx.1, "Delete this comment")">
|
|
|
|
</form>
|
2018-12-06 17:54:16 +00:00
|
|
|
}
|
2019-05-18 12:09:51 +00:00
|
|
|
</main>
|
2018-12-24 10:23:04 +00:00
|
|
|
@for res in &comment_tree.responses {
|
2021-01-15 14:21:33 +00:00
|
|
|
@:comment_html(ctx, res, comm.ap_url.as_deref(), blog, slug)
|
2018-12-06 17:54:16 +00:00
|
|
|
}
|
|
|
|
</div>
|
2018-12-24 10:23:04 +00:00
|
|
|
}}
|