[Refs #31] define paypal_express_local_confirm preference

This commit is contained in:
John Dyer 2012-02-21 10:06:22 -05:00
parent f33dad629d
commit fa57f22a71
3 changed files with 12 additions and 2 deletions

View File

@ -192,10 +192,10 @@ module Spree
end
def fixed_opts
if Spree::Config[:paypal_express_local_confirm].nil?
if Spree::PaypalExpress::Config[:paypal_express_local_confirm].nil?
user_action = "continue"
else
user_action = Spree::Config[:paypal_express_local_confirm] == "t" ? "continue" : "commit"
user_action = Spree::PaypalExpress::Config[:paypal_express_local_confirm] == "t" ? "continue" : "commit"
end
{ :description => "Goods from #{Spree::Config[:site_name]}", # site details...

View File

@ -0,0 +1,5 @@
module Spree
class PaypalExpressConfiguration < Preferences::Configuration
preference :paypal_express_local_confirm, :boolean, :default => true
end
end

View File

@ -1,3 +1,4 @@
module Spree::PaypalExpress; end
module SpreePaypalExpress
class Engine < Rails::Engine
engine_name 'spree_paypal_express'
@ -9,6 +10,10 @@ module SpreePaypalExpress
g.test_framework :rspec
end
initializer "spree.paypal_express.preferences", :before => :load_config_initializers do |app|
Spree::PaypalExpress::Config = Spree::PaypalExpressConfiguration.new
end
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
Rails.env.production? ? require(c) : load(c)