From fbe1eb9e198fd927e0a65c0cbda2c6db55246c7c Mon Sep 17 00:00:00 2001 From: ilya_scherbinin Date: Thu, 28 Aug 2014 20:21:01 +0400 Subject: [PATCH] ability to render multiple partials with view hook --- lib/redmine/hook.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/redmine/hook.rb b/lib/redmine/hook.rb index 715cbaf..b724122 100644 --- a/lib/redmine/hook.rb +++ b/lib/redmine/hook.rb @@ -108,7 +108,13 @@ module Redmine 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.8.3.4