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.
Files changed (182) hide show
  1. checksums.yaml +7 -0
  2. data/app/assets/images/credit_cards/icons/diners_club.png +0 -0
  3. data/app/assets/javascripts/admin/address_states.js +1 -1
  4. data/app/assets/javascripts/admin/admin.js.erb +18 -13
  5. data/app/assets/javascripts/admin/calculator.js +2 -2
  6. data/app/assets/javascripts/admin/checkouts/edit.js +3 -1
  7. data/app/assets/javascripts/admin/image_settings.js.erb +5 -5
  8. data/app/assets/javascripts/admin/orders/edit.js +1 -1
  9. data/app/assets/javascripts/admin/payments/new.js +9 -2
  10. data/app/assets/javascripts/admin/spree_core.js +13 -1
  11. data/app/assets/javascripts/admin/taxon_autocomplete.js.erb +2 -1
  12. data/app/assets/javascripts/admin/variant_autocomplete.js.erb +23 -19
  13. data/app/assets/javascripts/spree.js.coffee +37 -0
  14. data/app/assets/javascripts/store/checkout.js.coffee +8 -0
  15. data/app/assets/javascripts/store/product.js.coffee +1 -1
  16. data/app/assets/javascripts/store/spree_core.js +1 -0
  17. data/app/assets/stylesheets/admin/components/_sidebar.scss +7 -6
  18. data/app/assets/stylesheets/admin/components/_states.scss +16 -12
  19. data/app/assets/stylesheets/admin/globals/_variables.scss +102 -96
  20. data/app/assets/stylesheets/admin/shared/_forms.scss +2 -1
  21. data/app/assets/stylesheets/admin/shared/_icons.scss +2 -1
  22. data/app/assets/stylesheets/admin/shared/_layout.scss +4 -1
  23. data/app/assets/stylesheets/admin/shared/_tables.scss +8 -0
  24. data/app/assets/stylesheets/store/screen.css.scss +28 -16
  25. data/app/assets/stylesheets/store/variables.css.scss +4 -2
  26. data/app/controllers/spree/admin/adjustments_controller.rb +7 -3
  27. data/app/controllers/spree/admin/base_controller.rb +10 -5
  28. data/app/controllers/spree/admin/line_items_controller.rb +3 -2
  29. data/app/controllers/spree/admin/orders/customer_details_controller.rb +3 -2
  30. data/app/controllers/spree/admin/orders_controller.rb +2 -2
  31. data/app/controllers/spree/admin/payments_controller.rb +1 -1
  32. data/app/controllers/spree/admin/resource_controller.rb +5 -5
  33. data/app/controllers/spree/admin/shipments_controller.rb +1 -1
  34. data/app/controllers/spree/admin/taxons_controller.rb +1 -1
  35. data/app/controllers/spree/admin/users_controller.rb +96 -0
  36. data/app/controllers/spree/checkout_controller.rb +18 -7
  37. data/app/controllers/spree/locale_controller.rb +1 -1
  38. data/app/controllers/spree/orders_controller.rb +20 -2
  39. data/app/controllers/spree/taxons_controller.rb +8 -2
  40. data/app/helpers/spree/admin/images_helper.rb +6 -2
  41. data/app/helpers/spree/admin/navigation_helper.rb +23 -3
  42. data/app/helpers/spree/base_helper.rb +9 -5
  43. data/app/helpers/spree/orders_helper.rb +13 -0
  44. data/app/helpers/spree/products_helper.rb +9 -4
  45. data/app/mailers/spree/base_mailer.rb +16 -0
  46. data/app/mailers/spree/order_mailer.rb +12 -11
  47. data/app/mailers/spree/shipment_mailer.rb +4 -7
  48. data/app/mailers/spree/test_mailer.rb +2 -3
  49. data/app/models/spree/adjustment.rb +1 -1
  50. data/app/models/spree/app_configuration.rb +9 -3
  51. data/app/models/spree/calculator/default_tax.rb +5 -1
  52. data/app/models/spree/calculator/per_item.rb +1 -1
  53. data/app/models/spree/classification.rb +7 -0
  54. data/app/models/spree/credit_card.rb +1 -5
  55. data/app/models/spree/gateway.rb +10 -2
  56. data/app/models/spree/gateway/bogus.rb +5 -5
  57. data/app/models/spree/inventory_unit.rb +4 -4
  58. data/app/models/spree/line_item.rb +1 -1
  59. data/app/models/spree/order.rb +15 -35
  60. data/app/models/spree/order/checkout.rb +52 -0
  61. data/app/models/spree/order_populator.rb +11 -3
  62. data/app/models/spree/order_updater.rb +3 -4
  63. data/app/models/spree/payment.rb +23 -1
  64. data/app/models/spree/payment/processing.rb +18 -5
  65. data/app/models/spree/payment_method.rb +4 -0
  66. data/app/models/spree/price.rb +2 -3
  67. data/app/models/spree/product.rb +12 -4
  68. data/app/models/spree/product/scopes.rb +29 -16
  69. data/app/models/spree/return_authorization.rb +1 -1
  70. data/app/models/spree/shipment.rb +1 -1
  71. data/app/models/spree/taxon.rb +21 -6
  72. data/app/models/spree/variant.rb +7 -2
  73. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +2 -2
  74. data/app/views/spree/admin/countries/index.html.erb +1 -0
  75. data/app/views/spree/admin/general_settings/edit.html.erb +10 -2
  76. data/app/views/spree/admin/images/index.html.erb +7 -3
  77. data/app/views/spree/admin/mail_methods/index.html.erb +2 -2
  78. data/app/views/spree/admin/orders/_form.html.erb +3 -3
  79. data/app/views/spree/admin/orders/_line_item.html.erb +1 -1
  80. data/app/views/spree/admin/orders/customer_details/_form.html.erb +4 -4
  81. data/app/views/spree/admin/orders/index.html.erb +60 -52
  82. data/app/views/spree/admin/payment_methods/_form.html.erb +2 -2
  83. data/app/views/spree/admin/payment_methods/index.html.erb +39 -35
  84. data/app/views/spree/admin/payments/_list.html.erb +1 -1
  85. data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +10 -10
  86. data/app/views/spree/admin/products/_form.html.erb +7 -12
  87. data/app/views/spree/admin/products/index.html.erb +13 -15
  88. data/app/views/spree/admin/products/new.html.erb +3 -1
  89. data/app/views/spree/admin/return_authorizations/_form.html.erb +7 -7
  90. data/app/views/spree/admin/return_authorizations/edit.html.erb +17 -11
  91. data/app/views/spree/admin/return_authorizations/index.html.erb +4 -4
  92. data/app/views/spree/admin/return_authorizations/new.html.erb +13 -6
  93. data/app/views/spree/admin/shared/_alert.html.erb +1 -1
  94. data/app/views/spree/admin/shared/_configuration_menu.html.erb +6 -2
  95. data/app/views/spree/admin/shared/_order_details.html.erb +6 -6
  96. data/app/views/spree/admin/shared/_order_tabs.html.erb +20 -37
  97. data/app/views/spree/admin/shared/_routes.html.erb +1 -1
  98. data/app/views/spree/admin/shared/_tabs.html.erb +1 -2
  99. data/app/views/spree/admin/shared/_update_order_state.js +1 -1
  100. data/app/views/spree/admin/shipments/_form.html.erb +24 -24
  101. data/app/views/spree/admin/shipments/edit.html.erb +13 -13
  102. data/app/views/spree/admin/shipments/index.html.erb +35 -31
  103. data/app/views/spree/admin/shipping_methods/index.html.erb +35 -32
  104. data/app/views/spree/admin/tax_rates/_form.html.erb +2 -1
  105. data/app/views/spree/admin/taxons/_form.html.erb +17 -0
  106. data/app/views/spree/admin/taxons/edit.html.erb +3 -1
  107. data/app/views/spree/admin/trackers/_form.html.erb +2 -2
  108. data/app/views/spree/admin/trackers/index.html.erb +2 -2
  109. data/app/views/spree/admin/users/_form.html.erb +37 -0
  110. data/app/views/spree/admin/users/edit.html.erb +28 -0
  111. data/app/views/spree/admin/users/index.html.erb +53 -0
  112. data/app/views/spree/admin/users/new.html.erb +23 -0
  113. data/app/views/spree/admin/users/show.html.erb +21 -0
  114. data/app/views/spree/admin/variants/edit.html.erb +6 -4
  115. data/app/views/spree/admin/variants/index.html.erb +1 -1
  116. data/app/views/spree/admin/zones/_form.html.erb +4 -4
  117. data/app/views/spree/admin/zones/index.html.erb +3 -1
  118. data/app/views/spree/checkout/_delivery.html.erb +1 -1
  119. data/app/views/spree/checkout/_payment.html.erb +1 -1
  120. data/app/views/spree/checkout/_summary.html.erb +2 -2
  121. data/app/views/spree/checkout/payment/_gateway.html.erb +6 -6
  122. data/app/views/spree/layouts/spree_application.html.erb +0 -1
  123. data/app/views/spree/order_mailer/cancel_email.text.erb +1 -1
  124. data/app/views/spree/order_mailer/confirm_email.text.erb +1 -1
  125. data/app/views/spree/orders/_adjustments.html.erb +1 -1
  126. data/app/views/spree/orders/_line_item.html.erb +2 -2
  127. data/app/views/spree/orders/edit.html.erb +1 -1
  128. data/app/views/spree/payments/_payment.html.erb +16 -0
  129. data/app/views/spree/products/_cart_form.html.erb +2 -2
  130. data/app/views/spree/products/_thumbnails.html.erb +3 -3
  131. data/app/views/spree/products/index.html.erb +1 -1
  132. data/app/views/spree/shared/_google_analytics.html.erb +1 -1
  133. data/app/views/spree/shared/_main_nav_bar.html.erb +1 -1
  134. data/app/views/spree/shared/_order_details.html.erb +10 -24
  135. data/app/views/spree/shared/_products.html.erb +1 -1
  136. data/app/views/spree/shared/_search.html.erb +1 -1
  137. data/app/views/spree/taxons/show.html.erb +1 -1
  138. data/config/initializers/check_for_orphaned_preferences.rb +5 -2
  139. data/config/locales/en.yml +24 -5
  140. data/config/routes.rb +4 -3
  141. data/db/default/spree/countries.rb +229 -0
  142. data/db/default/spree/roles.rb +2 -0
  143. data/db/default/spree/states.rb +57 -0
  144. data/db/default/spree/zones.rb +17 -0
  145. data/db/migrate/20130207155350_add_order_id_index_to_payments.rb +9 -0
  146. data/db/migrate/20130208032954_add_primary_to_spree_products_taxons.rb +5 -0
  147. data/db/migrate/20130222032153_add_order_id_index_to_shipments.rb +5 -0
  148. data/db/migrate/20130226032817_change_meta_description_on_spree_products_to_text.rb +5 -0
  149. data/db/migrate/20130226054936_add_variant_id_index_to_spree_prices.rb +5 -0
  150. data/db/migrate/20130319062004_change_orders_total_precision.rb +8 -0
  151. data/db/migrate/20130319063911_change_spree_payments_amount_precision.rb +7 -0
  152. data/db/migrate/20130319064308_change_spree_return_authorization_amount_precision.rb +7 -0
  153. data/db/migrate/20130319082943_change_adjustments_amount_precision.rb +7 -0
  154. data/db/migrate/20130328195253_add_seo_metas_to_taxons.rb +9 -0
  155. data/lib/generators/spree/dummy/templates/rails/database.yml +9 -6
  156. data/lib/spree/core/calculated_adjustments.rb +1 -1
  157. data/lib/spree/core/controller_helpers/auth.rb +3 -3
  158. data/lib/spree/core/controller_helpers/common.rb +1 -11
  159. data/lib/spree/core/controller_helpers/order.rb +15 -12
  160. data/lib/spree/core/engine.rb +5 -1
  161. data/lib/spree/core/mail_interceptor.rb +4 -6
  162. data/lib/spree/core/mail_settings.rb +52 -23
  163. data/lib/spree/core/permalinks.rb +1 -3
  164. data/lib/spree/core/testing_support/authorization_helpers.rb +1 -1
  165. data/lib/spree/core/testing_support/capybara_ext.rb +30 -0
  166. data/lib/spree/core/testing_support/common_rake.rb +8 -0
  167. data/lib/spree/core/testing_support/factories/payment_factory.rb +1 -1
  168. data/lib/spree/core/testing_support/factories/product_factory.rb +7 -2
  169. data/lib/spree/core/testing_support/factories/variant_factory.rb +4 -2
  170. data/lib/spree/core/validators/email.rb +1 -1
  171. data/lib/spree/core/version.rb +1 -1
  172. data/lib/spree/money.rb +14 -3
  173. data/lib/spree/product_filters.rb +1 -1
  174. data/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js +3 -2
  175. data/vendor/assets/javascripts/jsuri.js +2 -0
  176. data/vendor/assets/javascripts/modernizr.js +3 -3
  177. metadata +78 -69
  178. data/db/default/spree/countries.yml +0 -1589
  179. data/db/default/spree/roles.yml +0 -5
  180. data/db/default/spree/states.yml +0 -256
  181. data/db/default/spree/zone_members.yml +0 -169
  182. data/db/default/spree/zones.yml +0 -13
