mirror of
https://github.com/meineerde/redmine.git
synced 2026-03-14 21:18:14 +00:00
Automatically add current project to the context of hook calls in views.
git-svn-id: http://redmine.rubyforge.org/svn/branches/work@1718 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
f892fcf716
commit
efc5d18871
@ -104,9 +104,11 @@ module Redmine
|
||||
# in views like this:
|
||||
# <%= call_hook(:some_hook) %>
|
||||
# <%= call_hook(:another_hook, :foo => 'bar' %>
|
||||
#
|
||||
# Current project is automatically added to the call context.
|
||||
module Helper
|
||||
def call_hook(hook, context={})
|
||||
Redmine::Hook.call_hook(hook, context)
|
||||
Redmine::Hook.call_hook(hook, {:project => @project}.merge(context))
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -114,3 +116,9 @@ end
|
||||
|
||||
ApplicationHelper.send(:include, Redmine::Hook::Helper)
|
||||
|
||||
class Hello < Redmine::Hook::ViewListener
|
||||
def view_layouts_base_html_head(context)
|
||||
context[:project].to_s
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user