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

50 lines
1.5 KiB
HTML
Raw Normal View History

@use crate::comments::{CommentNode, ItemWithAuthor};
@use crate::templates::comments::{nodes, profile_box};
@use hyaenidae_toolkit::templates::link;
@(node: &CommentNode, replying_to: &ItemWithAuthor, logged_in: bool, dark: bool)
@if let Some((comment, author)) = node.item.comment() {
<div class="comment">
<div class="comment-body">
@:profile_box(author, comment, replying_to, dark, {
<div class="comment-links">
<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>
}, {
<div class="comment-text">
@comment.body()
</div>
})
</div>
@if node.has_children() {
<div class="comment-children">
@for child in &node.children {
@:nodes(child, &node.item, logged_in, dark)
}
</div>
}
</div>
} else {
@if node.has_children() {
<div class="comment-children">
@for child in &node.children {
@:nodes(child, &node.item, logged_in, dark)
}
</div>
}
}