Project

General

Profile

Hooks for issue's action menu

Added by Georges Mathieu over 7 years ago

I want to create a plugin that will format the information of a issue into a word document in the format defined by my supervisors. What I seem to be missing is a way to add a export button into the action menu of the issues. However, I don't seem to be able to find any hooks for that menu. I did find a work around with javascript but it isn't as clean as I would like my solution to be. Is adding hooks there feasible?

idea.PNG (30.8 KB) idea.PNG Idea of what i am trying to do.

Replies (2)

RE: Hooks for issue's action menu - Added by Mischa The Evil over 7 years ago

Georges Mathieu wrote:

[...] What I seem to be missing is a way to add a export button into the action menu of the issues. However, I don't seem to be able to find any hooks for that menu. I did find a work around with javascript but it isn't as clean as I would like my solution to be. Is adding hooks there feasible?

Well, this is something that has come up multiple times (in several forms) in the past. The conclusion, in short, is that this shouldn't be done using plugin hooks; read: these contextual menus won't get hooks added.
Instead, there are ideas of adding a non-hook based API for adding/removing items to/from contextual menus (much like the main menus). See #26385 and its related issues (and their sources on the forums) for the whole she-bang.

The JavaScript workaround(s) work indeed. I wouldn't call them nice though indeed. A better solution, I think, is to use Deface. It allows you to customize the ERB views without editing the underlying views. See e.g. Jean-Baptiste Barth's excellent blog post on the subject matter: "Redmine plugins: Hooking anywhere in views". Otherwise GIYF: http://lmgtfy.com/?iie=1&q=redmine+plugin+deface. :)

I hope this answers your questions a bit.

Note: I've taken up the advantage and did some clean-up on all these issues.

RE: Hooks for issue's action menu - Added by Georges Mathieu over 7 years ago

Thank you for the information I had been researching and looking for a solution for a week and deface never came up in my google searches. My boss was getting on my case about it. For some reason it ins't in the official Redmine documentation. I asked the forums before attempting to create a new issue to check if I had missed a discussion on this topic and let the core developers focus on their work. However, next time could you lose the lmgtfy link.

    (1-2/2)