0001-ability-to-render-multiple-partials-with-view-hook.patch

Ilya S, 2014-08-29 10:30

Download (1.24 KB)

View differences:

lib/redmine/hook.rb
108 108
      def self.render_on(hook, options={})
109 109
        define_method hook do |context|
110 110
          if context[:hook_caller].respond_to?(:render)
111
            context[:hook_caller].send(:render, {:locals => context}.merge(options))
111
            if options.has_key?(:partial) && options[:partial].kind_of?(Array)
112
              options[:partial].map do |partial|
113
                context[:hook_caller].send(:render, { locals: context }.merge(partial: partial))
114
              end
115
            else
116
              context[:hook_caller].send(:render, { locals: context }.merge(options))
117
            end
112 118
          elsif context[:controller].is_a?(ActionController::Base)
113 119
            context[:controller].send(:render_to_string, {:locals => context}.merge(options))
114 120
          else
115
-