Deleting or hiding "New Issue" menu tab if no trackers in project
Added by Andy Sibley about 11 years ago
Hi, we have a number of projects and sub-projects and we have configured the parent project to have the Issue module enabled but with no Trackers selected in the parent project settings.
The intent is to have the Issue tab displayed allowing the manager to have a complete view of issues in all the sub-projects. But by having no Tracker selected the "New Issue" menu produces a 500 error.
Is there any way prevent displaying the "New Issue" tab if there are no Trackers selected?
We're currently using 2.0.3.stable but will migrate to later versions.
Thanks...Andy
Replies (4)
RE: Deleting or hiding "New Issue" menu tab if no trackers in project - Added by Lenny Basuino about 11 years ago
I'm doing the same thing.
You could modify lib/redmine.rb by adding the if clause below, or add this as a plugin (as I am doing). In the plugin's init.rb:
Redmine::MenuManager.map :project_menu do |menu| menu.delete :new_issue end menu :project_menu, :new_issue, { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new, :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }, :after => :issues, :if => Proc.new { |p| p.trackers.any? }
RE: Deleting or hiding "New Issue" menu tab if no trackers in project - Added by Andy Sibley about 11 years ago
Lenny,
Sorry to be dim but do I just add all of that text to init.rb in a suitable plugin directory or is there something else to do? I'm testing this on the latest bitnami version and after executing the rake command it complains about an $end missing.
Very much a newbie here (sorry)...Andy
RE: Deleting or hiding "New Issue" menu tab if no trackers in project - Added by Lenny Basuino about 11 years ago
The text above is not the complete init.rb but was added to an existing init.rb for a plugin I wrote.
I followed the plugin tutorial http://www.redmine.org/projects/redmine/wiki/Plugin_Tutorial to create a plugin and added the entire text to the int.rb.
(I retyped the text into the above post, i.e., did not copy and paste, so if I do have a syntax error, sorry and please let me know and I will correct in the above post.)
RE: Deleting or hiding "New Issue" menu tab if no trackers in project - Added by Lenny Basuino about 11 years ago
Andy,
Found 2 syntax issues that I've fixed above:
- the last "end" is already in the init.rb
- forgot the "?" at the end of "any"
This is working for Redmine 2.3.3. I don't know what version the latest bitnami is using.
Sorry about that. Hope this works for you.