From cb003ce36d25a2b4f3c89d91db2e7f73cd3c2211 Mon Sep 17 00:00:00 2001 From: nilsding Date: Fri, 26 Dec 2014 14:09:07 +0100 Subject: [PATCH] added link to moderation panel in navbar --- app/models/user.rb | 6 ++++++ app/views/layouts/_header.html.haml | 2 ++ 2 files changed, 8 insertions(+) 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