solidus_core 2.10.0.beta1 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/spree/base_helper.rb +4 -4
  3. data/app/helpers/spree/products_helper.rb +2 -1
  4. data/app/jobs/spree/promotion_code_batch_job.rb +2 -2
  5. data/app/models/concerns/spree/user_methods.rb +2 -2
  6. data/app/models/spree/address.rb +11 -15
  7. data/app/models/spree/adjustment.rb +11 -0
  8. data/app/models/spree/calculator/price_sack.rb +1 -1
  9. data/app/models/spree/calculator/shipping/flexi_rate.rb +2 -2
  10. data/app/models/spree/calculator/tiered_flat_rate.rb +5 -5
  11. data/app/models/spree/calculator/tiered_percent.rb +6 -6
  12. data/app/models/spree/carton.rb +1 -1
  13. data/app/models/spree/credit_card.rb +2 -2
  14. data/app/models/spree/inventory_unit.rb +1 -19
  15. data/app/models/spree/line_item.rb +1 -1
  16. data/app/models/spree/order.rb +3 -2
  17. data/app/models/spree/order/checkout.rb +1 -1
  18. data/app/models/spree/order/payments.rb +2 -2
  19. data/app/models/spree/order_capturing.rb +2 -2
  20. data/app/models/spree/order_taxation.rb +2 -2
  21. data/app/models/spree/payment.rb +4 -41
  22. data/app/models/spree/payment/processing.rb +2 -2
  23. data/app/models/spree/payment_method.rb +2 -2
  24. data/app/models/spree/product.rb +3 -3
  25. data/app/models/spree/product/scopes.rb +8 -7
  26. data/app/models/spree/promotion.rb +27 -12
  27. data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +1 -1
  28. data/app/models/spree/promotion/actions/free_shipping.rb +1 -1
  29. data/app/models/spree/promotion/rules/option_value.rb +2 -2
  30. data/app/models/spree/promotion/rules/product.rb +3 -3
  31. data/app/models/spree/promotion_action.rb +1 -1
  32. data/app/models/spree/promotion_chooser.rb +2 -2
  33. data/app/models/spree/promotion_code.rb +9 -8
  34. data/app/models/spree/promotion_code/batch_builder.rb +3 -3
  35. data/app/models/spree/promotion_rule.rb +1 -1
  36. data/app/models/spree/refund.rb +2 -2
  37. data/app/models/spree/reimbursement.rb +3 -11
  38. data/app/models/spree/reimbursement/reimbursement_type_engine.rb +1 -1
  39. data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +2 -2
  40. data/app/models/spree/return_authorization.rb +1 -7
  41. data/app/models/spree/return_item.rb +3 -42
  42. data/app/models/spree/return_item/eligibility_validator/default.rb +1 -1
  43. data/app/models/spree/shipment.rb +4 -38
  44. data/app/models/spree/shipping_calculator.rb +0 -4
  45. data/app/models/spree/shipping_method.rb +1 -1
  46. data/app/models/spree/state.rb +1 -1
  47. data/app/models/spree/stock/differentiator.rb +1 -1
  48. data/app/models/spree/stock/package.rb +1 -1
  49. data/app/models/spree/stock_item.rb +1 -1
  50. data/app/models/spree/stock_quantities.rb +13 -12
  51. data/app/models/spree/tax_calculator/default.rb +0 -4
  52. data/app/models/spree/tax_calculator/shipping_rate.rb +0 -3
  53. data/app/models/spree/tax_rate.rb +4 -0
  54. data/app/models/spree/taxon/paperclip_attachment.rb +13 -0
  55. data/app/models/spree/user_last_url_storer.rb +46 -0
  56. data/app/models/spree/user_last_url_storer/rules/authentication_rule.rb +36 -0
  57. data/app/models/spree/variant.rb +9 -9
  58. data/app/models/spree/wallet/add_payment_sources_to_wallet.rb +1 -1
  59. data/app/models/spree/zone.rb +1 -1
  60. data/config/initializers/money.rb +2 -0
  61. data/config/locales/en.yml +12 -0
  62. data/lib/generators/spree/install/install_generator.rb +3 -0
  63. data/lib/generators/spree/install/templates/config/initializers/spree.rb.tt +8 -0
  64. data/lib/spree/app_configuration.rb +18 -3
  65. data/lib/spree/core.rb +12 -0
  66. data/lib/spree/core/controller_helpers/auth.rb +1 -13
  67. data/lib/spree/core/engine.rb +2 -2
  68. data/lib/spree/core/environment_extension.rb +9 -0
  69. data/lib/spree/core/importer/order.rb +26 -26
  70. data/lib/spree/core/product_filters.rb +15 -15
  71. data/lib/spree/core/role_configuration.rb +2 -2
  72. data/lib/spree/core/search/variant.rb +1 -1
  73. data/lib/spree/core/state_machines.rb +78 -0
  74. data/lib/spree/core/state_machines/inventory_unit.rb +42 -0
  75. data/lib/spree/core/state_machines/payment.rb +61 -0
  76. data/lib/spree/core/state_machines/reimbursement.rb +33 -0
  77. data/lib/spree/core/state_machines/return_authorization.rb +32 -0
  78. data/lib/spree/core/state_machines/return_item/acceptance_status.rb +51 -0
  79. data/lib/spree/core/state_machines/return_item/reception_status.rb +42 -0
  80. data/lib/spree/core/state_machines/shipment.rb +58 -0
  81. data/lib/spree/core/stock_configuration.rb +1 -0
  82. data/lib/spree/core/validators/email.rb +1 -8
  83. data/lib/spree/core/version.rb +1 -1
  84. data/lib/spree/money.rb +2 -2
  85. data/lib/spree/permission_sets/user_management.rb +3 -0
  86. data/lib/spree/permitted_attributes.rb +3 -3
  87. data/lib/spree/preferences/static_model_preferences.rb +2 -2
  88. data/lib/spree/testing_support/dummy_app.rb +4 -1
  89. data/lib/spree/testing_support/factories/inventory_unit_factory.rb +8 -1
  90. data/lib/spree/testing_support/factories/promotion_factory.rb +7 -0
  91. data/lib/spree/testing_support/factories/stock_package_factory.rb +1 -1
  92. data/solidus_core.gemspec +2 -2
  93. data/spec/lib/spree/core/environment_extension_spec.rb +12 -1
  94. data/spec/lib/spree/core/stock_configuration_spec.rb +36 -0
  95. data/spec/lib/spree/core/validators/email_spec.rb +18 -18
  96. data/spec/models/spree/address_spec.rb +23 -0
  97. data/spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb +1 -1
  98. data/spec/models/spree/calculator/shipping/flat_rate_spec.rb +1 -1
  99. data/spec/models/spree/calculator/shipping/flexi_rate_spec.rb +2 -2
  100. data/spec/models/spree/calculator/shipping/per_item_spec.rb +1 -1
  101. data/spec/models/spree/calculator/shipping/price_sack_spec.rb +24 -15
  102. data/spec/models/spree/carton_spec.rb +8 -0
  103. data/spec/models/spree/classification_spec.rb +21 -9
  104. data/spec/models/spree/concerns/user_address_book_spec.rb +4 -4
  105. data/spec/models/spree/concerns/user_methods_spec.rb +2 -1
  106. data/spec/models/spree/order_merger_spec.rb +3 -3
  107. data/spec/models/spree/order_spec.rb +8 -15
  108. data/spec/models/spree/order_updater_spec.rb +4 -3
  109. data/spec/models/spree/payment_create_spec.rb +4 -14
  110. data/spec/models/spree/permission_sets/user_management_spec.rb +2 -0
  111. data/spec/models/spree/preference_spec.rb +4 -4
  112. data/spec/models/spree/preferences/preferable_spec.rb +3 -3
  113. data/spec/models/spree/preferences/statically_configurable_spec.rb +2 -2
  114. data/spec/models/spree/promotion_rule_spec.rb +6 -6
  115. data/spec/models/spree/promotion_spec.rb +73 -52
  116. data/spec/models/spree/reimbursement_type/original_payment_spec.rb +1 -1
  117. data/spec/models/spree/return_item/exchange_variant_eligibility/same_product_spec.rb +1 -1
  118. data/spec/models/spree/returns_calculator_spec.rb +2 -2
  119. data/spec/models/spree/shipping_calculator_spec.rb +1 -13
  120. data/spec/models/spree/shipping_method_spec.rb +32 -0
  121. data/spec/models/spree/stock/availability_validator_spec.rb +2 -2
  122. data/spec/models/spree/stock/differentiator_spec.rb +2 -2
  123. data/spec/models/spree/stock/estimator_spec.rb +3 -3
  124. data/spec/models/spree/stock/package_spec.rb +28 -28
  125. data/spec/models/spree/stock/simple_coordinator_spec.rb +11 -11
  126. data/spec/models/spree/stock/splitter/base_spec.rb +4 -4
  127. data/spec/models/spree/stock/splitter/shipping_category_spec.rb +7 -7
  128. data/spec/models/spree/stock_quantities_spec.rb +1 -1
  129. data/spec/models/spree/store_credit_spec.rb +1 -1
  130. data/spec/models/spree/tax_rate_spec.rb +1 -0
  131. data/spec/models/spree/taxons/paperclip_attachment_spec.rb +29 -0
  132. data/spec/models/spree/user_last_url_storer/rules/authentication_rule_spec.rb +31 -0
  133. data/spec/models/spree/user_last_url_storer_spec.rb +60 -0
  134. metadata +17 -12
  135. data/spec/migrate/20190106184413_remove_code_from_spree_promotions_spec.rb +0 -162
  136. data/spec/models/spree/order/updating_spec.rb +0 -18
