Content
You are here:
[Plugin Development] How to use a helper from hook view template?
Added by Tomáš Jukin almost 11 years ago
Hi Guys,
I have an issue when porting ChilliProject TimeTracker plugin (https://github.com/magiclabs/ChiliProject-TimeTracker) to OP.
I have used the openproject-plugin generator and took inspiration from the openproject-backlogs plugin, but my hooks templates are not able to see helpers (I have the classic rails engine app structure).
How is possible to use helper from the hook template?
AFAIK in the case of hook none from controllers of the plugin are used, therefore I need to include the helper somehow differently. How?
Thanks,
Kind regards
Tomáš
Replies (3)
Hello Tomáš,
have you had a look into code>hooks.rb ? As far as I know you simply include the helpers you need (like
WorkPackageHelper
inhooks.rb
).Have you published your code already? If yes, we may have a look into it?
Kind regards,
Hagen
Hello Hagen,
I have not published it yet, because I would like to publish the working version of it.
Yes, I have looked at hooks.rb and done it in the same way, my hooks.rb in the TimeTracker plugin looks like this:
But it does not work :-(. Methods from my helpers are not defined in my hook templates…
An idea?
Hello Tomáš,
so, now I am little bit confused. :-)
The
ApplicationHelper
in line 4, is it your own or do you try to include core’sApplicationHelper
?. If you try the latter, you may remove the include because the code>ViewListener already includes it.At the moment I just think that the modules/namespaces are mixed up. But that is just a guess. ;-)
Kind regards,
Hagen