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

This commit is contained in:
swagg boi 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;
});
$moderator->get('/list')
->to('moderator#list')
->name('mod_list');
$moderator->get('/flagged')
->to('moderator#flagged')
->name('flagged_list');
}
1;

View file

@ -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(

View file

@ -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)

View file

@ -9,8 +9,14 @@
<nav>
<%= link_to List => 'threads_list' %>
<%= link_to New => 'post_thread' %>
<%= link_to Moderate => 'mod_list' %>
<%= 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>

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' %>