[#4519] Add all contracts as child menu items
This commit is contained in:
1 parent
306e4cfc80
commit
ce523df7eb
1 file changed
+21
-1
@@ -27,11 +27,31 @@ Redmine::Plugin.register :redmine_contracts do
|
|||||||
}, :public => true)
|
}, :public => true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
contract_list_submenu_items = Proc.new {|project|
|
||||||
|
if project && project.module_enabled?(:contracts)
|
||||||
|
|
||||||
|
project.contracts.inject([]) do |menu_items, contract|
|
||||||
|
|
||||||
|
menu_items << ::Redmine::MenuManager::MenuItem.new("contract-#{contract.id}",
|
||||||
|
{ :controller => 'contracts', :action => 'show', :id => contract.id, :project_id => project},
|
||||||
|
# TODO: http://www.redmine.org/issues/6426
|
||||||
|
# contract_path(project, contract),
|
||||||
|
{
|
||||||
|
:caption => contract.name, # h-escaped in Redmine
|
||||||
|
:param => :project_id,
|
||||||
|
:parent => :contracts
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
menu(:project_menu,
|
menu(:project_menu,
|
||||||
:contracts,
|
:contracts,
|
||||||
{:controller => 'contracts', :action => 'index'},
|
{:controller => 'contracts', :action => 'index'},
|
||||||
:caption => :text_contracts,
|
:caption => :text_contracts,
|
||||||
:param => :project_id)
|
:param => :project_id,
|
||||||
|
:children => contract_list_submenu_items)
|
||||||
|
|
||||||
menu(:project_menu,
|
menu(:project_menu,
|
||||||
:new_contract,
|
:new_contract,
|
||||||
|
|||||||
Reference in new issue
Block a user