@@ -2,10 +2,6 @@
2
2
 
3
3
  module Spree
4
4
  class ShippingCalculator < Calculator
5
- def compute_shipment(_shipment)
6
- raise NotImplementedError, "Please implement 'compute_shipment(shipment)' in your calculator: #{self.class.name}"
7
- end
8
-
9
5
  def compute_package(_package)
10
6
  raise NotImplementedError, "Please implement 'compute_package(package)' in your calculator: #{self.class.name}"
11
7
  end
@@ -41,7 +41,7 @@ module Spree
41
41
 
42
42
  scope :available_to_store, ->(store) do
43
43
  raise ArgumentError, "You must provide a store" if store.nil?
44
- store.shipping_methods.empty? ? all : where(id: store.shipping_method_ids)
44
+ store.shipping_methods.empty? ? all : where(id: store.shipping_methods.ids)
45
45
  end
46
46
 
47
47
  # @param shipping_category_ids [Array<Integer>] ids of desired shipping categories
@@ -24,7 +24,7 @@ module Spree
24
24
  # table of { country.id => [ state.id , state.name ] }, arrays sorted by name
25
25
  # blank is added elsewhere, if needed
26
26
  def self.states_group_by_country_id
27
- state_info = Hash.new { |h, k| h[k] = [] }
27
+ state_info = Hash.new { |hash, key| hash[key] = [] }
28
28
  order(:name).each { |state|
29
29
  state_info[state.country_id.to_s].push [state.id, state.name]
30
30
  }
