- def view_issues_show_details_bottom(context)
- result = "<tr><td><b>Source File(s):</b></td><td>"
- names = context[:issue].source_files.map {|name| "<span>" + name + "</span>"}
- result << names.join(', ')
- result + "</td></tr>"
+
+ def self.render_on(hook, options={})
+ define_method hook do |context|
+ if !options.include?(:if) || evaluate_if_option(options[:if], context)
+ context[:controller].send(:render_to_string, {:locals => context}.merge(options))
+ end
+ end
+ end
+
+ private
+
+ def evaluate_if_option(if_option, context)
+ case if_option
+ when Symbol
+ send(if_option, context)
+ when Method, Proc
+ if_option.call(context)
+ end
+ end
+
+ def is_pticket?(context)
+ context[:issue].project_id == Setting.plugin_redmine_publications[:project].to_i