Change mod_list to flagged_list; add moderator nav bar under regular nav bar
This commit is contained in:
parent
de8a76271d
commit
7d3d6c1fca
|
@ -150,9 +150,9 @@ sub startup($self) {
|
|||
return undef;
|
||||
});
|
||||
|
||||
$moderator->get('/list')
|
||||
->to('moderator#list')
|
||||
->name('mod_list');
|
||||
$moderator->get('/flagged')
|
||||
->to('moderator#flagged')
|
||||
->name('flagged_list');
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -8,7 +8,7 @@ sub login($self) {
|
|||
my $v;
|
||||
|
||||
#Already logged in?
|
||||
return $self->redirect_to('mod_list') if $self->is_mod;
|
||||
return $self->redirect_to('flagged_list') if $self->is_mod;
|
||||
|
||||
$v = $self->validation if $self->req->method eq 'POST';
|
||||
|
||||
|
@ -35,7 +35,7 @@ sub login($self) {
|
|||
);
|
||||
$self->flash(info => "Hello, $mod_name 😎");
|
||||
|
||||
return $self->redirect_to('mod_list');
|
||||
return $self->redirect_to('flagged_list');
|
||||
}
|
||||
else {
|
||||
$self->stash(
|
||||
|
|
|
@ -29,15 +29,15 @@ subtest Login => sub {
|
|||
|
||||
$t->post_ok('/login', form => \%valid_login)
|
||||
->status_is(302)
|
||||
->header_like(Location => qr{moderator/list});
|
||||
->header_like(Location => qr{moderator/flagged});
|
||||
|
||||
$t->get_ok('/moderator/list')
|
||||
$t->get_ok('/moderator/flagged')
|
||||
->status_is(200)
|
||||
->text_like(h2 => qr/Top Secret/);
|
||||
->text_like(h2 => qr/Flagged Posts/);
|
||||
|
||||
$t->get_ok('/login')
|
||||
->status_is(302)
|
||||
->header_like(Location => qr{moderator/list});
|
||||
->header_like(Location => qr{moderator/flagged});
|
||||
|
||||
$t->get_ok('/logout')
|
||||
->status_is(302)
|
||||
|
|
|
@ -7,10 +7,16 @@
|
|||
<body>
|
||||
<h1>Post::Text</h1>
|
||||
<nav>
|
||||
<%= link_to List => 'threads_list' %>
|
||||
<%= link_to New => 'post_thread' %>
|
||||
<%= link_to Moderate => 'mod_list' %>
|
||||
<%= link_to List => 'threads_list' %>
|
||||
<%= link_to New => 'post_thread' %>
|
||||
<%= link_to Login => 'mod_login' %>
|
||||
</nav>
|
||||
<% if (is_mod) { =%>
|
||||
<nav>
|
||||
<%= link_to Flagged => 'flagged_list' %>
|
||||
<%= link_to Logout => 'mod_logout' %>
|
||||
</nav>
|
||||
<% } =%>
|
||||
<hr>
|
||||
<% if (flash 'error') { =%>
|
||||
<p class="field-with-error" id="error"><%= flash 'error' %></p>
|
||||
|
|
4
templates/moderator/flagged.html.ep
Normal file
4
templates/moderator/flagged.html.ep
Normal file
|
@ -0,0 +1,4 @@
|
|||
% layout 'default';
|
||||
% title 'Flagged Posts';
|
||||
<h2><%= title %></h2>
|
||||
<p>Coming soon, stay tuned.</p>
|
|
@ -1,5 +0,0 @@
|
|||
% layout 'default';
|
||||
% title 'Top Secret';
|
||||
<h2><%= title %></h2>
|
||||
<p>For mods only!!</p>
|
||||
<%= link_to Logout => 'mod_logout' %>
|
Loading…
Reference in a new issue