Clean-up 404 for remark->by_id
This commit is contained in:
parent
f8bdcc9201
commit
a220c233fa
|
@ -6,15 +6,10 @@ sub by_id($self) {
|
|||
my $remark_id = $self->param('remark_id');
|
||||
my $remark = $self->remark->by_id($remark_id);
|
||||
|
||||
if (my $remark_id = $remark->{'id'}) {
|
||||
$self->stash(remark => $remark)
|
||||
}
|
||||
else {
|
||||
$self->stash(
|
||||
remark => {},
|
||||
error => 'Remark not found 🤷'
|
||||
)
|
||||
}
|
||||
$self->stash(remark => $remark);
|
||||
|
||||
$self->stash(error => 'Remark not found 🤷')
|
||||
unless keys %{$remark};
|
||||
|
||||
$self->render;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
% layout 'default';
|
||||
% title my $remark_id = $remark->{'id'} ? "Remark #$remark_id" : '?';
|
||||
<h2 class="page-title"><%= title %></h2>
|
||||
<% if (my $remark_id = $remark->{'id'}) { =%>
|
||||
<% if (keys %{$remark}) { =%>
|
||||
<main class="pager">
|
||||
<article class="post">
|
||||
<h4 class="post__title">
|
||||
<%= $remark->{'date'} %>
|
||||
<span class="post__id">#<%= $remark_id %></span>
|
||||
<span class="post__id">#<%= $remark->{'id'} %></span>
|
||||
</h4>
|
||||
<h5 class="post__author"><%= $remark->{'author'} %></h5>
|
||||
<div class="post__body">
|
||||
|
|
Loading…
Reference in a new issue