From ea4d486e48cd83148f51f71cd6d8e39d71fa919a Mon Sep 17 00:00:00 2001 From: Victor campos Date: Sun, 22 Nov 2015 09:30:33 -0200 Subject: [PATCH 1/6] removing action_view_rendering and add render_super gem --- Gemfile | 1 + init.rb | 1 - .../patches/action_view_rendering.rb | 65 ------------------- 3 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 lib/workflow_enhancements/patches/action_view_rendering.rb diff --git a/Gemfile b/Gemfile index b9abe45..992f45e 100644 --- a/Gemfile +++ b/Gemfile @@ -6,3 +6,4 @@ group :test do gem "shoulda" end end +gem 'render_super' diff --git a/init.rb b/init.rb index 0f21582..359c1df 100644 --- a/init.rb +++ b/init.rb @@ -1,5 +1,4 @@ require_dependency 'workflow_enhancements/hooks' -require_dependency 'workflow_enhancements/patches/action_view_rendering' require_dependency 'workflow_enhancements/patches/tracker_patch' Redmine::Plugin.register :redmine_workflow_enhancements do diff --git a/lib/workflow_enhancements/patches/action_view_rendering.rb b/lib/workflow_enhancements/patches/action_view_rendering.rb deleted file mode 100644 index d093c33..0000000 --- a/lib/workflow_enhancements/patches/action_view_rendering.rb +++ /dev/null @@ -1,65 +0,0 @@ -# -# This is mostly copied from active_scaffold, -# https://github.com/activescaffold/active_scaffold/ -# -module ActionView - class LookupContext - module ViewPaths - def find_all_templates(name, partial = false, locals = {}) - prefixes.collect do |prefix| - view_paths.collect do |resolver| - temp_args = *args_for_lookup(name, [prefix], partial, locals, {}) - temp_args[1] = temp_args[1][0] - resolver.find_all(*temp_args) - end - end.flatten! - end - end - end -end - -module ActionView - class Base - # - # Adds rendering option. - # - # ==render :super - # - # This renders the "super" template, i.e. the one hidden by the plugin - # - def render_with_workflow_enhancements(*args, &block) - if args.first == :super - last_view = view_stack.last || {:view => instance_variable_get(:@virtual_path).split('/').last} - options = args[1] || {} - options[:locals] ||= {} - options[:locals].reverse_merge!(last_view[:locals] || {}) - if last_view[:templates].nil? - last_view[:templates] = lookup_context.find_all_templates(last_view[:view], last_view[:partial], options[:locals].keys) - last_view[:templates].shift - end - options[:template] = last_view[:templates].shift - view_stack << last_view - result = render_without_workflow_enhancements options - view_stack.pop - result - else - options = args.first - if options.is_a?(Hash) - current_view = {:view => options[:partial], :partial => true} if options[:partial] - current_view = {:view => options[:template], :partial => false} if current_view.nil? && options[:template] - current_view[:locals] = options[:locals] if !current_view.nil? && options[:locals] - view_stack << current_view if current_view.present? - end - result = render_without_workflow_enhancements(*args, &block) - view_stack.pop if current_view.present? - result - end - end - - alias_method_chain :render, :workflow_enhancements - - def view_stack - @_view_stack ||= [] - end - end -end From f48f45947b1691f9f9b8ea3494ca4c88fb37fd3b Mon Sep 17 00:00:00 2001 From: Lucas Arnaud Date: Fri, 27 Oct 2017 11:48:21 -0200 Subject: [PATCH 2/6] Showing workflow-help to the right of status --- app/views/workflow_enhancements/_issue_popup.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/workflow_enhancements/_issue_popup.html.erb b/app/views/workflow_enhancements/_issue_popup.html.erb index 3781e43..e9527c7 100644 --- a/app/views/workflow_enhancements/_issue_popup.html.erb +++ b/app/views/workflow_enhancements/_issue_popup.html.erb @@ -5,7 +5,7 @@