Fix <nav> hyperlink; implement placeholder for /spam too
This commit is contained in:
parent
8f95b616cf
commit
07e7f69e90
|
@ -58,38 +58,10 @@ under sub ($c) {
|
|||
1;
|
||||
};
|
||||
|
||||
#get '/' => sub ($c) {
|
||||
# my $this_page = $c->param('page') || 1;
|
||||
# my $last_page = $c->message->get_last_page();
|
||||
# my $view_posts = $c->message->get_posts($this_page);
|
||||
#
|
||||
# $c->stash(
|
||||
# view_posts => $view_posts,
|
||||
# this_page => $this_page,
|
||||
# last_page => $last_page
|
||||
# );
|
||||
#
|
||||
# $c->render();
|
||||
#} => 'index';
|
||||
|
||||
get '/' => sub ($c) {
|
||||
$c->redirect_to('view');
|
||||
};
|
||||
|
||||
get '/spam' => sub ($c) {
|
||||
my $this_page = $c->param('page') || 1;
|
||||
my $last_page = $c->message->get_last_page('spam');
|
||||
my $view_posts = $c->message->get_spam($this_page);
|
||||
|
||||
$c->stash(
|
||||
view_posts => $view_posts,
|
||||
this_page => $this_page,
|
||||
last_page => $last_page
|
||||
);
|
||||
|
||||
$c->render();
|
||||
} => 'index';
|
||||
|
||||
any [qw{GET POST}], '/sign' => sub ($c) {
|
||||
my $v = $c->validation();
|
||||
|
||||
|
@ -151,6 +123,26 @@ group {
|
|||
};
|
||||
};
|
||||
|
||||
group {
|
||||
under '/spam';
|
||||
|
||||
get '/:page_number', {page_number => 1} => sub ($c) {
|
||||
my $this_page = $c->param('page_number');
|
||||
my $last_page = $c->message->get_last_page('spam');
|
||||
my $view_posts = $c->message->get_spam($this_page);
|
||||
my $base_path = $c->url_for(page_number => undef);
|
||||
|
||||
$c->stash(
|
||||
view_posts => $view_posts,
|
||||
this_page => $this_page,
|
||||
last_page => $last_page,
|
||||
base_path => $base_path
|
||||
);
|
||||
|
||||
$c->render();
|
||||
};
|
||||
};
|
||||
|
||||
group {
|
||||
under '/view';
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div class="outer">
|
||||
<h1 id="top">Swagg::Net::Guestbook</h1>
|
||||
<nav>
|
||||
<%= link_to View => 'index' %>
|
||||
<%= link_to View => 'view' %>
|
||||
<%= link_to Sign => 'sign' %>
|
||||
<%= link_to Home => 'https://www.swagg.net' %>
|
||||
</nav>
|
||||
|
|
Loading…
Reference in a new issue