@@ -0,0 +1,2 @@
1
+ Spree::Role.create!(:name => "admin")
2
+ Spree::Role.create!(:name => "user")
@@ -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,9 @@
1
+ class AddOrderIdIndexToPayments < ActiveRecord::Migration
2
+ def self.up
3
+ add_index :spree_payments, :order_id
4
+ end
5
+
6
+ def self.down
7
+ remove_index :spree_payments, :order_id
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddPrimaryToSpreeProductsTaxons < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_products_taxons, :id, :primary_key
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddOrderIdIndexToShipments < ActiveRecord::Migration
2
+ def change
3
+ add_index :spree_shipments, :order_id
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class ChangeMetaDescriptionOnSpreeProductsToText < ActiveRecord::Migration
2
+ def change
3
+ change_column :spree_products, :meta_description, :text, :limit => nil
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddVariantIdIndexToSpreePrices < ActiveRecord::Migration
2
+ def change
3
+ add_index :spree_prices, :variant_id
4
+ end
5
+ end
@@ -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
@@ -0,0 +1,7 @@
1
+ class ChangeSpreePaymentsAmountPrecision < ActiveRecord::Migration
2
+ def change
3
+
4
+ change_column :spree_payments, :amount, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false
5
+
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class ChangeSpreeReturnAuthorizationAmountPrecision < ActiveRecord::Migration
2
+ def change
3
+
4
+ change_column :spree_return_authorizations, :amount, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false
5
+
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class ChangeAdjustmentsAmountPrecision < ActiveRecord::Migration
2
+ def change
3
+
4
+ change_column :spree_adjustments, :amount, :decimal, :precision => 10, :scale => 2
5
+
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ class AddSeoMetasToTaxons < ActiveRecord::Migration
2
+ def change
3
+ change_table :spree_taxons do |t|
4
+ t.string :meta_title
5
+ t.string :meta_description
6
+ t.string :meta_keywords
7
+ end
8
+ end
9
+ 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['user_return_to'] = request.fullpath.gsub('//', '/')
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["user_return_to"] || default)
60
- session["user_return_to"] = nil
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
- before_save_new_order
22
+ @current_order.user ||= try_spree_current_user
32
23
  @current_order.save!
33
- after_save_new_order
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
@@ -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 += [:password, :password_confirmation, :number]
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 (such as specifying a "from" address or
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 = "[#{message.to}] #{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
- module MailSettings
4
-
5
- # Override the Rails application mail settings based on preference.
6
- # This makes it possible to configure the mail settings
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
- ActionMailer::Base.default_url_options[:host] = Spree::Config[:site_url]
10
- return unless mail_method = Spree::MailMethod.current
11
- if mail_method.prefers_enable_mail_delivery?
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