diff --git a/app/models/user.rb b/app/models/user.rb index b89dddcd..59c3f618 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -116,4 +116,10 @@ class User < ActiveRecord::Base increment! :commented_count answer.increment! :comment_count end + + # @return [Boolean] is the user a moderator? + def mod? + return true if self.moderator? or self.admin? + false + end end diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index 32bab7a8..35d9b6b2 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -38,6 +38,8 @@ - if current_user.admin? %li= link_to "Kontrollzentrum", rails_admin_path %li= link_to "Sidekiq", sidekiq_web_path + - if current_user.mod? + %li= link_to "Moderation panel", moderation_path %li.divider %li= link_to "Logout", destroy_user_session_path, method: :delete - else