Question

While modifying redmine, I stuck on that part:
To hide the menu link "Activity" from a specific project.

My first try was that:
lib/redmine.rb - Line 239

menu.push :activity, { :controller => 'activities', :action => 'index' }, :if => Proc.new { Project.id==1 }

But I guess Project is undefined at the moment when this file is loaded. Even though there is this nice plugin api. Which got this method: delete_menu_item
But how would I tell my plugin something like that:

if(Project.id == 1) then delete_menu_item(:project_menu, :activity) end

I guess both methods would work. But I can't get them working.
Some (maybe) useful information:

  • Redmine version 2.3.2.stable
  • Ruby version 1.9.3-p194 (2012-04-20) [x86_64-linux]
  • Rails version 3.2.13
Was it helpful?

Solution

So I finally have my solution now:

menu.push :activity, { :controller => 'activities', :action => 'index' },
    :if => Proc.new {|project| project.id==1 }

Thanks to Arnaud Martel for helping me with that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top