I'm looking for a part-time remote job.

Hire me

I'm the author of:

Mastering Redmine is a comprehensive guide with tips, tricks and best practices, and an easy-to-learn structure.

Check the book's project or

Buy the book

Social pages of the book:

By buying this book you also donate to Redmine (see this page).

Follow me:

Project settings hook plugin

This plugin is for developers only. It can also come along with some other plugins as a dependency. That is if you do not plan to develop for Redmine and do not install another plugin which states that this one is required... believe me you do not need it!

This plugin provides a hook which allows adding custom tabs to project settings tabs. The name of this hook is helper_projects_settings_tabs. The plugin was written to avoid patching Redmine. Actually it does the same what the following patch does:

--- app/helpers/projects_helper.rb.bck    2011-05-10 19:08:38.000000000 +0300
+++ app/helpers/projects_helper.rb    2011-05-10 19:08:59.000000000 +0300
@@ -32,6 +32,7 @@
             {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural},
             {:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities}
+    call_hook(:helper_projects_settings_tabs, { :tabs => tabs })
     tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}     

But unlike the patch these changes won't be rewritten on upgrade of Redmine.

How to use the hook?

The helper_projects_settings_tabs hook is a helper hook (named so because it is called from helper). It can be used in the same way as other controller/helper/model hooks:

class NewTabHook  < Redmine::Hook::ViewListener

    def helper_projects_settings_tabs(context = {})
        if User.current.allowed_to?(:new_tab_action, context[:project])
            context[:tabs].push({ :name    => 'new_tab',
                                  :action  => :new_tab_action,
                                  :partial => 'projects/settings/new_tab',
                                  :label   => :label_new_tab })


This code adds "New Tab" tab to the project settings menu/tabs. When users click on this tab Redmine will show form from the app/views/rojects/settings/_new_tab.rhtml file.

For more information on how to use hooks read: http://www.redmine.org/projects/redmine/wiki/Hooks

Installing pluging

To install this plugin do the following:
  • Copy project_settings_hook directory to #{RAILS_ROOT}/vendor/plugins.
  • Restart Redmine.

If you do this you do not need patching Redmine!

Patching Redmine

If you prefer patching Redmine do the following:
  • Download file project_settings_hook.patch attached to this Wiki page into your Redmine root directory.
  • Run: patch -p0 < project_settings_hook.patch
  • Restart Redmine.

project_settings_hook.patch View - Patch adding helper_projects_settings_tabs hook (622 Bytes) Andriy Lesyuk, 10 May 2011 16:40

Terms of use | Privacy policy