Added rights checking to top menu.

This commit is contained in:
George Vinogradov 2011-10-26 04:36:30 +04:00
parent 1523aea781
commit fa1f7afd34
1 changed files with 21 additions and 12 deletions

View File

@ -16,18 +16,27 @@
%li= link_to t('layout.logout'), destroy_user_session_path, :method => :delete, :class => "logout" %li= link_to t('layout.logout'), destroy_user_session_path, :method => :delete, :class => "logout"
#main-navigation #main-navigation
%ul.wat-cf %ul.wat-cf
-if current_user.can_perform?('users', 'index')
%li{:class => controller.controller_path == 'users' ? 'active' : '' } %li{:class => controller.controller_path == 'users' ? 'active' : '' }
%a{:href => users_path}= t("layout.menu.users") %a{:href => users_path}= t("layout.menu.users")
-if current_user.can_perform?('groups', 'index')
%li{:class => controller.controller_path == 'groups' ? 'active' : '' } %li{:class => controller.controller_path == 'groups' ? 'active' : '' }
%a{:href => groups_path}= t("layout.menu.groups") %a{:href => groups_path}= t("layout.menu.groups")
-if current_user.can_perform?('platforms', 'index')
%li{:class => controller.controller_path == 'platforms' ? 'active' : '' } %li{:class => controller.controller_path == 'platforms' ? 'active' : '' }
%a{:href => platforms_path}= t("layout.menu.platforms") %a{:href => platforms_path}= t("layout.menu.platforms")
-if current_user.can_perform?('downloads', 'index')
%li{:class => controller.controller_path == 'downloads' ? 'active' : '' } %li{:class => controller.controller_path == 'downloads' ? 'active' : '' }
%a{:href => downloads_path}= t("layout.menu.downloads") %a{:href => downloads_path}= t("layout.menu.downloads")
-if current_user.can_perform?('event_logs', 'index')
%li{:class => controller.controller_path == 'event_logs' ? 'active' : '' } %li{:class => controller.controller_path == 'event_logs' ? 'active' : '' }
%a{:href => event_logs_path}= t("layout.menu.event_logs") %a{:href => event_logs_path}= t("layout.menu.event_logs")
-if current_user.can_perform?('categories', 'index')
%li{:class => controller.controller_path == 'categories' ? 'active' : '' } %li{:class => controller.controller_path == 'categories' ? 'active' : '' }
%a{:href => categories_path}= t("layout.menu.categories") %a{:href => categories_path}= t("layout.menu.categories")
-if current_user.can_perform?('roles', 'index')
%li{:class => controller.controller_path == 'roles' ? 'active' : '' }
%a{:href => roles_path}= t("layout.menu.roles")
#wrapper.wat-cf #wrapper.wat-cf
= render :partial => "layouts/flashes" = render :partial => "layouts/flashes"
#main #main