Project

General

Profile

Actions

Defect #11682

closed

Links to URLs (as opposed to Controllers) in Project Menu do not work

Added by Derric Atzrott over 12 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Plugin API
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

In init.rb for a plugin you can define various additions to the menus in Redmine. When doing so for the project menu, but specifying a URL instead of a controller, the menu item will not appear and will not generate any error message.

Steps to Duplicate:
I will present four pieces of code, three that work, and one that does not to demonstrate the issue.

In your init.rb for you extension use the following code to add a menu item called Tab to the menu. This will work.

  menu(:project_menu,
       :tab,
       { :controller => 'tab', :action => 'show' },
       :caption => Proc.new { "Tab" })

Notice that if you change :project_menu to :top_menu, the code still works

  menu(:top_menu,
       :tab,
       { :controller => 'tab', :action => 'show' },
       :caption => Proc.new { "Tab" })

Changing the url parameter in this code to a URL likewise continues to work.

  menu(:top_menu,
       :tab,
       "http://www.example.com/",
       :caption => Proc.new { "Tab" })

Finally changing :top_menu back to :project_menu while leaving in the URL causes no link to appear.

  menu(:project_menu,
       :tab,
       "http://www.example.com/",
       :caption => Proc.new { "Tab" })

I think the problem is in menu_manager.rb in the function extract_node_details or in the function render_menu_node. I am able to track the menu item all the way to render_menu_node, but that is as far as I've managed.

I would have submitted a patch with this, but as my knowledge of Ruby is quite poor, I was unable to find where exactly the problem lays.

Actions

Also available in: Atom PDF