hyaenidae/server/templates/comments/nodes.rs.html
2021-01-27 20:59:58 -06:00

46 lines
1.5 KiB
HTML

@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};
@(node: &CommentNode, cache: &Cache, parent: &CommentNode, logged_in: bool, dark: bool)
@if let Some(comment) = node.comment(cache) {
@:nested_node({
@:profile_box(&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 {
reply
} else {
view
}
})
}
</div>
@if let Some(state) = node.edit_link(cache) {
<div>
@:link(&state, { edit })
</div>
}
}
</div>
}, {
@:bbcode({
@Html(comment.body())
})
})
})
}
@if node.has_children() {
@:nested_children({
@for child in &node.children {
@:nodes(child, cache, node, logged_in, dark)
}
})
}