Merge pull request #436 from warpc/433-active_menu_fix
[refs #433] Fix double menu selection in show build list action
This commit is contained in:
commit
5a225d3aad
|
@ -17,6 +17,10 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def top_menu_class(base)
|
||||
(controller_name.include?('build_lists') ? controller_name : params[:controller]).include?(base.to_s) ? 'active' : nil
|
||||
end
|
||||
|
||||
def title_object object
|
||||
name = object.class == Group ? object.uname : object.name
|
||||
object_name = t "activerecord.models.#{object.class.name.downcase}"
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
%ul
|
||||
- (collection = t which_menu).each do |base, title|
|
||||
- if can? :index, base.to_s.classify.constantize
|
||||
%li= link_to title, send(:"#{namespace}#{base}_path"), :class => params[:controller].include?(base.to_s) ? 'active' : ''
|
||||
%li= link_to title, send(:"#{namespace}#{base}_path"), :class => top_menu_class(base)
|
||||
- if current_user.try(:admin?) and which_menu == 'top_menu'
|
||||
%li= link_to t('admins_menu_header'), admin_users_path, :class => t('admins_menu').has_key?(controller_name.to_sym) ? 'active' : ''
|
||||
%li= link_to t('admins_menu_header'), admin_users_path, :class => top_menu_class('admin')
|
||||
|
|
Loading…
Reference in New Issue