Fix bug in is_admin?

Fix bug in helpers for news and announcement
This commit is contained in:
Christophe Vilayphiou 2012-05-05 17:40:07 +08:00
parent 555aa088d9
commit b48099d752
3 changed files with 12 additions and 13 deletions

View File

@ -46,8 +46,7 @@ class ApplicationController < ActionController::Base
# Check if the current_user is admin
def is_admin?
auth_failed_in_backend unless current_user.admin?
current_user.admin? ? true : auth_failed_in_backend
end
def is_manager?

View File

@ -1,6 +1,6 @@
module Panel::News::BackEnd::NewsBulletinsHelper
def show_approval_link(news_bulletin)
def news_show_approval_link(news_bulletin)
by_news_bulletin = (!news_bulletin.is_expired? and !news_bulletin.is_checked?)
by_user = news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?
by_news_bulletin and by_user

View File

@ -54,7 +54,7 @@
<% end %>
<li class="dropdown"><%= link_to t('news_bulletin.delete'), panel_news_back_end_news_bulletin_path(news_bulletin), :confirm => t('news.sure?'), :method => :delete, :remote => true %></li>
<% end %>
<% if show_approval_link(news_bulletin) %>
<% if news_show_approval_link(news_bulletin) %>
<li><%= link_to t('news.news_bulletin.approval'), panel_news_back_end_news_bulletin_approval_preview_path(news_bulletin) %></li><%#= #TODO add ancher so user can quick access into that part %>
<% end %>