spree_core 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/assets/images/credit_cards/icons/diners_club.png +0 -0
- data/app/assets/javascripts/admin/address_states.js +1 -1
- data/app/assets/javascripts/admin/admin.js.erb +18 -13
- data/app/assets/javascripts/admin/calculator.js +2 -2
- data/app/assets/javascripts/admin/checkouts/edit.js +3 -1
- data/app/assets/javascripts/admin/image_settings.js.erb +5 -5
- data/app/assets/javascripts/admin/orders/edit.js +1 -1
- data/app/assets/javascripts/admin/payments/new.js +9 -2
- data/app/assets/javascripts/admin/spree_core.js +13 -1
- data/app/assets/javascripts/admin/taxon_autocomplete.js.erb +2 -1
- data/app/assets/javascripts/admin/variant_autocomplete.js.erb +23 -19
- data/app/assets/javascripts/spree.js.coffee +37 -0
- data/app/assets/javascripts/store/checkout.js.coffee +8 -0
- data/app/assets/javascripts/store/product.js.coffee +1 -1
- data/app/assets/javascripts/store/spree_core.js +1 -0
- data/app/assets/stylesheets/admin/components/_sidebar.scss +7 -6
- data/app/assets/stylesheets/admin/components/_states.scss +16 -12
- data/app/assets/stylesheets/admin/globals/_variables.scss +102 -96
- data/app/assets/stylesheets/admin/shared/_forms.scss +2 -1
- data/app/assets/stylesheets/admin/shared/_icons.scss +2 -1
- data/app/assets/stylesheets/admin/shared/_layout.scss +4 -1
- data/app/assets/stylesheets/admin/shared/_tables.scss +8 -0
- data/app/assets/stylesheets/store/screen.css.scss +28 -16
- data/app/assets/stylesheets/store/variables.css.scss +4 -2
- data/app/controllers/spree/admin/adjustments_controller.rb +7 -3
- data/app/controllers/spree/admin/base_controller.rb +10 -5
- data/app/controllers/spree/admin/line_items_controller.rb +3 -2
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +3 -2
- data/app/controllers/spree/admin/orders_controller.rb +2 -2
- data/app/controllers/spree/admin/payments_controller.rb +1 -1
- data/app/controllers/spree/admin/resource_controller.rb +5 -5
- data/app/controllers/spree/admin/shipments_controller.rb +1 -1
- data/app/controllers/spree/admin/taxons_controller.rb +1 -1
- data/app/controllers/spree/admin/users_controller.rb +96 -0
- data/app/controllers/spree/checkout_controller.rb +18 -7
- data/app/controllers/spree/locale_controller.rb +1 -1
- data/app/controllers/spree/orders_controller.rb +20 -2
- data/app/controllers/spree/taxons_controller.rb +8 -2
- data/app/helpers/spree/admin/images_helper.rb +6 -2
- data/app/helpers/spree/admin/navigation_helper.rb +23 -3
- data/app/helpers/spree/base_helper.rb +9 -5
- data/app/helpers/spree/orders_helper.rb +13 -0
- data/app/helpers/spree/products_helper.rb +9 -4
- data/app/mailers/spree/base_mailer.rb +16 -0
- data/app/mailers/spree/order_mailer.rb +12 -11
- data/app/mailers/spree/shipment_mailer.rb +4 -7
- data/app/mailers/spree/test_mailer.rb +2 -3
- data/app/models/spree/adjustment.rb +1 -1
- data/app/models/spree/app_configuration.rb +9 -3
- data/app/models/spree/calculator/default_tax.rb +5 -1
- data/app/models/spree/calculator/per_item.rb +1 -1
- data/app/models/spree/classification.rb +7 -0
- data/app/models/spree/credit_card.rb +1 -5
- data/app/models/spree/gateway.rb +10 -2
- data/app/models/spree/gateway/bogus.rb +5 -5
- data/app/models/spree/inventory_unit.rb +4 -4
- data/app/models/spree/line_item.rb +1 -1
- data/app/models/spree/order.rb +15 -35
- data/app/models/spree/order/checkout.rb +52 -0
- data/app/models/spree/order_populator.rb +11 -3
- data/app/models/spree/order_updater.rb +3 -4
- data/app/models/spree/payment.rb +23 -1
- data/app/models/spree/payment/processing.rb +18 -5
- data/app/models/spree/payment_method.rb +4 -0
- data/app/models/spree/price.rb +2 -3
- data/app/models/spree/product.rb +12 -4
- data/app/models/spree/product/scopes.rb +29 -16
- data/app/models/spree/return_authorization.rb +1 -1
- data/app/models/spree/shipment.rb +1 -1
- data/app/models/spree/taxon.rb +21 -6
- data/app/models/spree/variant.rb +7 -2
- data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +2 -2
- data/app/views/spree/admin/countries/index.html.erb +1 -0
- data/app/views/spree/admin/general_settings/edit.html.erb +10 -2
- data/app/views/spree/admin/images/index.html.erb +7 -3
- data/app/views/spree/admin/mail_methods/index.html.erb +2 -2
- data/app/views/spree/admin/orders/_form.html.erb +3 -3
- data/app/views/spree/admin/orders/_line_item.html.erb +1 -1
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +4 -4
- data/app/views/spree/admin/orders/index.html.erb +60 -52
- data/app/views/spree/admin/payment_methods/_form.html.erb +2 -2
- data/app/views/spree/admin/payment_methods/index.html.erb +39 -35
- data/app/views/spree/admin/payments/_list.html.erb +1 -1
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +10 -10
- data/app/views/spree/admin/products/_form.html.erb +7 -12
- data/app/views/spree/admin/products/index.html.erb +13 -15
- data/app/views/spree/admin/products/new.html.erb +3 -1
- data/app/views/spree/admin/return_authorizations/_form.html.erb +7 -7
- data/app/views/spree/admin/return_authorizations/edit.html.erb +17 -11
- data/app/views/spree/admin/return_authorizations/index.html.erb +4 -4
- data/app/views/spree/admin/return_authorizations/new.html.erb +13 -6
- data/app/views/spree/admin/shared/_alert.html.erb +1 -1
- data/app/views/spree/admin/shared/_configuration_menu.html.erb +6 -2
- data/app/views/spree/admin/shared/_order_details.html.erb +6 -6
- data/app/views/spree/admin/shared/_order_tabs.html.erb +20 -37
- data/app/views/spree/admin/shared/_routes.html.erb +1 -1
- data/app/views/spree/admin/shared/_tabs.html.erb +1 -2
- data/app/views/spree/admin/shared/_update_order_state.js +1 -1
- data/app/views/spree/admin/shipments/_form.html.erb +24 -24
- data/app/views/spree/admin/shipments/edit.html.erb +13 -13
- data/app/views/spree/admin/shipments/index.html.erb +35 -31
- data/app/views/spree/admin/shipping_methods/index.html.erb +35 -32
- data/app/views/spree/admin/tax_rates/_form.html.erb +2 -1
- data/app/views/spree/admin/taxons/_form.html.erb +17 -0
- data/app/views/spree/admin/taxons/edit.html.erb +3 -1
- data/app/views/spree/admin/trackers/_form.html.erb +2 -2
- data/app/views/spree/admin/trackers/index.html.erb +2 -2
- data/app/views/spree/admin/users/_form.html.erb +37 -0
- data/app/views/spree/admin/users/edit.html.erb +28 -0
- data/app/views/spree/admin/users/index.html.erb +53 -0
- data/app/views/spree/admin/users/new.html.erb +23 -0
- data/app/views/spree/admin/users/show.html.erb +21 -0
- data/app/views/spree/admin/variants/edit.html.erb +6 -4
- data/app/views/spree/admin/variants/index.html.erb +1 -1
- data/app/views/spree/admin/zones/_form.html.erb +4 -4
- data/app/views/spree/admin/zones/index.html.erb +3 -1
- data/app/views/spree/checkout/_delivery.html.erb +1 -1
- data/app/views/spree/checkout/_payment.html.erb +1 -1
- data/app/views/spree/checkout/_summary.html.erb +2 -2
- data/app/views/spree/checkout/payment/_gateway.html.erb +6 -6
- data/app/views/spree/layouts/spree_application.html.erb +0 -1
- data/app/views/spree/order_mailer/cancel_email.text.erb +1 -1
- data/app/views/spree/order_mailer/confirm_email.text.erb +1 -1
- data/app/views/spree/orders/_adjustments.html.erb +1 -1
- data/app/views/spree/orders/_line_item.html.erb +2 -2
- data/app/views/spree/orders/edit.html.erb +1 -1
- data/app/views/spree/payments/_payment.html.erb +16 -0
- data/app/views/spree/products/_cart_form.html.erb +2 -2
- data/app/views/spree/products/_thumbnails.html.erb +3 -3
- data/app/views/spree/products/index.html.erb +1 -1
- data/app/views/spree/shared/_google_analytics.html.erb +1 -1
- data/app/views/spree/shared/_main_nav_bar.html.erb +1 -1
- data/app/views/spree/shared/_order_details.html.erb +10 -24
- data/app/views/spree/shared/_products.html.erb +1 -1
- data/app/views/spree/shared/_search.html.erb +1 -1
- data/app/views/spree/taxons/show.html.erb +1 -1
- data/config/initializers/check_for_orphaned_preferences.rb +5 -2
- data/config/locales/en.yml +24 -5
- data/config/routes.rb +4 -3
- data/db/default/spree/countries.rb +229 -0
- data/db/default/spree/roles.rb +2 -0
- data/db/default/spree/states.rb +57 -0
- data/db/default/spree/zones.rb +17 -0
- data/db/migrate/20130207155350_add_order_id_index_to_payments.rb +9 -0
- data/db/migrate/20130208032954_add_primary_to_spree_products_taxons.rb +5 -0
- data/db/migrate/20130222032153_add_order_id_index_to_shipments.rb +5 -0
- data/db/migrate/20130226032817_change_meta_description_on_spree_products_to_text.rb +5 -0
- data/db/migrate/20130226054936_add_variant_id_index_to_spree_prices.rb +5 -0
- data/db/migrate/20130319062004_change_orders_total_precision.rb +8 -0
- data/db/migrate/20130319063911_change_spree_payments_amount_precision.rb +7 -0
- data/db/migrate/20130319064308_change_spree_return_authorization_amount_precision.rb +7 -0
- data/db/migrate/20130319082943_change_adjustments_amount_precision.rb +7 -0
- data/db/migrate/20130328195253_add_seo_metas_to_taxons.rb +9 -0
- data/lib/generators/spree/dummy/templates/rails/database.yml +9 -6
- data/lib/spree/core/calculated_adjustments.rb +1 -1
- data/lib/spree/core/controller_helpers/auth.rb +3 -3
- data/lib/spree/core/controller_helpers/common.rb +1 -11
- data/lib/spree/core/controller_helpers/order.rb +15 -12
- data/lib/spree/core/engine.rb +5 -1
- data/lib/spree/core/mail_interceptor.rb +4 -6
- data/lib/spree/core/mail_settings.rb +52 -23
- data/lib/spree/core/permalinks.rb +1 -3
- data/lib/spree/core/testing_support/authorization_helpers.rb +1 -1
- data/lib/spree/core/testing_support/capybara_ext.rb +30 -0
- data/lib/spree/core/testing_support/common_rake.rb +8 -0
- data/lib/spree/core/testing_support/factories/payment_factory.rb +1 -1
- data/lib/spree/core/testing_support/factories/product_factory.rb +7 -2
- data/lib/spree/core/testing_support/factories/variant_factory.rb +4 -2
- data/lib/spree/core/validators/email.rb +1 -1
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/money.rb +14 -3
- data/lib/spree/product_filters.rb +1 -1
- data/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js +3 -2
- data/vendor/assets/javascripts/jsuri.js +2 -0
- data/vendor/assets/javascripts/modernizr.js +3 -3
- metadata +78 -69
- data/db/default/spree/countries.yml +0 -1589
- data/db/default/spree/roles.yml +0 -5
- data/db/default/spree/states.yml +0 -256
- data/db/default/spree/zone_members.yml +0 -169
- data/db/default/spree/zones.yml +0 -13
@@ -0,0 +1,57 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
country = Spree::Country.find_by_name('United States')
|
3
|
+
|
4
|
+
Spree::State.create!({"name"=>"Michigan", "abbr"=>"MI", :country=>country}, :without_protection => true)
|
5
|
+
Spree::State.create!({"name"=>"South Dakota", "abbr"=>"SD", :country=>country}, :without_protection => true)
|
6
|
+
Spree::State.create!({"name"=>"Washington", "abbr"=>"WA", :country=>country}, :without_protection => true)
|
7
|
+
Spree::State.create!({"name"=>"Wisconsin", "abbr"=>"WI", :country=>country}, :without_protection => true)
|
8
|
+
Spree::State.create!({"name"=>"Arizona", "abbr"=>"AZ", :country=>country}, :without_protection => true)
|
9
|
+
Spree::State.create!({"name"=>"Illinois", "abbr"=>"IL", :country=>country}, :without_protection => true)
|
10
|
+
Spree::State.create!({"name"=>"New Hampshire", "abbr"=>"NH", :country=>country}, :without_protection => true)
|
11
|
+
Spree::State.create!({"name"=>"North Carolina", "abbr"=>"NC", :country=>country}, :without_protection => true)
|
12
|
+
Spree::State.create!({"name"=>"Kansas", "abbr"=>"KS", :country=>country}, :without_protection => true)
|
13
|
+
Spree::State.create!({"name"=>"Missouri", "abbr"=>"MO", :country=>country}, :without_protection => true)
|
14
|
+
Spree::State.create!({"name"=>"Arkansas", "abbr"=>"AR", :country=>country}, :without_protection => true)
|
15
|
+
Spree::State.create!({"name"=>"Nevada", "abbr"=>"NV", :country=>country}, :without_protection => true)
|
16
|
+
Spree::State.create!({"name"=>"District of Columbia", "abbr"=>"DC", :country=>country}, :without_protection => true)
|
17
|
+
Spree::State.create!({"name"=>"Idaho", "abbr"=>"ID", :country=>country}, :without_protection => true)
|
18
|
+
Spree::State.create!({"name"=>"Nebraska", "abbr"=>"NE", :country=>country}, :without_protection => true)
|
19
|
+
Spree::State.create!({"name"=>"Pennsylvania", "abbr"=>"PA", :country=>country}, :without_protection => true)
|
20
|
+
Spree::State.create!({"name"=>"Hawaii", "abbr"=>"HI", :country=>country}, :without_protection => true)
|
21
|
+
Spree::State.create!({"name"=>"Utah", "abbr"=>"UT", :country=>country}, :without_protection => true)
|
22
|
+
Spree::State.create!({"name"=>"Vermont", "abbr"=>"VT", :country=>country}, :without_protection => true)
|
23
|
+
Spree::State.create!({"name"=>"Delaware", "abbr"=>"DE", :country=>country}, :without_protection => true)
|
24
|
+
Spree::State.create!({"name"=>"Rhode Island", "abbr"=>"RI", :country=>country}, :without_protection => true)
|
25
|
+
Spree::State.create!({"name"=>"Oklahoma", "abbr"=>"OK", :country=>country}, :without_protection => true)
|
26
|
+
Spree::State.create!({"name"=>"Louisiana", "abbr"=>"LA", :country=>country}, :without_protection => true)
|
27
|
+
Spree::State.create!({"name"=>"Montana", "abbr"=>"MT", :country=>country}, :without_protection => true)
|
28
|
+
Spree::State.create!({"name"=>"Tennessee", "abbr"=>"TN", :country=>country}, :without_protection => true)
|
29
|
+
Spree::State.create!({"name"=>"Maryland", "abbr"=>"MD", :country=>country}, :without_protection => true)
|
30
|
+
Spree::State.create!({"name"=>"Florida", "abbr"=>"FL", :country=>country}, :without_protection => true)
|
31
|
+
Spree::State.create!({"name"=>"Virginia", "abbr"=>"VA", :country=>country}, :without_protection => true)
|
32
|
+
Spree::State.create!({"name"=>"Minnesota", "abbr"=>"MN", :country=>country}, :without_protection => true)
|
33
|
+
Spree::State.create!({"name"=>"New Jersey", "abbr"=>"NJ", :country=>country}, :without_protection => true)
|
34
|
+
Spree::State.create!({"name"=>"Ohio", "abbr"=>"OH", :country=>country}, :without_protection => true)
|
35
|
+
Spree::State.create!({"name"=>"California", "abbr"=>"CA", :country=>country}, :without_protection => true)
|
36
|
+
Spree::State.create!({"name"=>"North Dakota", "abbr"=>"ND", :country=>country}, :without_protection => true)
|
37
|
+
Spree::State.create!({"name"=>"Maine", "abbr"=>"ME", :country=>country}, :without_protection => true)
|
38
|
+
Spree::State.create!({"name"=>"Indiana", "abbr"=>"IN", :country=>country}, :without_protection => true)
|
39
|
+
Spree::State.create!({"name"=>"Texas", "abbr"=>"TX", :country=>country}, :without_protection => true)
|
40
|
+
Spree::State.create!({"name"=>"Oregon", "abbr"=>"OR", :country=>country}, :without_protection => true)
|
41
|
+
Spree::State.create!({"name"=>"Wyoming", "abbr"=>"WY", :country=>country}, :without_protection => true)
|
42
|
+
Spree::State.create!({"name"=>"Alabama", "abbr"=>"AL", :country=>country}, :without_protection => true)
|
43
|
+
Spree::State.create!({"name"=>"Iowa", "abbr"=>"IA", :country=>country}, :without_protection => true)
|
44
|
+
Spree::State.create!({"name"=>"Mississippi", "abbr"=>"MS", :country=>country}, :without_protection => true)
|
45
|
+
Spree::State.create!({"name"=>"Kentucky", "abbr"=>"KY", :country=>country}, :without_protection => true)
|
46
|
+
Spree::State.create!({"name"=>"New Mexico", "abbr"=>"NM", :country=>country}, :without_protection => true)
|
47
|
+
Spree::State.create!({"name"=>"Georgia", "abbr"=>"GA", :country=>country}, :without_protection => true)
|
48
|
+
Spree::State.create!({"name"=>"Colorado", "abbr"=>"CO", :country=>country}, :without_protection => true)
|
49
|
+
Spree::State.create!({"name"=>"Massachusetts", "abbr"=>"MA", :country=>country}, :without_protection => true)
|
50
|
+
Spree::State.create!({"name"=>"Connecticut", "abbr"=>"CT", :country=>country}, :without_protection => true)
|
51
|
+
Spree::State.create!({"name"=>"New York", "abbr"=>"NY", :country=>country}, :without_protection => true)
|
52
|
+
Spree::State.create!({"name"=>"South Carolina", "abbr"=>"SC", :country=>country}, :without_protection => true)
|
53
|
+
Spree::State.create!({"name"=>"Alaska", "abbr"=>"AK", :country=>country}, :without_protection => true)
|
54
|
+
Spree::State.create!({"name"=>"West Virginia", "abbr"=>"WV", :country=>country}, :without_protection => true)
|
55
|
+
Spree::State.create!({"name"=>"U.S. Armed Forces – Americas", "abbr"=>"AA", :country=>country}, :without_protection => true)
|
56
|
+
Spree::State.create!({"name"=>"U.S. Armed Forces – Europe", "abbr"=>"AE", :country=>country}, :without_protection => true)
|
57
|
+
Spree::State.create!({"name"=>"U.S. Armed Forces – Pacific", "abbr"=>"AP", :country=>country}, :without_protection => true)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
eu_vat = Spree::Zone.create!(:name => "EU_VAT", :description => "Countries that make up the EU VAT zone.")
|
2
|
+
north_america = Spree::Zone.create!(:name => "North America", :description => "USA + Canada")
|
3
|
+
|
4
|
+
["Poland", "Finland", "Portugal", "Romania", "Germany", "France",
|
5
|
+
"Slovakia", "Hungary", "Slovenia", "Ireland", "Austria", "Spain",
|
6
|
+
"Italy", "Belgium", "Sweden", "Latvia", "Bulgaria", "United Kingdom",
|
7
|
+
"Lithuania", "Cyprus", "Luxembourg", "Malta", "Denmark", "Netherlands",
|
8
|
+
"Estonia"].
|
9
|
+
each do |name|
|
10
|
+
eu_vat.zone_members.create!(:zoneable => Spree::Country.find_by_name!(name))
|
11
|
+
end
|
12
|
+
|
13
|
+
["United States", "Canada"].each do |name|
|
14
|
+
north_america.zone_members.create!(:zoneable => Spree::Country.find_by_name!(name))
|
15
|
+
end
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class ChangeOrdersTotalPrecision < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
change_column :spree_orders, :item_total, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false
|
4
|
+
change_column :spree_orders, :total, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false
|
5
|
+
change_column :spree_orders, :adjustment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false
|
6
|
+
change_column :spree_orders, :payment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0
|
7
|
+
end
|
8
|
+
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
<% if agent_number = ENV['TC_AGENT_NUMBER']
|
2
|
+
database_prefix = agent_number + "_"
|
3
|
+
end %>
|
1
4
|
<% case ENV['DB']
|
2
5
|
when 'sqlite' %>
|
3
6
|
development:
|
@@ -12,33 +15,33 @@ production:
|
|
12
15
|
<% when 'mysql' %>
|
13
16
|
development:
|
14
17
|
adapter: mysql2
|
15
|
-
database: spree_development
|
18
|
+
database: <%= database_prefix %>spree_development
|
16
19
|
username:
|
17
20
|
encoding: utf8
|
18
21
|
test:
|
19
22
|
adapter: mysql2
|
20
|
-
database: spree_test
|
23
|
+
database: <%= database_prefix %>spree_test
|
21
24
|
username:
|
22
25
|
encoding: utf8
|
23
26
|
production:
|
24
27
|
adapter: mysql2
|
25
|
-
database: spree_production
|
28
|
+
database: <%= database_prefix %>spree_production
|
26
29
|
username:
|
27
30
|
encoding: utf8
|
28
31
|
<% when 'postgres' %>
|
29
32
|
development:
|
30
33
|
adapter: postgresql
|
31
|
-
database: spree_development
|
34
|
+
database: <%= database_prefix %>spree_development
|
32
35
|
username: postgres
|
33
36
|
min_messages: warning
|
34
37
|
test:
|
35
38
|
adapter: postgresql
|
36
|
-
database: spree_test
|
39
|
+
database: <%= database_prefix %>spree_test
|
37
40
|
username: postgres
|
38
41
|
min_messages: warning
|
39
42
|
production:
|
40
43
|
adapter: postgresql
|
41
|
-
database: spree_production
|
44
|
+
database: <%= database_prefix %>spree_production
|
42
45
|
username: postgres
|
43
46
|
min_messages: warning
|
44
47
|
<% else %>
|
@@ -3,7 +3,7 @@ module Spree
|
|
3
3
|
module CalculatedAdjustments
|
4
4
|
module ClassMethods
|
5
5
|
def calculated_adjustments
|
6
|
-
has_one :calculator, :as => :calculable, :dependent => :destroy
|
6
|
+
has_one :calculator, :class_name => "Spree::Calculator", :as => :calculable, :dependent => :destroy
|
7
7
|
accepts_nested_attributes_for :calculator
|
8
8
|
attr_accessible :calculator_type, :calculator_attributes
|
9
9
|
validates :calculator, :presence => true
|
@@ -45,7 +45,7 @@ module Spree
|
|
45
45
|
|
46
46
|
disallowed_urls.map!{ |url| url[/\/\w+$/] }
|
47
47
|
unless disallowed_urls.include?(request.fullpath)
|
48
|
-
session['
|
48
|
+
session['spree_user_return_to'] = request.fullpath.gsub('//', '/')
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -56,8 +56,8 @@ module Spree
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def redirect_back_or_default(default)
|
59
|
-
redirect_to(session["
|
60
|
-
session["
|
59
|
+
redirect_to(session["spree_user_return_to"] || default)
|
60
|
+
session["spree_user_return_to"] = nil
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -7,8 +7,6 @@ module Spree
|
|
7
7
|
helper_method :title
|
8
8
|
helper_method :title=
|
9
9
|
helper_method :accurate_title
|
10
|
-
helper_method :current_order
|
11
|
-
helper_method :current_currency
|
12
10
|
|
13
11
|
layout :get_layout
|
14
12
|
|
@@ -31,7 +29,7 @@ module Spree
|
|
31
29
|
end
|
32
30
|
|
33
31
|
# can be used in views as well as controllers.
|
34
|
-
# e.g. <% title = 'This is a custom title for this view' %>
|
32
|
+
# e.g. <% self.title = 'This is a custom title for this view' %>
|
35
33
|
attr_writer :title
|
36
34
|
|
37
35
|
def title
|
@@ -56,10 +54,6 @@ module Spree
|
|
56
54
|
Spree::Config[:default_seo_title]
|
57
55
|
end
|
58
56
|
|
59
|
-
def current_currency
|
60
|
-
Spree::Config[:currency]
|
61
|
-
end
|
62
|
-
|
63
57
|
def render_404(exception = nil)
|
64
58
|
respond_to do |type|
|
65
59
|
type.html { render :status => :not_found, :file => "#{::Rails.root}/public/404", :formats => [:html], :layout => nil}
|
@@ -67,10 +61,6 @@ module Spree
|
|
67
61
|
end
|
68
62
|
end
|
69
63
|
|
70
|
-
def ip_address
|
71
|
-
request.env['HTTP_X_REAL_IP'] || request.env['REMOTE_ADDR']
|
72
|
-
end
|
73
|
-
|
74
64
|
private
|
75
65
|
|
76
66
|
def set_user_language
|
@@ -5,20 +5,11 @@ module Spree
|
|
5
5
|
def self.included(base)
|
6
6
|
base.class_eval do
|
7
7
|
helper_method :current_order
|
8
|
+
helper_method :current_currency
|
8
9
|
before_filter :set_current_order
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
12
|
-
# This should be overridden by an auth-related extension which would then have the
|
13
|
-
# opportunity to associate the new order with the # current user before saving.
|
14
|
-
def before_save_new_order
|
15
|
-
end
|
16
|
-
|
17
|
-
# This should be overridden by an auth-related extension which would then have the
|
18
|
-
# opporutnity to store tokens, etc. in the session # after saving.
|
19
|
-
def after_save_new_order
|
20
|
-
end
|
21
|
-
|
22
13
|
# The current incomplete order from the session for use in cart and during checkout
|
23
14
|
def current_order(create_order_if_necessary = false)
|
24
15
|
return @current_order if @current_order
|
@@ -28,9 +19,13 @@ module Spree
|
|
28
19
|
end
|
29
20
|
if create_order_if_necessary and (@current_order.nil? or @current_order.completed?)
|
30
21
|
@current_order = Spree::Order.new(:currency => current_currency)
|
31
|
-
|
22
|
+
@current_order.user ||= try_spree_current_user
|
32
23
|
@current_order.save!
|
33
|
-
|
24
|
+
|
25
|
+
# make sure the user has permission to access the order (if they are a guest)
|
26
|
+
if try_spree_current_user.nil?
|
27
|
+
session[:access_token] = @current_order.token
|
28
|
+
end
|
34
29
|
end
|
35
30
|
if @current_order
|
36
31
|
@current_order.last_ip_address = ip_address
|
@@ -68,6 +63,14 @@ module Spree
|
|
68
63
|
end
|
69
64
|
end
|
70
65
|
end
|
66
|
+
|
67
|
+
def current_currency
|
68
|
+
Spree::Config[:currency]
|
69
|
+
end
|
70
|
+
|
71
|
+
def ip_address
|
72
|
+
request.env['HTTP_X_REAL_IP'] || request.env['REMOTE_ADDR']
|
73
|
+
end
|
71
74
|
end
|
72
75
|
end
|
73
76
|
end
|
data/lib/spree/core/engine.rb
CHANGED
@@ -73,7 +73,11 @@ module Spree
|
|
73
73
|
|
74
74
|
# filter sensitive information during logging
|
75
75
|
initializer "spree.params.filter" do |app|
|
76
|
-
app.config.filter_parameters += [
|
76
|
+
app.config.filter_parameters += [
|
77
|
+
:password,
|
78
|
+
:password_confirmation,
|
79
|
+
:number,
|
80
|
+
:verification_value]
|
77
81
|
end
|
78
82
|
|
79
83
|
# sets the manifests / assets to be precompiled, even when initialize_on_precompile is false
|
@@ -1,17 +1,16 @@
|
|
1
|
-
# Allows us to intercept any outbound mail message and make last minute changes
|
2
|
-
# sending to a test email account.)
|
1
|
+
# Allows us to intercept any outbound mail message and make last minute changes
|
2
|
+
# (such as specifying a "from" address or # sending to a test email account.)
|
3
3
|
#
|
4
4
|
# See http://railscasts.com/episodes/206-action-mailer-in-rails-3 for more details.
|
5
5
|
module Spree
|
6
6
|
module Core
|
7
7
|
class MailInterceptor
|
8
|
-
|
9
8
|
def self.delivering_email(message)
|
9
|
+
return unless Spree::Config.override_actionmailer_config
|
10
10
|
return unless mail_method = Spree::MailMethod.current
|
11
|
-
message.from ||= mail_method.preferred_mails_from
|
12
11
|
|
13
12
|
if mail_method.preferred_intercept_email.present?
|
14
|
-
message.subject = "
|
13
|
+
message.subject = "#{message.to} #{message.subject}"
|
15
14
|
message.to = mail_method.preferred_intercept_email
|
16
15
|
end
|
17
16
|
|
@@ -19,7 +18,6 @@ module Spree
|
|
19
18
|
message.bcc ||= mail_method.preferred_mail_bcc
|
20
19
|
end
|
21
20
|
end
|
22
|
-
|
23
21
|
end
|
24
22
|
end
|
25
23
|
end
|
@@ -1,37 +1,66 @@
|
|
1
1
|
module Spree
|
2
2
|
module Core
|
3
|
-
|
4
|
-
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# through an admin interface instead of requiring changes to the Rails envrionment file.
|
3
|
+
class MailSettings
|
4
|
+
# Override the Rails application mail settings based on preferences
|
5
|
+
# This makes it possible to configure the mail settings through an admin
|
6
|
+
# interface instead of requiring changes to the Rails envrionment file
|
8
7
|
def self.init
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
mail_server_settings = {
|
13
|
-
:address => mail_method.preferred_mail_host,
|
14
|
-
:domain => mail_method.preferred_mail_domain,
|
15
|
-
:port => mail_method.preferred_mail_port,
|
16
|
-
:authentication => mail_method.preferred_mail_auth_type
|
17
|
-
}
|
18
|
-
|
19
|
-
if mail_method.preferred_mail_auth_type != 'none'
|
20
|
-
mail_server_settings[:user_name] = mail_method.preferred_smtp_username
|
21
|
-
mail_server_settings[:password] = mail_method.preferred_smtp_password
|
22
|
-
end
|
23
|
-
|
24
|
-
tls = mail_method.preferred_secure_connection_type == 'TLS'
|
25
|
-
mail_server_settings[:enable_starttls_auto] = tls
|
8
|
+
instance = new
|
9
|
+
instance.override! if instance.override?
|
10
|
+
end
|
26
11
|
|
12
|
+
def override!
|
13
|
+
if mail_method.prefers_enable_mail_delivery?
|
14
|
+
ActionMailer::Base.default_url_options[:host] ||= Spree::Config[:site_url]
|
27
15
|
ActionMailer::Base.smtp_settings = mail_server_settings
|
28
16
|
ActionMailer::Base.perform_deliveries = true
|
29
17
|
else
|
30
|
-
#logger.warn "NOTICE: Mail not enabled"
|
31
18
|
ActionMailer::Base.perform_deliveries = false
|
32
19
|
end
|
33
20
|
end
|
34
21
|
|
22
|
+
def override?
|
23
|
+
override_actionmailer_config? && mail_method
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
def mail_server_settings
|
28
|
+
settings = if need_authentication?
|
29
|
+
basic_settings.merge(user_credentials)
|
30
|
+
else
|
31
|
+
basic_settings
|
32
|
+
end
|
33
|
+
|
34
|
+
settings.merge :enable_starttls_auto => secure_connection?
|
35
|
+
end
|
36
|
+
|
37
|
+
def user_credentials
|
38
|
+
{ :user_name => mail_method.preferred_smtp_username,
|
39
|
+
:password => mail_method.preferred_smtp_password }
|
40
|
+
end
|
41
|
+
|
42
|
+
def basic_settings
|
43
|
+
{ :address => mail_method.preferred_mail_host,
|
44
|
+
:domain => mail_method.preferred_mail_domain,
|
45
|
+
:port => mail_method.preferred_mail_port,
|
46
|
+
:authentication => mail_method.preferred_mail_auth_type }
|
47
|
+
end
|
48
|
+
|
49
|
+
def need_authentication?
|
50
|
+
mail_method.preferred_mail_auth_type != 'none'
|
51
|
+
end
|
52
|
+
|
53
|
+
def secure_connection?
|
54
|
+
mail_method.preferred_secure_connection_type == 'TLS'
|
55
|
+
end
|
56
|
+
|
57
|
+
def mail_method
|
58
|
+
Spree::MailMethod.current
|
59
|
+
end
|
60
|
+
|
61
|
+
def override_actionmailer_config?
|
62
|
+
Spree::Config.override_actionmailer_config
|
63
|
+
end
|
35
64
|
end
|
36
65
|
end
|
37
66
|
end
|