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:

Hooks Manager plugin for Redmine (former Google Ads)

There are three ways to add custom HTML code (e.g. Google Ads) to your Redmine pages:

  • Modify Redmine’s ERuby view files:
    Disadvantages1: 1) Your changes will get overwritten on the next Redmine upgrade, 2) You should be familiar with ERuby and Redmine views directory structure.
  • Copy Redmine ERuby files into your plugin’s app/views directory and modify the copy:
    Disadvantages1: 1) Copied ERuby files should be updated after each Redmine upgrade (if the original core files were changed, of course), 2) If you do not do this Redmine can stop working, 3) You should write a plugin (or use some existing one).
  • Add custom HTML content using hooks.
    Advatages: 1) Hooks will remain unchanged in the next versions of Redmine.
    Disadvantages: 1) You need to know Ruby on Rails to use hooks...

Actually you needed to... And you still do need unless you use this plugin!

With the Hooks Manager plugin you just need to choose a hook and specify your HTML code. All this can be done in the Administration section. You don’t even need to care about hooks names – the form contains properties of “placeholders” (places on pages, where hooks add their content) and shows small page thumbnails having placeholders highlighted on them (see below).

For information how to use the {{inline_hook}} macro, which is also provided by this plugin, check this page.

Using the plugin

New Hooks item in Administration

This plugin adds the menu item “Hooks” to the Administration section. After clicking on this menu item the user gets redirected to the form:

Updated form in Hooks Manager

This form allows users to specify custom HTML code to be placed into the selected “placeholder”. The placeholder is actually a Redmine hook – i.e., a function triggered internally by this plugin, if HTML code is specified for the appropriate hook. The HTML code is returned to this hook and then gets placed on the Redmine page.

Hooks have been for developers only and this plugin makes them useful for end-users as well. To shield end-users from technical details the form contains the description of the placeholder (hook) and shows the little thumbnail demonstrating, where the content is to be added. For developers it also shows the hook name below the text area.

Hooks

For the detailed list of hooks, which are currently supported, check this page.

If you can’t find the placeholder, which fits your needs, consider using the closest available placeholder and moving your HTML content to the right place using JavaScript.

Installation and upgrade

To install or upgrade the plugin do:

  • For Redmine 2.x.x and above:
    • Copy hooks_manager directory to #{RAILS_ROOT}/plugins.
    • Run: rake redmine:plugins:migrate RAILS_ENV=production.
  • For older Redmine:
    • Copy hooks_manager directory to #{RAILS_ROOT}/vendor/plugins.
    • Run: rake db:migrate:plugins RAILS_ENV=production
  • Restart Redmine.

Extending the plugin

You can help making this plugin better in two ways:

  1. You can add hooks provided by other plugins – check this page on how to do this;
  2. You can create themes for this plugin – check this page on how to do this.

If you developed theme(s) please share them by posting an issue using the Theme tracker.

1 Advatages exist but are not listed because they are “out of scope”...

google-ads-form.png View - Form (67.5 KB) Andriy Lesyuk, 27 Jun 2011 14:25

google-ads-thumb-site.png View - Project overview thumbnail (1005 Bytes) Andriy Lesyuk, 27 Jun 2011 22:41

hooks-manager-form.png View - Updated form in Hooks Manager (74.1 KB) Andriy Lesyuk, 19 Aug 2013 23:43

hooks-manager-new-administration-item.png View - New Hooks item in Administration (24.1 KB) Andriy Lesyuk, 19 Aug 2013 23:49

new-vs-old-ui.png View - Old and new UI side-by-side (117 KB) Andriy Lesyuk, 25 Aug 2013 23:07

Terms of use | Privacy policy