Clean up remark->create plus new 404 behavior

This commit is contained in:
swag 2023-05-29 00:45:40 -04:00
parent 957885a38e
commit 7cf9981973
2 changed files with 8 additions and 3 deletions

View File

@ -57,6 +57,9 @@ sub create($self) {
last_remark => $last_remark
);
$self->stash(status => 404, error => 'Thread not found 🤷')
unless keys %{$thread};
return $self->render;
}

View File

@ -1,6 +1,7 @@
% layout 'default';
% title 'New Remark';
<h2 class="page-title"><%= title %></h2>
<% if (keys %{$thread}) { =%>
<form method="post" class="form-body">
<div class="form-field">
<% if (my $error = validation->error('author')) { =%>
@ -49,7 +50,8 @@
</div>
</article>
</section>
<% if (my $last_remark_id = $last_remark->{'id'}) { =%>
<% } =%>
<% if (keys %{$last_remark}) { =%>
<section class="pager">
<h3 class="pager__title">Last Remark</h3>
<article class="post">
@ -57,8 +59,8 @@
<span>
<%= $last_remark->{'date'} %>
</span>
<%= link_to "#$last_remark_id", single_remark =>
{remark_id => $last_remark_id}, (class => 'post__id') %>
<%= link_to "#$last_remark->{'id'}", single_remark =>
{remark_id => $last_remark->{'id'}}, (class => 'post__id') %>
</h4>
<h5 class="post__author"><%= $last_remark->{'author'} %></h5>
<div class="post__body">