Project

General

Profile

Feature #17763 » 0001-ability-to-render-multiple-partials-with-view-hook.patch

Ilya S, 2014-08-29 10:30

View differences:

lib/redmine/hook.rb
def self.render_on(hook, options={})
define_method hook do |context|
if context[:hook_caller].respond_to?(:render)
context[:hook_caller].send(:render, {:locals => context}.merge(options))
if options.has_key?(:partial) && options[:partial].kind_of?(Array)
options[:partial].map do |partial|
context[:hook_caller].send(:render, { locals: context }.merge(partial: partial))
end
else
context[:hook_caller].send(:render, { locals: context }.merge(options))
end
elsif context[:controller].is_a?(ActionController::Base)
context[:controller].send(:render_to_string, {:locals => context}.merge(options))
else
(1-1/2)