2

I am working on Rails 3, Redmine, Redmin Plugin. Following are the codes in init.rb.

Redmine::Plugin.register :my_utilization do
  name 'Name'
  author 'Author'
  description 'Plugin Description'
  version '0.0.1'
  url ''
  author_url 'site.com'
  menu :top_menu, :utilization, { :controller => 'utilization', :action => 'index' }, :caption => 'Reports' }
  menu :application_menu, :utilization, { :controller => 'utilization',   :action => 'index' }, :caption => 'Utilization', :if => Proc.new { User.current.logged? }
  menu :application_menu, :project_reports, { :controller => 'project_reports', :action => 'index' }, :caption => 'Projects', :if => Proc.new { User.current.logged? }
  permission :my_utilization, { :utilization => [:index], :project_reports => [:index]}
end

Below is the picture displaying top menu and application menu items.

enter image description here

As shown in image, Home, My page, Projects, **Reports**, Help are the top menu items and **Utilization**, **Projects** are the application menu items. Present application menu Utilization and Projects are displaying when I clicked any of the top menu either Home, My page, Projects, Reports. But I want to display Utilization, Projects application menu only when Reports top menu is clicked.

Any solution would be appreciated. Thanks in advance.

siv rj
  • 1,451
  • 1
  • 14
  • 31
  • Can you try to clarify the problem a bit? Your paragraph starting with "Here **Reports**..." isn't very clear. It might also help to include an annotated screen shot using imgur or something (a pic can be worth 1K words). – steve klein May 19 '15 at 12:21
  • @steveklein: Thanks for quick response. I have uploaded pic, please have a look into this. – siv rj May 19 '15 at 12:58
  • Sorry text is way too small to read and I still don't understand the problem. Can you dump your screen shot in PPT and then annotate the issue on the picture? Then if you use imgur or a similar site, the resulting image is a lot easier to read. For instance, see a recent imgur I used to explain a problem on SO: http://imgur.com/IXFLQbV. – steve klein May 19 '15 at 13:11
  • I guess it is clear now, http://i.imgur.com/W4YnNlH.png – siv rj May 19 '15 at 13:22
  • According to the [Redmine Plugin Tutorial](http://www.redmine.org/projects/redmine/wiki/Plugin_Tutorial), you'll just want a single `menu` line like `menu :reports_menu, :utilization, { :controller => 'utilization', :action => 'index' }, :caption => 'Utilization'` in each submenu definition to tie back to `:reports`. I believe this should replace the three menu lines in your code above. Syntax may need tweaking but hope this helps. – steve klein May 19 '15 at 13:41
  • I guess Redmine supports only five menus: and i didnot see reports_menu. But also i will check it and i will update you. – siv rj May 19 '15 at 14:03
  • OK but your screenshot shows a Reports menu which you must have created in Redmine. Whatever you called it there (in the main menu) is the name you should use in the `:menu` line in both of the submenu definitions to connect it up. GL! – steve klein May 19 '15 at 14:22
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/78216/discussion-between-ror-and-steve-klein). – siv rj May 19 '15 at 14:34

0 Answers0