hyaenidae/templates/comments/nodes.rs.html

50 lines
1.7 KiB
HTML

@use crate::ActixLoader;
@use crate::comments::{Cache, CommentNode};
@use crate::templates::comments::{nodes, profile_box};
@use hyaenidae_toolkit::templates::bbcode;
@use hyaenidae_toolkit::templates::link;
@use hyaenidae_toolkit::templates::{nested_children, nested_node};
@use i18n_embed_fl::fl;
@(loader: &ActixLoader, node: &CommentNode, cache: &Cache, parent: &CommentNode, logged_in: bool, dark: bool)
@if let Some(comment) = node.comment(cache) {
@:nested_node({
@:profile_box(loader, &node.author(cache), comment.published(), parent, cache, dark, {
<div class="comment-links">
@if !comment.deleted() {
<div>
@if let Some(l) = node.view_link(cache) {
@:link(&l, {
@if logged_in {
@fl!(loader, "reply-link")
} else {
@fl!(loader, "view-link")
}
})
}
</div>
@if let Some(state) = node.edit_link(cache) {
<div>
@:link(&state, {
@fl!(loader, "edit-link")
})
</div>
}
}
</div>
}, {
@:bbcode({
@Html(comment.body())
})
})
})
}
@if node.has_children() {
@:nested_children({
@for child in &node.children {
@:nodes(loader, child, cache, node, logged_in, dark)
}
})
}