hyaenidae/server/templates/comments/edit.rs.html
2021-01-24 15:30:02 -06:00

49 lines
1.8 KiB
HTML

@use crate::comments::CommentView;
@use crate::extensions::ProfileExt;
@use crate::nav::NavState;
@use crate::templates::layouts::home;
@use crate::templates::comments::nodes;
@use hyaenidae_toolkit::{templates::button_group, Button};
@use hyaenidae_toolkit::{templates::{card, card_title, card_body}, Card};
@use hyaenidae_toolkit::templates::nested;
@use hyaenidae_toolkit::{templates::text_input};
@(view: &CommentView, nav_state: &NavState)
@if let Some(comment) = view.comments.comment(&view.cache) {
@:home(&view.author().profile.name(), comment.body(), nav_state, {}, {
@:card(&Card::full_width().dark(nav_state.dark()), {
<form method="POST" action="@crate::comments::update_path(comment)">
@:card_title({ Comment })
@:card_body({
<p>Update Comment</p>
@:text_input(&view.input)
})
@:card_body({
@:button_group(&[
Button::primary("Update"),
Button::secondary("Back to Submission").href(&view.submission_path()),
])
})
</form>
})
@if view.comments.has_children() {
@:card(&Card::full_width().dark(nav_state.dark()), {
@:card_title({ Replies })
@:card_body({
@:nested(nav_state.dark(), {
@for child in &view.comments.children {
@:nodes(child, &view.cache, &view.comments, view.logged_in, nav_state.dark())
}
})
})
})
}
})
} else {
@:home("Comment Gone", "Not sure where that comment went!", nav_state, {}, {
Not sure where that comment went!
})
}