fixed header_image and locale using I18n.locale set from set_user_language

This commit is contained in:
Bounmy Stephane 2012-04-09 18:39:27 +02:00 committed by Ryan Bigg
parent 4511907f4f
commit 98f99ab3d2
2 changed files with 22 additions and 2 deletions

View File

@ -171,6 +171,10 @@ module Spree
private
def asset_url(_path)
URI::HTTP.build(:path => ActionController::Base.helpers.asset_path(_path), :host => Spree::Config[:site_url]).to_s
end
def record_log(payment, response)
payment.log_entries.create(:details => response.to_yaml)
end
@ -197,15 +201,16 @@ module Spree
user_action = Spree::PaypalExpress::Config[:paypal_express_local_confirm] == "t" ? "continue" : "commit"
end
{ :description => "Goods from #{Spree::Config[:site_name]}", # site details...
#:page_style => "foobar", # merchant account can set named config
:header_image => "https://#{Spree::Config[:site_url]}#{Spree::Config[:logo]}",
:header_image => asset_url(Spree::Config[:logo]),
:background_color => "ffffff", # must be hex only, six chars
:header_background_color => "ffffff",
:header_border_color => "ffffff",
:allow_note => true,
:locale => Spree::Config[:default_locale],
:locale => user_locale,
:req_confirm_shipping => false, # for security, might make an option later
:user_action => user_action
@ -215,6 +220,10 @@ module Spree
}
end
def user_locale
I18n.locale.to_s
end
# hook to override paypal site options
def paypal_site_opts
{:currency => payment_method.preferred_currency}

View File

@ -242,6 +242,17 @@ module Spree
end
context "#fixed_opts" do
it "returns hash containing basic settings" do
I18n.locale = :fr
opts = controller.send(:fixed_opts)
opts[:header_image].should == "http://demo.spreecommerce.com/assets/admin/bg/spree_50.png"
opts[:locale].should == "fr"
end
end
context "order_opts" do
it "should return hash containing basic order details" do