@@ -14,7 +14,7 @@ module Spree
14
14
  end
15
15
 
16
16
  def missing?
17
- missing.values.any? { |v| v > 0 }
17
+ missing.values.any? { |value| value > 0 }
18
18
  end
19
19
 
20
20
  private
@@ -85,7 +85,7 @@ module Spree
85
85
  # @return [Fixnum] the number of inventory units in the package,
86
86
  # counting only those in the given state if it was specified
87
87
  def quantity(state = nil)
88
- matched_contents = state.nil? ? contents : contents.select { |c| c.state.to_s == state.to_s }
88
+ matched_contents = state.nil? ? contents : contents.select { |content| content.state.to_s == state.to_s }
89
89
  matched_contents.map(&:quantity).sum
90
90
  end
91
91
 
@@ -111,7 +111,7 @@ module Spree
111
111
  def should_touch_variant?
112
112
  # the variant_id changes from nil when a new stock location is added
113
113
  inventory_cache_threshold &&
114
- (saved_change_to_count_on_hand && saved_change_to_count_on_hand.any? { |c| c < inventory_cache_threshold }) ||
114
+ (saved_change_to_count_on_hand&.any? { |cache| cache < inventory_cache_threshold }) ||
115
115
  saved_change_to_variant_id?
116
116
  end
117
117
 
@@ -8,8 +8,8 @@ module Spree
8
8
 
9
9
  # @param quantities [Hash<Spree::Variant=>Numeric>]
10
10
  def initialize(quantities = {})
