Change mod_list to flagged_list; add moderator nav bar under regular nav bar

This commit is contained in:
swag 2022-12-02 23:22:55 -05:00
parent de8a76271d
commit 7d3d6c1fca
6 changed files with 22 additions and 17 deletions

View File

@ -150,9 +150,9 @@ sub startup($self) {
return undef; return undef;
}); });
$moderator->get('/list') $moderator->get('/flagged')
->to('moderator#list') ->to('moderator#flagged')
->name('mod_list'); ->name('flagged_list');
} }
1; 1;

View File

@ -8,7 +8,7 @@ sub login($self) {
my $v; my $v;
#Already logged in? #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'; $v = $self->validation if $self->req->method eq 'POST';
@ -35,7 +35,7 @@ sub login($self) {
); );
$self->flash(info => "Hello, $mod_name 😎"); $self->flash(info => "Hello, $mod_name 😎");
return $self->redirect_to('mod_list'); return $self->redirect_to('flagged_list');
} }
else { else {
$self->stash( $self->stash(

View File

@ -29,15 +29,15 @@ subtest Login => sub {
$t->post_ok('/login', form => \%valid_login) $t->post_ok('/login', form => \%valid_login)
->status_is(302) ->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) ->status_is(200)
->text_like(h2 => qr/Top Secret/); ->text_like(h2 => qr/Flagged Posts/);
$t->get_ok('/login') $t->get_ok('/login')
->status_is(302) ->status_is(302)
->header_like(Location => qr{moderator/list}); ->header_like(Location => qr{moderator/flagged});
$t->get_ok('/logout') $t->get_ok('/logout')
->status_is(302) ->status_is(302)

View File

@ -9,8 +9,14 @@
<nav> <nav>
<%= link_to List => 'threads_list' %> <%= link_to List => 'threads_list' %>
<%= link_to New => 'post_thread' %> <%= link_to New => 'post_thread' %>
<%= link_to Moderate => 'mod_list' %> <%= link_to Login => 'mod_login' %>
</nav> </nav>
<% if (is_mod) { =%>
<nav>
<%= link_to Flagged => 'flagged_list' %>
<%= link_to Logout => 'mod_logout' %>
</nav>
<% } =%>
<hr> <hr>
<% if (flash 'error') { =%> <% if (flash 'error') { =%>
<p class="field-with-error" id="error"><%= flash 'error' %></p> <p class="field-with-error" id="error"><%= flash 'error' %></p>

View File

@ -0,0 +1,4 @@
% layout 'default';
% title 'Flagged Posts';
<h2><%= title %></h2>
<p>Coming soon, stay tuned.</p>

View File

@ -1,5 +0,0 @@
% layout 'default';
% title 'Top Secret';
<h2><%= title %></h2>
<p>For mods only!!</p>
<%= link_to Logout => 'mod_logout' %>