Adds #delete_menu_item to the plugin API (#2087).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1952 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-10-25 09:55:31 +00:00
parent 738fc579f0
commit 5f9f6ea2e1
2 changed files with 13 additions and 3 deletions

View File

@ -94,7 +94,11 @@ module Redmine
def map(menu_name)
@items ||= {}
mapper = Mapper.new(menu_name.to_sym, @items)
yield mapper
if block_given?
yield mapper
else
mapper
end
end
def items(menu_name)

View File

@ -70,8 +70,14 @@ module Redmine #:nodoc:
#
# +name+ parameter can be: :top_menu, :account_menu, :application_menu or :project_menu
#
def menu(name, item, url, options={})
Redmine::MenuManager.map(name) {|menu| menu.push item, url, options}
def menu(menu, item, url, options={})
Redmine::MenuManager.map(menu).push(item, url, options)
end
alias :add_menu_item :menu
# Removes +item+ from the given +menu+.
def delete_menu_item(menu, item)
Redmine::MenuManager.map(menu).delete(item)
end
# Defines a permission called +name+ for the given +actions+.