配置页面管理员栏目权限控制

This commit is contained in:
huang 2016-06-07 17:36:33 +08:00
parent a8b68d64ee
commit 9c01bb63e7
2 changed files with 10 additions and 6 deletions

View File

@ -213,11 +213,11 @@ module OrganizationsHelper
# 系统栏目只有管理员才能看到
def subfield_to_addmin?(org)
if User.current.admin?
# if User.current.admin?
@organization.org_subfields.order("priority")
else
@organization.org_subfields.select { |os| (os.field_type != "Comptec" && os.field_type != "Compstu" && os.field_type != "Comppro" && os.field_type != "Compcou" && os.field_type != "Compact") }.sort_by {|os| os.priority}
end
# else
# @organization.org_subfields.select { |os| (os.field_type != "Comptec" && os.field_type != "Compstu" && os.field_type != "Comppro" && os.field_type != "Compcou" && os.field_type != "Compact") }.sort_by {|os| os.priority}
# end
end
def get_subfield_acts field

View File

@ -89,7 +89,11 @@
<li class="orgListOperation">
<a href="javascript:void(0);" class="linkGrey fr ml5 mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"隐藏":"可见" %></a>
<span class="fr">|</span>
<% if (field.field_type == "Comptec" || field.field_type == "Compstu" || field.field_type == "Comppro" || field.field_type == "Compcou" || field.field_type == "Compact") && !User.current.admin? %>
<span class = "linkGrey fr ml5 mr5">默认</span>
<% else %>
<%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkGrey fr ml5 mr5" %>
<% end %>
<span class="fr">|</span>
<a href="javascript:void(0);" class="linkGrey fr ml5 mr5" onclick="edit('#subfield_show_<%= field.id %>','#subfield_edit_<%= field.id %>');">编辑</a>
<% unless field.field_type == "Resource" || field.field_type == "Comptec" || field.field_type == "Compstu" || field.field_type == "Comppro" || field.field_type == "Compcou" || field.field_type == "Compact" %>