Search code examples
ruby-on-rails-3redmineredmine-plugins

Adding a tab to project/setting tab [Redmine]


I use this code to add a tab to project/setting tab in ProjectHelper module:

def project_settings_tabs
 tabs = [{...},
         .....,
         {name: => 'polls', :action => :poll, :partial => '../.. /path_to_partial', :label => :poll }
        ]
    tabs.select {|tab| User.current.allow_to?(tab[:action], @project)}
end

However, my Polls tab didn't display on setting tab as I expected. So my question is what is problems with my code and is there any other way to add a tab to setting tab?


Solution

  • I have found the solution: in init.rb file, add this line: permission :polls, { :polls => [:index, :vote] }, :public => true to set permission for poll tab and then the tab will display correctly.