Answer the question
In order to leave comments, you need to log in
Does anyone have a simple example of using hooks in Redmine?
I am exploring the possibilities of Redmine in terms of writing plugins. So far, I'm afraid of its redundancy and complexity in this part.
I would really appreciate a kick in the right direction.
Imagine a task - to add arbitrary JS code to the head section of all pages.
I found that there is a suitable hook for this https://github.com/redmine/redmine/blob/master/app...
So I can hook on to it and add my JS there.
I created a plugin according to the instructions, it messed up a bunch of files.
Can I somehow briefly pull this hook right in init.rb?
I would like some short example that adds some JS code through this hook.
This will help me move forward with my task :)
Answer the question
In order to leave comments, you need to log in
In init.rb, pulling it is not very nice.
I usually do this:
in init.rb I write
in the lib plugin folder, I create a hooks.rb file
module PluginName
class Hooks < Redmine::Hook::ViewListener
render_on(:view_layouts_base_html_head , partial: 'hooks/layouts_base_html_head ')
end
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question