Fix the is_admin helper

This commit is contained in:
swag 2023-04-16 15:15:39 -04:00
parent 33e38e26f6
commit 65d98d594c
2 changed files with 5 additions and 2 deletions

View File

@ -58,6 +58,10 @@ sub startup($self) {
return undef; return undef;
}); });
$self->helper(is_admin => sub ($c) {
$c->session->{'is_admin'} || undef
});
# Finish configuring some things # Finish configuring some things
$self->secrets($self->config->{'secrets'}) || die $@; $self->secrets($self->config->{'secrets'}) || die $@;

View File

@ -8,7 +8,6 @@
<h1>Post::Text</h1> <h1>Post::Text</h1>
<nav> <nav>
<div> <div>
<span>Navigate:</span>
<%= link_to List => 'threads_list' %> <%= link_to List => 'threads_list' %>
<%= link_to New => 'post_thread' %> <%= link_to New => 'post_thread' %>
<% unless (is_mod) { =%> <% unless (is_mod) { =%>
@ -24,7 +23,7 @@
<% } =%> <% } =%>
</div> </div>
<div> <div>
<% if (is_mod && session->{'is_admin'}) { =%> <% if (is_mod && is_admin) { =%>
<span>Admin:</span> <span>Admin:</span>
<%= link_to Create => 'create_mod' %> <%= link_to Create => 'create_mod' %>
<% } =%> <% } =%>