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).
{{inline_hook}}
macro, which is also provided by this plugin, check this page.Using the plugin¶
This plugin adds the menu item “Hooks” to the Administration section. After clicking on this menu item the user gets redirected to the form:
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.
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
.
- Copy
- For older Redmine:
- Copy
hooks_manager
directory to#{RAILS_ROOT}/vendor/plugins
. - Run:
rake db:migrate:plugins RAILS_ENV=production
- Copy
- Restart Redmine.
Extending the plugin¶
You can help making this plugin better in two ways:
- You can add hooks provided by other plugins – check this page on how to do this;
- 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”...