hyaenidae/server/templates/comments/nodes.rs.html

41 lines
1.3 KiB
HTML
Raw Normal View History

@use crate::comments::{CommentNode, ItemWithAuthor};
@use crate::templates::comments::{nodes, profile_box};
@use hyaenidae_toolkit::templates::link;
@use hyaenidae_toolkit::templates::{nested_children, nested_node};
@(node: &CommentNode, replying_to: &ItemWithAuthor, logged_in: bool, dark: bool)
@if let Some((comment, author)) = node.item.comment() {
@:nested_node({
@:profile_box(author, comment, replying_to, dark, {
<div class="comment-links">
@if !comment.deleted() {
<div>
@:link(&node.item.link(dark), {
@if logged_in {
reply
} else {
view
}
})
</div>
@if let Some(state) = node.edit_link(dark) {
<div>
@:link(&state, { edit })
</div>
}
}
</div>
}, {
@comment.body()
})
})
}
@if node.has_children() {
@:nested_children({
@for child in &node.children {
@:nodes(child, &node.item, logged_in, dark)
}
})
}