modify :apllication_menu
Added by Marco Gutsche about 14 years ago
Hello,
I try to add an application menu in my plugin. I currently use this code:
menu( :application_menu, :plugin, {:controller => 'plugin', :action => 'index'}, :caption => :label_plugin, :if => Proc.new { User.current.allowed_to?(:plugin, nil, :global => true) })
This works, but I have the problem that the menu is shown on every page (without the project part), but I would like to show it only on pages in my plugin.
I've tried somethin like this:
menu( :application_menu, :plugin, {:controller => 'plugin', :action => 'index'}, :caption => :label_plugin, :if => Proc.new { params[:controller].is_a(Plugin) })
But this results in an error message: "undefined local variable or method `params' for #<Redmine::Plugin:0xb6fc8490>"
It is even possible to do this?
Thank a lot.
Replies (3)
RE: modify :apllication_menu - Added by Felix Schäfer about 14 years ago
I'm not sure I understand the request: You want to add an application_menu entry that is visible only when your plugin is shown?
RE: modify :apllication_menu - Added by Marco Gutsche about 14 years ago
That's correct.
I think we have also talked about this problem in IRC (if your nickname is meineerde).
The information was that the params isn't accessable in a Proc.
I actually try to modify/hook the lib/redmine/xxx.rb.
RE: modify :apllication_menu - Added by Felix Schäfer about 14 years ago
Marco Gutsche wrote:
I think we have also talked about this problem in IRC (if your nickname is meineerde).
Nope.
The information was that the params isn't accessable in a Proc.
Probably.
I'll let you get on with this with meineerde then :-)