From 0b420d0308046bfac3f63f341f52a9e2806afa90 Mon Sep 17 00:00:00 2001 From: realtin Date: Fri, 21 Aug 2015 14:18:25 +0200 Subject: [PATCH] adapt templates to allow moderator to view reports (#5324) --- app/assets/templates/header_tpl.jst.hbs | 2 ++ app/presenters/user_presenter.rb | 5 +++++ app/views/report/index.html.haml | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/assets/templates/header_tpl.jst.hbs b/app/assets/templates/header_tpl.jst.hbs index 92ed903fc..199f6ff52 100644 --- a/app/assets/templates/header_tpl.jst.hbs +++ b/app/assets/templates/header_tpl.jst.hbs @@ -81,6 +81,8 @@
  • {{t "header.help"}}
  • {{#if current_user.admin}}
  • {{t "header.admin"}}
  • + {{else if current_user.moderator}} +
  • {{t "header.moderator"}}
  • {{/if}}
  • {{t "header.log_out"}}
  • diff --git a/app/presenters/user_presenter.rb b/app/presenters/user_presenter.rb index 1874570c4..f70bae290 100644 --- a/app/presenters/user_presenter.rb +++ b/app/presenters/user_presenter.rb @@ -11,6 +11,7 @@ class UserPresenter { :notifications_count => notifications_count, :unread_messages_count => unread_messages_count, :admin => admin, + :moderator => moderator, :aspects => aspects, :services => services, :following_count => self.user.contacts.receiving.count, @@ -46,4 +47,8 @@ class UserPresenter def admin user.admin? end + + def moderator + user.moderator? + end end diff --git a/app/views/report/index.html.haml b/app/views/report/index.html.haml index d9a3e4eae..5caf2f719 100644 --- a/app/views/report/index.html.haml +++ b/app/views/report/index.html.haml @@ -1,6 +1,7 @@ .container %div - = render :partial => 'admins/admin_bar' + - if current_user.admin? + = render :partial => 'admins/admin_bar' %div.row %div.span12