Fix sidebar and hide some links by roles

This commit is contained in:
Matthew K. Fu JuYuan 2012-05-16 12:10:16 +08:00
parent 3f744dab05
commit 88a26cc6a1
4 changed files with 21 additions and 11 deletions

View File

@ -1,4 +1,4 @@
class Admin::ModuleAppsNewInterfaceController < ApplicationController class Admin::ModuleAppsNewInterfaceController < OrbitBackendController
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin? before_filter :is_admin?
include AdminHelper include AdminHelper
@ -25,9 +25,9 @@ class Admin::ModuleAppsNewInterfaceController < ApplicationController
def update_setting def update_setting
module_app = update_setting_by_params module_app = update_setting_by_params
if module_app.save! if module_app.save!
flash[:notice] = "Update Done" flash[:notice] = t("admin.object_auth.update_done")
else else
flash[:notice] = "Update Failed" flash[:notice] = t("admin.object_auth.update_failed")
end end
end end

View File

@ -36,18 +36,20 @@
<%#= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %> <%#= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %>
<%# end -%> <%# end -%>
<%= content_tag :li, :class => active_for_controllers('page_contexts') do -%> <%= content_tag :li, :class => active_for_controllers('page_contexts') || active_for_app_auth('page_content') || active_for_ob_auths_object("PageContext") do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), panel_page_content_back_end_page_contexts_path %> <%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), panel_page_content_back_end_page_contexts_path %>
<%#= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('page_contexts')) do -%> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('page_contexts')) do -%>
<%#= content_tag :li, link_to(t('admin.all_articles'), panel_page_content_back_end_page_contexts_path), :class => active_for_action('page_context', 'index') %> <%#= content_tag :li, link_to(t('admin.all_articles'), panel_page_content_back_end_page_contexts_path), :class => active_for_action('page_context', 'index') %>
<%# end -%> <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "page_content"}))), :class => active_for_app_auth('page_content') if (is_admin? rescue nil) %>
<% end -%>
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers('designs') do -%> <%= content_tag :li, :class => active_for_controllers('designs') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %> <%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %>
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') || active_for_app_auth('ad_banners') do -%> <%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') ||active_for_ob_auths_object("AdBanner") ||active_for_app_auth('ad_banners') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images') ) do -%> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images') ) do -%>
@ -58,12 +60,12 @@
<% end -%> <% end -%>
<% end %> <% end %>
<%= content_tag :li, :class => active_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys') || active_for_app_auth('web_resource') do -%> <%= content_tag :li, :class => active_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys') || active_for_app_auth('web_resource') || active_for_ob_auths_object("WebLinkCategory") do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys')) do -%> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys')) do -%>
<%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_links', 'index') %> <%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_links', 'index') %>
<%= content_tag :li, link_to(t('announcement.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_links', 'new') %> <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_links', 'new') %>
<%= content_tag :li, link_to(t('announcement.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => (active_for_action('web_link_categorys', 'index') || active_for_ob_auths_object("WebLinkCategory")) %>
<%= content_tag :li, link_to(t('announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('/panel/web_resource/back_end/tags', 'index') %> <%= content_tag :li, link_to(t('announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('/panel/web_resource/back_end/tags', 'index') %>
<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "web_resource"}))), :class => active_for_app_auth('web_resource') if (is_admin? rescue nil) %> <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "web_resource"}))), :class => active_for_app_auth('web_resource') if (is_admin? rescue nil) %>
<% end -%> <% end -%>

View File

@ -1,4 +1,5 @@
class Panel::WebResource::BackEnd::WebLinkCategorysController < OrbitBackendController class Panel::WebResource::BackEnd::WebLinkCategorysController < OrbitBackendController
before_filter :for_app_manager,:except => [:index]
def index def index
@web_link_categorys = WebLinkCategory.all @web_link_categorys = WebLinkCategory.all

View File

@ -1,7 +1,7 @@
class Panel::WebResource::BackEnd::WebLinksController < OrbitBackendController class Panel::WebResource::BackEnd::WebLinksController < OrbitBackendController
before_filter :authenticate_user! before_filter :authenticate_user!
# before_filter :for_app_manager,:except => [:index,:show] # before_filter :for_app_manager,:except => [:index,:show]
# before_filter :for_app_sub_manager before_filter :for_app_sub_manager,:except => [:index]
def index def index
@ -134,6 +134,13 @@ class Panel::WebResource::BackEnd::WebLinksController < OrbitBackendController
def get_categorys(id = nil) def get_categorys(id = nil)
@web_link_categorys = (id ? WebLinkCategory.find(id).to_a : WebLinkCategory.excludes('disabled' => true)) @web_link_categorys = (id ? WebLinkCategory.find(id).to_a : WebLinkCategory.excludes('disabled' => true))
@web_link_categorys = []
if(is_manager? || is_admin?)
@web_link_categorys = (id ? WebLinkCategory.find(id).to_a : WebLinkCategory.excludes('disabled' => true))
elsif is_sub_manager?
@web_link_categorys = WebLinkCategory.authed_for_user(current_user,'edit')
end
end end
def get_tags def get_tags