diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-01-20 13:07:19 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-01-20 13:07:19 +0000 |
commit | 16e9ffce0d0e803f02e3660450120602bca8aff5 (patch) | |
tree | 67e40838004344d3b5ee98ef18d170210bf4c380 /lib/redmine/menu_manager.rb | |
parent | 44ac1a0debc802b2ecbaa7cf7f763b373bf0fbb4 (diff) | |
download | redmine-16e9ffce0d0e803f02e3660450120602bca8aff5.tar.gz redmine-16e9ffce0d0e803f02e3660450120602bca8aff5.zip |
Added a 'New issue' link in the main menu (accesskey 7).
The drop-down lists to add an issue on the project overview and the issue list are removed.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1081 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/menu_manager.rb')
-rw-r--r-- | lib/redmine/menu_manager.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb index c801cb383..379028ebc 100644 --- a/lib/redmine/menu_manager.rb +++ b/lib/redmine/menu_manager.rb @@ -68,7 +68,7 @@ module Redmine unless item.condition && !item.condition.call(project) links << content_tag('li', link_to(l(item.caption), {item.param => project}.merge(item.url), - :class => (current_menu_item == item.name ? 'selected' : nil))) + (current_menu_item == item.name ? item.html_options.merge(:class => 'selected') : item.html_options))) end end if project && !project.new_record? links.empty? ? nil : content_tag('ul', links.join("\n")) @@ -94,6 +94,11 @@ module Redmine end class Mapper + # Adds an item at the end of the menu. Available options: + # * param: the parameter name that is used for the project id (default is :id) + # * condition: a proc that is called before rendering the item, the item is displayed only if it returns true + # * caption: the localized string key that is used as the item label + # * html_options: a hash of html options that are passed to link_to def push(name, url, options={}) @items ||= [] @items << MenuItem.new(name, url, options) @@ -105,7 +110,7 @@ module Redmine end class MenuItem - attr_reader :name, :url, :param, :condition, :caption + attr_reader :name, :url, :param, :condition, :caption, :html_options def initialize(name, url, options) @name = name @@ -113,6 +118,7 @@ module Redmine @condition = options[:if] @param = options[:param] || :id @caption = options[:caption] || name.to_s.humanize + @html_options = options[:html] || {} end end end |