From e4fe2f9129c3f28ce31ffeca2f59256361ee913d Mon Sep 17 00:00:00 2001 From: Steve Root Date: Thu, 10 May 2012 12:37:32 +0100 Subject: [PATCH 1/3] fixes asset_url failing if logo is absolute url --- app/controllers/spree/checkout_controller_decorator.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb index d745e9a..347bfc5 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -200,7 +200,6 @@ module Spree { :description => "Goods from #{Spree::Config[:site_name]}", # site details... #:page_style => "foobar", # merchant account can set named config - :header_image => asset_url(Spree::Config[:logo]), :background_color => "ffffff", # must be hex only, six chars :header_background_color => "ffffff", :header_border_color => "ffffff", @@ -213,6 +212,13 @@ module Spree # they've not been tested and may trigger some paypal bugs, eg not showing order # see http://www.pdncommunity.com/t5/PayPal-Developer-Blog/Displaying-Order-Details-in-Express-Checkout/bc-p/92902#C851 } + #asset_url doesn't like Spree::Config[:logo] being an absolute url + #if statement didn't work within hash + if URI.parse(Spree::Config[:logo]).absolute? + {:header_image => Spree::Config[:logo]} + else + {:header_image => asset_url(Spree::Config[:logo])} + end end def user_locale From 4bc99e2fb74c384480cdc25529fb253a490a0074 Mon Sep 17 00:00:00 2001 From: Steve Root Date: Sat, 12 May 2012 11:00:57 +0100 Subject: [PATCH 2/3] Reworked based on Radar's directions --- .../spree/checkout_controller_decorator.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb index 347bfc5..6337938 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -195,14 +195,22 @@ module Spree else user_action = Spree::PaypalExpress::Config[:paypal_express_local_confirm] == "t" ? "continue" : "commit" end + + #asset_url doesn't like Spree::Config[:logo] being an absolute url + #if statement didn't work within hash + if URI.parse(Spree::Config[:logo]).absolute? + chosen_image = Spree::Config[:logo] + else + chosen_image = asset_url(Spree::Config[:logo]) + end { :description => "Goods from #{Spree::Config[:site_name]}", # site details... - #:page_style => "foobar", # merchant account can set named config :background_color => "ffffff", # must be hex only, six chars :header_background_color => "ffffff", :header_border_color => "ffffff", + :header_image => chosen_image :allow_note => true, :locale => user_locale, :req_confirm_shipping => false, # for security, might make an option later @@ -212,13 +220,6 @@ module Spree # they've not been tested and may trigger some paypal bugs, eg not showing order # see http://www.pdncommunity.com/t5/PayPal-Developer-Blog/Displaying-Order-Details-in-Express-Checkout/bc-p/92902#C851 } - #asset_url doesn't like Spree::Config[:logo] being an absolute url - #if statement didn't work within hash - if URI.parse(Spree::Config[:logo]).absolute? - {:header_image => Spree::Config[:logo]} - else - {:header_image => asset_url(Spree::Config[:logo])} - end end def user_locale From 1a59c10d192fa255e9c512a3f6f341bed2ea2980 Mon Sep 17 00:00:00 2001 From: Steve Root Date: Sat, 12 May 2012 11:08:09 +0100 Subject: [PATCH 3/3] missing comma --- app/controllers/spree/checkout_controller_decorator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb index 6337938..95940b3 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -210,7 +210,7 @@ module Spree :background_color => "ffffff", # must be hex only, six chars :header_background_color => "ffffff", :header_border_color => "ffffff", - :header_image => chosen_image + :header_image => chosen_image, :allow_note => true, :locale => user_locale, :req_confirm_shipping => false, # for security, might make an option later