From e857a74bedef16dc3c1e123a5ff05184c74d20e1 Mon Sep 17 00:00:00 2001 From: Uwe Kubosch Date: Thu, 22 Nov 2012 12:59:26 +0100 Subject: [PATCH] * Bumped to version 0.3.5 * Enable detour_to with all url variants that url_for accept. --- .gitignore | 1 + lib/simple_workflow/helper.rb | 15 ++------------- lib/simple_workflow/version.rb | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index baedf5b..60e2de9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *~ .idea simple_workflow-*.gem +/log diff --git a/lib/simple_workflow/helper.rb b/lib/simple_workflow/helper.rb index 8888669..701e67f 100644 --- a/lib/simple_workflow/helper.rb +++ b/lib/simple_workflow/helper.rb @@ -11,19 +11,8 @@ def detour_to(title, options, html_options = nil) def with_detour(options, back_options = {}) detour_options = {:detour => (params.merge(back_options)).reject { |k, v| [:detour, :return_from_detour].include? k.to_sym }} - if options.is_a? String - return options + (options =~ /\?/ ? '&' : '?') + detour_options[:detour].map{|k,v| "detour[#{k}]=#{v}"}.join('&') - else - detour_options.update(options) - if options[:layout] == false - if detour_options[:action] !~ /_no_layout$/ - detour_options[:detour].update({:action => detour_options[:action] + '_no_layout'}) - end - elsif params[:action] =~ /_no_layout$/ - detour_options[:detour].update({:action => detour_options[:action][0..-11]}) - end - detour_options - end + url = url_for(options) if options.respond_to? :to_param + return url + (url =~ /\?/ ? '&' : '?') + detour_options[:detour].map{|k,v| "detour[#{k}]=#{v}"}.join('&') end def image_detour_to(image_source, title, url_options, image_options = nil, link_options = nil) diff --git a/lib/simple_workflow/version.rb b/lib/simple_workflow/version.rb index 46d4584..012b524 100644 --- a/lib/simple_workflow/version.rb +++ b/lib/simple_workflow/version.rb @@ -1,3 +1,3 @@ module SimpleWorkflow - VERSION = '0.3.4' + VERSION = '0.3.5' end