Defect #5932
openhook for :view_repositories_show_contextual is incomplete
0%
Description
- path
- revision
As a "workaround", I patched the views (show.rhtml, entry.rhtml, changes.rhtml and annotate.rhtml) to replace:
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
with
<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project, :path => @path, :revision => @rev }) %>
but it would be better if included in the next release of Redmine...
Updated by Holger Just over 14 years ago
As you can see in one of my plugins (line 15), you can get these variables today without having to patch the hook calls.
Updated by Arnaud Martel over 14 years ago
- Status changed from New to Resolved
Many thanks!!! I didn't know how to do that and I really like your solution: I will undo my patches ASAP!!!
Updated by Holger Just over 14 years ago
- Status changed from Resolved to Closed
- Resolution set to Wont fix
Updated by Jean-Baptiste Barth over 14 years ago
- Category set to Plugin API
- Status changed from Closed to Reopened
- Affected version (unused) set to devel
- Resolution deleted (
Wont fix)
I disagree... Many things are accessible through context[:controller]
but it's not the right way to go for me. Hooks should provide instance variables directly so plugin developers don't have to do hacky things like instance_variable_get
. Else, with this argument, we could remove nearly any context variables passed to the hooks ;)
It makes me think of using .send()
to bypass object privacy: possible, but not so good in most cases.
Is there a particular reason why we should refuse adding those variables ? Maybe something I missed..