Module: Redmine::MenuManager::MenuController::ClassMethods
- Defined in:
- lib/redmine/menu_manager.rb
Constant Summary collapse
Hash.new {|hash, key| hash[key] = {:default => key, :actions => {}}}
Instance Method Summary collapse
-
#menu_item(id, options = {}) ⇒ Object
Set the menu item name for a controller or specific actions Examples: * menu_item :tickets # => sets the menu name to :tickets for the whole controller * menu_item :tickets, :only => :list # => sets the menu name to :tickets for the 'list' action only * menu_item :tickets, :only => [:list, :show] # => sets the menu name to :tickets for 2 actions only.
Instance Method Details
#menu_item(id, options = {}) ⇒ Object
Set the menu item name for a controller or specific actions Examples:
* menu_item :tickets # => sets the menu name to :tickets for the whole controller
* menu_item :tickets, :only => :list # => sets the menu name to :tickets for the 'list' action only
* menu_item :tickets, :only => [:list, :show] # => sets the menu name to :tickets for 2 actions only
The default menu item name for a controller is controller_name by default Eg. the default menu item name for ProjectsController is :projects
43 44 45 46 47 48 49 50 |
# File 'lib/redmine/menu_manager.rb', line 43 def (id, = {}) if actions = [:only] actions = [] << actions unless actions.is_a?(Array) actions.each {|a| [controller_name.to_sym][:actions][a.to_sym] = id} else [controller_name.to_sym][:default] = id end end |