ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

More dynamic Menus (Feature #731)


Added by Stephan Eckardt at 2011-11-25 01:50 pm. Updated at 2011-11-25 01:54 pm.


Status:Open Start date:2011-11-25
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Plugin API
Target version:-
Remote issue URL: Affected version:

Description

The current implementation of the MenuManager does only allow to add menu items statically during start up. Creating menus that have a dynamically defined list of items (e.g. a menu that contains items for each instance of a model) is not possible, because adding instances of the model does not result in a changed menu until the Redmine process is restarted and menus are regenerated.

Consider this example:

Redmine::MenuManager.map(:project_menu) do |menu|
  Project.all.each |project|
    menu.push project.title, link_to(project)
  end
end

I adapted the implementation of the MenuManager to defer the evaluation of the block given to the map method until the menu is rendered (i.e. in the items call).
My patch makes sure not to introduce any breaking changes.


Also available in: Atom PDF