Cleanup thread->by_page
This commit is contained in:
parent
e8d3e716ce
commit
957885a38e
|
@ -76,24 +76,15 @@ sub by_page($self) {
|
||||||
my $last_page = $self->thread->last_page;
|
my $last_page = $self->thread->last_page;
|
||||||
my $threads = $self->thread->by_page($this_page);
|
my $threads = $self->thread->by_page($this_page);
|
||||||
|
|
||||||
if (my $first_thread = $threads->[0]) {
|
$self->stash(
|
||||||
$self->stash(
|
threads => $threads,
|
||||||
threads => $threads,
|
this_page => $this_page,
|
||||||
this_page => $this_page,
|
last_page => $last_page,
|
||||||
last_page => $last_page,
|
base_path => $base_path
|
||||||
base_path => $base_path
|
);
|
||||||
)
|
|
||||||
}
|
$self->stash(status => 404, error => 'Page not found 🕵️')
|
||||||
else {
|
unless scalar @{$threads};
|
||||||
$self->stash(
|
|
||||||
threads => [],
|
|
||||||
this_page => undef,
|
|
||||||
last_page => undef,
|
|
||||||
base_path => undef,
|
|
||||||
status => 404,
|
|
||||||
error => 'Page not found 🕵️'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
$self->render;
|
$self->render;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
% layout 'default';
|
% layout 'default';
|
||||||
% title 'Threads List';
|
% title 'Threads List';
|
||||||
<h2 class="page-title"><%= title %></h2>
|
<h2 class="page-title"><%= title %></h2>
|
||||||
<% if (my $first_thread = $threads->[0]) { =%>
|
<% if (scalar @{$threads}) { =%>
|
||||||
<main class="pager">
|
<main class="pager">
|
||||||
<% for my $thread (@{$threads}) { =%>
|
<% for my $thread (@{$threads}) { =%>
|
||||||
<article class="post">
|
<article class="post">
|
||||||
|
|
Loading…
Reference in a new issue