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_id = $self->param('remark_id');
|
||||||
my $remark = $self->remark->by_id($remark_id);
|
my $remark = $self->remark->by_id($remark_id);
|
||||||
|
|
||||||
if (my $remark_id = $remark->{'id'}) {
|
$self->stash(remark => $remark);
|
||||||
$self->stash(remark => $remark)
|
|
||||||
}
|
$self->stash(error => 'Remark not found 🤷')
|
||||||
else {
|
unless keys %{$remark};
|
||||||
$self->stash(
|
|
||||||
remark => {},
|
|
||||||
error => 'Remark not found 🤷'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
$self->render;
|
$self->render;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
% layout 'default';
|
% layout 'default';
|
||||||
% title my $remark_id = $remark->{'id'} ? "Remark #$remark_id" : '?';
|
% title my $remark_id = $remark->{'id'} ? "Remark #$remark_id" : '?';
|
||||||
<h2 class="page-title"><%= title %></h2>
|
<h2 class="page-title"><%= title %></h2>
|
||||||
<% if (my $remark_id = $remark->{'id'}) { =%>
|
<% if (keys %{$remark}) { =%>
|
||||||
<main class="pager">
|
<main class="pager">
|
||||||
<article class="post">
|
<article class="post">
|
||||||
<h4 class="post__title">
|
<h4 class="post__title">
|
||||||
<%= $remark->{'date'} %>
|
<%= $remark->{'date'} %>
|
||||||
<span class="post__id">#<%= $remark_id %></span>
|
<span class="post__id">#<%= $remark->{'id'} %></span>
|
||||||
</h4>
|
</h4>
|
||||||
<h5 class="post__author"><%= $remark->{'author'} %></h5>
|
<h5 class="post__author"><%= $remark->{'author'} %></h5>
|
||||||
<div class="post__body">
|
<div class="post__body">
|
||||||
|
|
Loading…
Reference in a new issue