11
- raise ArgumentError unless quantities.keys.all?{ |v| v.is_a?(Spree::Variant) }
12
- raise ArgumentError unless quantities.values.all?{ |v| v.is_a?(Numeric) }
11
+ raise ArgumentError unless quantities.keys.all?{ |value| value.is_a?(Spree::Variant) }
12
+ raise ArgumentError unless quantities.values.all?{ |value| value.is_a?(Numeric) }
13
13
 
14
14
  @quantities = quantities
15
15
  end
@@ -33,16 +33,16 @@ module Spree
33
33
  # Adds two StockQuantities together
34
34
  # @return [Spree::StockQuantities]
35
35
  def +(other)
36
- combine_with(other) do |_variant, a, b|
37
- (a || 0) + (b || 0)
36
+ combine_with(other) do |_variant, first, second|
37
+ (first || 0) + (second || 0)
38
38
  end
39
39
  end
40
40
 
41
41
  # Subtracts another StockQuantities from this one
42
42
  # @return [Spree::StockQuantities]
43
43
  def -(other)
44
- combine_with(other) do |_variant, a, b|
45
- (a || 0) - (b || 0)
44
+ combine_with(other) do |_variant, first, second|
45
+ (first || 0) - (second || 0)
46
46
  end
47
47
  end
48
48
 
@@ -50,9 +50,10 @@ module Spree
50
50
  # stock which exists in both StockQuantities.
51
51
  # @return [Spree::StockQuantities]
52
52
  def &(other)
53
- combine_with(other) do |_variant, a, b|
54
- next unless a && b
55
- [a, b].min
53
+ combine_with(other) do |_variant, first, second|
54
+ next unless first && second
55
+
56
+ [first, second].min
56
57
  end
57
58
  end
58
59
 
@@ -72,9 +73,9 @@ module Spree
72
73
  def combine_with(other)
73
74
  self.class.new(
74
75
  (variants | other.variants).map do |variant|
75
- a = self[variant]
76
- b = other[variant]
77
- value = yield variant, a, b
76
+ self_v = self[variant]
77
+ other_v = other[variant]
78
+ value = yield variant, self_v, other_v
78
79
  [variant, value]
79
80
  end.to_h.compact
80
81
  )
@@ -8,10 +8,6 @@ module Spree
8
8
  # The class used for tax calculation is configurable, so that the
9
9
  # calculation can easily be pushed to third-party services. Users looking
10
10
  # to provide their own calculator should adhere to the API of this class.
11
- #
12
- # @api experimental
13
- # @note This API is currently in development and likely to change.
14
- # Specifically, the input format is not yet finalized.
15
11
  class Default
16
12
  include Spree::Tax::TaxHelpers
17
13
 
@@ -10,9 +10,6 @@ module Spree
10
10
  # class.
11
11
  #
12
12
  # @see Spree::Tax::ShippingRateTaxer
13
- # @api experimental
14
- # @note This API is currently in development and likely to change.
15
- # Specifically, the input format is not yet finalized.
16
13
  class ShippingRate
17
14
  include Spree::Tax::TaxHelpers
18
15
 
@@ -88,7 +88,11 @@ module Spree
88
88
  scope :included_in_price, -> { where(included_in_price: true) }
89
89
 
90
90
  # Creates necessary tax adjustments for the order.
91
+ #
92
+ # @deprecated Please use `Spree::Tax::OrderAdjuster#adjust!` instead
91
93
  def adjust(_order_tax_zone, item)
94
+ Spree::Deprecation.warn("`Spree::TaxRate#adjust` is deprecated. Please use `Spree::Tax::OrderAdjuster#adjust!` instead.", caller)
95
+
92
96
  amount = compute_amount(item)
93
97
 
94
98
  item.adjustments.create!(
@@ -18,4 +18,17 @@ module Spree::Taxon::PaperclipAttachment
18
18
  def icon_present?
19
19
  icon.present?
20
20
  end
21
+
22
+ def attachment_partial_name
23
+ 'paperclip'
24
+ end
25
+
26
+ def destroy_attachment(definition)
27
+ return false unless respond_to?(definition)
28
+
29
+ attached_file = send(definition)
30
+ return false unless attached_file.exists?
31
+
32
+ attached_file.destroy
33
+ end
21
34
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spree
4
+ # This service object is responsible for storing the current path into
5
+ # into `session[:spree_user_return_to]` for redirects after successful
6
+ # user/admin authentication.
7
+ class UserLastUrlStorer
8
+ # Lists all the rules that will be evaluated before storing the
9
+ # current path value into the session.
10
+ #
11
+ # @return [Spree::Core::ClassConstantizer::Set] a set of rules
12
+ # that, when matched, will prevent session[:spree_user_return_to]
13
+ # to be set
14
+ #
15
+ # @example This method can be used also to add more rules
16
+ # Spree::UserLastUrlStorer.rules << 'CustomRule'
17
+ #
18
+ # @example it can be used also for removing unwanted rules
19
+ # Spree::UserLastUrlStorer.rules.delete('CustomRule')
20
+ #
21
+ def self.rules
22
+ Spree::Config.user_last_url_storer_rules
23
+ end
24
+
25
+ # @param controller [ApplicationController] an instance of ApplicationController
26
+ # or its subclasses. The controller will be passed to each rule for matching.
27
+ def initialize(controller)
28
+ @controller = controller
29
+ end
30
+
31
+ # Stores into session[:spree_user_return_to] the request full path for
32
+ # future redirects (to be used after successful authentication). When
33
+ # there is a rule match then the request full path is not stored.
34
+ def store_location
35
+ return if self.class.rules.any? { |rule| rule.match? controller }
36
+
37
+ session[:spree_user_return_to] = request.fullpath.gsub('//', '/')
38
+ end
39
+
40
+ private
41
+
42
+ attr_reader :controller
43
+
44
+ delegate :session, :request, to: :controller
45
+ end
46
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spree
4
+ class UserLastUrlStorer
5
+ module Rules
6
+ # This is the basic rule that ships with Solidus that avoids storing in
7
+ # session the current path for login/loout/signup routes, avoiding possibly
8
+ # infinte redirects.
9
+ module AuthenticationRule
10
+ AUTHENTICATION_ROUTES = %w[spree_signup_path spree_login_path spree_logout_path]
11
+
12
+ extend self
13
+
14
+ def match?(controller)
15
+ full_path = controller.request.fullpath
16
+ disallowed_urls(controller).include?(full_path)
17
+ end
18
+
19
+ private
20
+
21
+ def disallowed_urls(controller)
22
+ @disallowed_urls ||= {}
23
+ @disallowed_urls[controller.controller_name] ||= begin
24
+ [].tap do |disallowed_urls|
25
+ AUTHENTICATION_ROUTES.each do |route|
26
+ if controller.respond_to?(route)
27
+ disallowed_urls << controller.send(route)
28
+ end
29
+ end
30
+ end.map! { |url| url[/\/\w+$/] }
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -250,12 +250,12 @@ module Spree
250
250
  # no option values on master
251
251
  return if is_master
252
252
 
253
- option_type = Spree::OptionType.where(name: opt_name).first_or_initialize do |o|
254
- o.presentation = opt_name
255
- o.save!
253
+ option_type = Spree::OptionType.where(name: opt_name).first_or_initialize do |option|
254
+ option.presentation = opt_name
255
+ option.save!
256
256
  end
257
257
 
258
- current_value = option_values.detect { |o| o.option_type.name == opt_name }
258
+ current_value = option_values.detect { |option| option.option_type.name == opt_name }
259
259
 
260
260
  if current_value
261
261
  return if current_value.name == opt_value
@@ -267,9 +267,9 @@ module Spree
267
267
  end
268
268
  end
269
269
 
270
- option_value = Spree::OptionValue.where(option_type_id: option_type.id, name: opt_value).first_or_initialize do |o|
271
- o.presentation = opt_value
272
- o.save!
270
+ option_value = Spree::OptionValue.where(option_type_id: option_type.id, name: opt_value).first_or_initialize do |option|
271
+ option.presentation = opt_value
272
+ option.save!
273
273
  end
274
274
 
275
275
  option_values << option_value
@@ -281,7 +281,7 @@ module Spree
281
281
  # @param opt_name [String] the name of the option whose value you want
282
282
  # @return [String] the option value
283
283
  def option_value(opt_name)
284
- option_values.detect { |o| o.option_type.name == opt_name }.try(:presentation)
284
+ option_values.detect { |option| option.option_type.name == opt_name }.try(:presentation)
285
285
  end
286
286
 
287
287
  # Returns an instance of the globally configured variant price selector class for this variant.
@@ -439,7 +439,7 @@ module Spree
439
439
  end
440
440
 
441
441
  def build_vat_prices
442
- VatPriceGenerator.new(self).run
442
+ Spree::Config.variant_vat_prices_generator_class.new(self).run
443
443
  end
444
444
 
445
445
  def set_position
@@ -19,7 +19,7 @@ class Spree::Wallet::AddPaymentSourcesToWallet
19
19
  sources = payments.map(&:source).
20
20
  uniq.
21
21
  compact.
22
- select { |p| p.try(:reusable?) }
22
+ select { |payment| payment.try(:reusable?) }
23
23
 
24
24
  # add valid sources to wallet and optionally set a default
25
25
  if sources.any?
@@ -40,7 +40,7 @@ module Spree
40
40
  end
41
41
 
42
42
  alias :members :zone_members
43
- accepts_nested_attributes_for :zone_members, allow_destroy: true, reject_if: proc { |a| a['zoneable_id'].blank? }
43
+ accepts_nested_attributes_for :zone_members, allow_destroy: true, reject_if: proc { |member| member['zoneable_id'].blank? }
44
44
 
45
45
  self.whitelisted_ransackable_attributes = %w[name description]
46
46
 
@@ -3,3 +3,5 @@
3
3
  require 'money'
4
4
 
5
5
  Money.locale_backend = :i18n
6
+ Money.rounding_mode = BigDecimal::ROUND_HALF_EVEN
7
+ Money.default_currency = Money::Currency.new(Spree::Config.currency)
@@ -1086,6 +1086,7 @@ en:
1086
1086
  cannot_create_payment_without_payment_methods_html: You cannot create a payment
1087
1087
  for an order without any payment methods defined. %{link}
1088
1088
  cannot_create_returns: Cannot create returns as this order has no shipped units.
1089
+ cannot_edit_orders: You may only edit your current shopping cart.
1089
1090
  cannot_perform_operation: Cannot perform requested operation
1090
1091
  cannot_rebuild_shipments_order_completed: Cannot rebuild shipments for a completed
1091
1092
  order.
@@ -1371,6 +1372,14 @@ en:
1371
1372
  hidden: hidden
1372
1373
  hide_out_of_stock: Hide out of stock
1373
1374
  hints:
1375
+ spree/calculator:
1376
+ tax_rates: This is used to calculate both sales tax (United States-style taxes)
1377
+ and value-added tax (VAT). Typically this calculator should be the only tax
1378
+ calculator required by your store.
1379
+ shipping_methods: This is used to calculate the shipping rates on a per order or
1380
+ per package rate.
1381
+ promotions: This is used to determine the promotional discount to be applied to an
1382
+ order, an item, or shipping charges.
1374
1383
  spree/price:
1375
1384
  country: 'This determines in what country the price is valid.<br/>Default:
1376
1385
  Any Country'
@@ -1519,6 +1528,7 @@ en:
1519
1528
  log_entries: Log Entries
1520
1529
  logged_in_as: Logged in as
1521
1530
  logged_in_succesfully: Logged in successfully
1531
+ logged_in_successfully: Logged in successfully
1522
1532
  logged_out: You have been logged out.
1523
1533
  login: Login
1524
1534
  login_as_existing: Login as Existing Customer
@@ -1548,6 +1558,7 @@ en:
1548
1558
  meta_title: Meta Title
1549
1559
  metadata: Metadata
1550
1560
  minimal_amount: Minimal Amount
1561
+ minimize_menu: Minimize Menu
1551
1562
  modify_stock_count: Modify (+/-)
1552
1563
  month: Month
1553
1564
  more: More
@@ -2103,6 +2114,7 @@ en:
2103
2114
  (i.e. if the tax rate is 5% then enter 0.05)
2104
2115
  tax_rates: Tax Rates
2105
2116
  taxon: Taxon
2117
+ taxon_attachment_removal_error: There was an error removing the attachment
2106
2118
  taxon_edit: Edit Taxon
2107
2119
  taxon_placeholder: Add a Taxon
2108
2120
  taxon_rule:
@@ -58,6 +58,9 @@ module Spree
58
58
 
59
59
  def setup_assets
60
60
  @lib_name = 'spree'
61
+
62
+ empty_directory 'app/assets/images'
63
+
61
64
  %w{javascripts stylesheets images}.each do |path|
62
65
  empty_directory "vendor/assets/#{path}/spree/frontend" if defined? Spree::Frontend || Rails.env.test?
63
66
  empty_directory "vendor/assets/#{path}/spree/backend" if defined? Spree::Backend || Rails.env.test?
@@ -93,3 +93,11 @@ Spree.user_class = <%= (options[:user_class].blank? ? "Spree::LegacyUser" : opti
93
93
  # just uncomment the following code and change it as you need.
94
94
  #
95
95
  # Spree::Model.whitelisted_ransackable_attributes << 'field'
96
+
97
+ # Rules for avoiding to store the current path into session for redirects
98
+ # When at least one rule is matched, the request path will not be stored
99
+ # in session.
100
+ # You can add your custom rules by uncommenting this line and changing
101
+ # the class name:
102
+ #
103
+ # Spree::UserLastUrlStorer.rules << 'Spree::UserLastUrlStorer::Rules::AuthenticationRule'
@@ -292,6 +292,14 @@ module Spree
292
292
 
293
293
  class_name_attribute :variant_search_class, default: 'Spree::Core::Search::Variant'
294
294
 
295
+ # Allows implementing custom vat prices generation
296
+ # @!attribute [rw] variant_vat_prices_generator_class
297
+ # @see Spree::Variant::VatPriceGenerator
298
+ # @return [Class] an object that conforms to the API of
299
+ # the standard variant vat prices generator class
300
+ # Spree::Variant::VatPriceGenerator.
301
+ class_name_attribute :variant_vat_prices_generator_class, default: 'Spree::Variant::VatPriceGenerator'
302
+
295
303
  # promotion_chooser_class allows extensions to provide their own PromotionChooser
296
304
  class_name_attribute :promotion_chooser_class, default: 'Spree::PromotionChooser'
297
305
 
@@ -306,7 +314,6 @@ module Spree
306
314
  # @!attribute [rw] shipping_rate_tax_calculator_class
307
315
  # @return [Class] a class with the same public interfaces as
308
316
  # Spree::TaxCalculator::ShippingRate
309
- # @api experimental
310
317
  class_name_attribute :shipping_rate_tax_calculator_class, default: 'Spree::TaxCalculator::ShippingRate'
311
318
 
312
319
  # Allows providing your own Mailer for order mailer.
@@ -384,7 +391,6 @@ module Spree
384
391
  # @!attribute [rw] tax_adjuster_class
385
392
  # @return [Class] a class with the same public interfaces as
386
393
  # Spree::Tax::OrderAdjuster
387
- # @api experimental
388
394
  class_name_attribute :tax_adjuster_class, default: 'Spree::Tax::OrderAdjuster'
389
395
 
390
396
  # Allows providing your own class for calculating taxes on an order.
@@ -392,7 +398,6 @@ module Spree
392
398
  # @!attribute [rw] tax_calculator_class
393
399
  # @return [Class] a class with the same public interfaces as
394
400
  # Spree::TaxCalculator::Default
395
- # @api experimental
396
401
  class_name_attribute :tax_calculator_class, default: 'Spree::TaxCalculator::Default'
397
402
 
398
403
  # Allows providing your own class for choosing which store to use.
@@ -454,6 +459,10 @@ module Spree
454
459
  @order_number_generator ||= Spree::Order::NumberGenerator.new
455
460
  end
456
461
 
462
+ def state_machines
463
+ @state_machines ||= Spree::Core::StateMachines.new
464
+ end
465
+
457
466
  def static_model_preferences
458
467
  @static_model_preferences ||= Spree::Preferences::StaticModelPreferences.new
459
468
  end
@@ -473,6 +482,12 @@ module Spree
473
482
  @events_configuration ||= Spree::Event::Configuration.new
474
483
  end
475
484
 
485
+ def user_last_url_storer_rules
486
+ @user_last_url_storer_rules ||= ::Spree::Core::ClassConstantizer::Set.new.tap do |set|
487
+ set << 'Spree::UserLastUrlStorer::Rules::AuthenticationRule'
488
+ end
489
+ end
490
+
476
491
  def environment
477
492
  @environment ||= Spree::Core::Environment.new(self).tap do |env|
478
493
  env.calculators.promotion_actions_create_adjustments = %w[