spree_core 4.2.5 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. checksums.yaml +4 -4
  2. data/app/finders/concerns/spree/product_filterable.rb +9 -0
  3. data/app/finders/spree/cms_pages/find.rb +41 -0
  4. data/app/finders/spree/menus/find.rb +11 -0
  5. data/app/finders/spree/option_values/find_available.rb +20 -0
  6. data/app/finders/spree/orders/find_complete.rb +14 -2
  7. data/app/finders/spree/orders/find_current.rb +1 -13
  8. data/app/finders/spree/product_properties/find_available.rb +20 -0
  9. data/app/finders/spree/products/find.rb +80 -21
  10. data/app/finders/spree/stores/find_current.rb +24 -0
  11. data/app/finders/spree/taxons/find.rb +22 -6
  12. data/app/helpers/spree/base_helper.rb +69 -7
  13. data/app/helpers/spree/locale_helper.rb +5 -1
  14. data/app/helpers/spree/products_helper.rb +7 -3
  15. data/app/models/concerns/spree/display_link.rb +42 -0
  16. data/app/models/concerns/spree/display_money.rb +6 -2
  17. data/app/models/concerns/spree/filter_param.rb +21 -0
  18. data/app/models/concerns/spree/image_methods.rb +24 -0
  19. data/app/models/concerns/spree/memoized_data.rb +24 -0
  20. data/app/models/concerns/spree/multi_store_resource.rb +24 -0
  21. data/app/models/concerns/spree/product_scopes.rb +71 -8
  22. data/app/models/concerns/spree/single_store_resource.rb +19 -0
  23. data/app/models/concerns/spree/user_address.rb +19 -0
  24. data/app/models/concerns/spree/user_methods.rb +14 -12
  25. data/app/models/concerns/spree/user_payment_source.rb +1 -1
  26. data/app/models/concerns/spree/user_reporting.rb +35 -10
  27. data/app/models/concerns/spree/user_roles.rb +25 -0
  28. data/app/models/spree/ability.rb +3 -1
  29. data/app/models/spree/address.rb +27 -6
  30. data/app/models/spree/app_configuration.rb +8 -0
  31. data/app/models/spree/app_dependencies.rb +20 -6
  32. data/app/models/spree/base.rb +18 -0
  33. data/app/models/spree/classification.rb +3 -0
  34. data/app/models/spree/cms/pages/feature_page.rb +7 -0
  35. data/app/models/spree/cms/pages/homepage.rb +20 -0
  36. data/app/models/spree/cms/pages/standard_page.rb +4 -0
  37. data/app/models/spree/cms/sections/featured_article.rb +22 -0
  38. data/app/models/spree/cms/sections/hero_image.rb +38 -0
  39. data/app/models/spree/cms/sections/image_gallery.rb +103 -0
  40. data/app/models/spree/cms/sections/product_carousel.rb +14 -0
  41. data/app/models/spree/cms/sections/rich_text_content.rb +13 -0
  42. data/app/models/spree/cms/sections/side_by_side_images.rb +74 -0
  43. data/app/models/spree/cms_page.rb +66 -0
  44. data/app/models/spree/cms_section.rb +69 -0
  45. data/app/models/spree/country.rb +14 -6
  46. data/app/models/spree/credit_card.rb +2 -8
  47. data/app/models/spree/customer_return.rb +8 -2
  48. data/app/models/spree/gateway/bogus.rb +6 -4
  49. data/app/models/spree/icon.rb +9 -0
  50. data/app/models/spree/image/configuration/active_storage.rb +2 -0
  51. data/app/models/spree/image.rb +5 -24
  52. data/app/models/spree/inventory_unit.rb +1 -1
  53. data/app/models/spree/line_item.rb +1 -1
  54. data/app/models/spree/menu.rb +63 -0
  55. data/app/models/spree/menu_item.rb +76 -0
  56. data/app/models/spree/option_type.rb +1 -1
  57. data/app/models/spree/option_value.rb +11 -0
  58. data/app/models/spree/option_value_variant.rb +1 -1
  59. data/app/models/spree/order/address_book.rb +3 -5
  60. data/app/models/spree/order/currency_updater.rb +1 -1
  61. data/app/models/spree/order/emails.rb +32 -0
  62. data/app/models/spree/order/payments.rb +1 -1
  63. data/app/models/spree/order/store_credit.rb +1 -1
  64. data/app/models/spree/order.rb +46 -45
  65. data/app/models/spree/payment.rb +7 -0
  66. data/app/models/spree/payment_method.rb +16 -0
  67. data/app/models/spree/preferences/preferable.rb +12 -0
  68. data/app/models/spree/preferences/preferable_class_methods.rb +10 -1
  69. data/app/models/spree/product.rb +37 -30
  70. data/app/models/spree/product_property.rb +19 -4
  71. data/app/models/spree/promotion/rules/country.rb +1 -1
  72. data/app/models/spree/promotion/rules/first_order.rb +4 -3
  73. data/app/models/spree/promotion/rules/taxon.rb +10 -7
  74. data/app/models/spree/promotion.rb +6 -15
  75. data/app/models/spree/promotion_handler/cart.rb +7 -2
  76. data/app/models/spree/promotion_handler/coupon.rb +5 -4
  77. data/app/models/spree/promotion_handler/free_shipping.rb +5 -6
  78. data/app/models/spree/promotion_handler/page.rb +3 -2
  79. data/app/models/spree/promotion_handler/promotion_duplicator.rb +1 -0
  80. data/app/models/spree/promotion_rule.rb +2 -0
  81. data/app/models/spree/property.rb +28 -1
  82. data/app/models/spree/reimbursement.rb +3 -1
  83. data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +2 -1
  84. data/app/models/spree/shipment_handler.rb +4 -2
  85. data/app/models/spree/stock/quantifier.rb +6 -6
  86. data/app/models/spree/stock_location.rb +9 -0
  87. data/app/models/spree/store.rb +90 -7
  88. data/app/models/spree/store_credit.rb +7 -3
  89. data/app/models/spree/store_credit_event.rb +2 -2
  90. data/app/models/spree/store_payment_method.rb +11 -0
  91. data/app/models/spree/store_product.rb +11 -0
  92. data/app/models/spree/store_promotion.rb +11 -0
  93. data/app/models/spree/taxon.rb +22 -1
  94. data/app/models/spree/taxon_image/configuration/active_storage.rb +2 -0
  95. data/app/models/spree/taxon_image.rb +1 -0
  96. data/app/models/spree/taxonomy.rb +3 -1
  97. data/app/models/spree/variant.rb +21 -6
  98. data/app/presenters/spree/filters/options_presenter.rb +47 -0
  99. data/app/presenters/spree/filters/price_presenter.rb +22 -0
  100. data/app/presenters/spree/filters/price_range_presenter.rb +29 -0
  101. data/app/presenters/spree/filters/properties_presenter.rb +23 -0
  102. data/app/presenters/spree/filters/property_presenter.rb +42 -0
  103. data/app/presenters/spree/filters/quantified_price_range_presenter.rb +44 -0
  104. data/app/services/spree/account/addresses/create.rb +1 -0
  105. data/app/services/spree/account/addresses/helper.rb +6 -0
  106. data/app/services/spree/account/addresses/update.rb +9 -3
  107. data/app/services/spree/account/create.rb +17 -0
  108. data/app/services/spree/account/update.rb +15 -0
  109. data/app/services/spree/build_localized_redirect_url.rb +1 -1
  110. data/app/services/spree/cart/associate.rb +16 -0
  111. data/app/services/spree/cart/change_currency.rb +27 -0
  112. data/app/services/spree/cart/create.rb +5 -3
  113. data/app/services/spree/cart/destroy.rb +40 -0
  114. data/app/services/spree/cart/empty.rb +36 -0
  115. data/app/services/spree/cart/estimate_shipping_rates.rb +3 -3
  116. data/app/services/spree/checkout/add_store_credit.rb +1 -1
  117. data/app/services/spree/classifications/reposition.rb +18 -0
  118. data/app/services/spree/credit_cards/destroy.rb +41 -0
  119. data/app/sorters/spree/base_sorter.rb +23 -11
  120. data/app/sorters/spree/products/sort.rb +23 -7
  121. data/app/validators/db_maximum_length_validator.rb +5 -0
  122. data/app/validators/email_validator.rb +3 -1
  123. data/config/initializers/active_storage.rb +2 -0
  124. data/config/locales/en.yml +177 -3
  125. data/config/routes.rb +0 -5
  126. data/db/migrate/20201023152810_add_filterable_to_spree_properties.rb +8 -0
  127. data/db/migrate/20210407200948_create_spree_menus.rb +16 -0
  128. data/db/migrate/20210408092939_create_spree_menu_items.rb +31 -0
  129. data/db/migrate/20210504163720_add_filter_param_to_spree_product_properties.rb +8 -0
  130. data/db/migrate/20210505114659_add_filter_param_to_spree_properties.rb +8 -0
  131. data/db/migrate/20210512191732_create_spree_cms_pages.rb +24 -0
  132. data/db/migrate/20210514204251_create_spree_cms_sections.rb +22 -0
  133. data/db/migrate/20210527094055_create_spree_products_stores.rb +36 -0
  134. data/db/migrate/20210608045519_ensure_store_default_country_is_set.rb +5 -0
  135. data/db/migrate/20210702112334_add_missing_timestamp_columns.rb +46 -0
  136. data/db/migrate/20210713131614_add_unique_index_on_property_id_and_product_id_to_product_properties.rb +29 -0
  137. data/db/migrate/20210715091956_add_store_id_to_spree_store_credits.rb +10 -0
  138. data/db/migrate/20210716093151_add_store_id_to_spree_taxonomies.rb +11 -0
  139. data/db/migrate/20210716104141_add_index_on_name_parent_id_and_taxonomy_id_on_spree_taxons.rb +31 -0
  140. data/db/migrate/20210721120857_add_index_on_permalink_parent_id_and_taxonomy_id_on_spree_taxons.rb +31 -0
  141. data/db/migrate/20210721125657_create_spree_promotions_stores.rb +29 -0
  142. data/db/migrate/20210722090705_add_store_id_to_spree_customer_returns.rb +11 -0
  143. data/db/migrate/20210726065456_change_integer_id_columns_into_bigint.rb +305 -0
  144. data/db/migrate/20210730154425_fix_promotion_code_and_path_unique_indexes.rb +9 -0
  145. data/lib/generators/spree/dummy/dummy_generator.rb +11 -6
  146. data/lib/generators/spree/dummy/templates/rails/test.rb +2 -0
  147. data/lib/generators/spree/dummy_model/templates/model.rb.tt +1 -1
  148. data/lib/generators/spree/install/install_generator.rb +12 -24
  149. data/lib/spree/core/components.rb +8 -0
  150. data/lib/spree/core/controller_helpers/auth.rb +7 -1
  151. data/lib/spree/core/controller_helpers/common.rb +1 -1
  152. data/lib/spree/core/controller_helpers/order.rb +4 -4
  153. data/lib/spree/core/controller_helpers/search.rb +1 -0
  154. data/lib/spree/core/controller_helpers/store.rb +24 -1
  155. data/lib/spree/core/engine.rb +6 -0
  156. data/lib/spree/core/importer/product.rb +3 -1
  157. data/lib/spree/core/product_duplicator.rb +1 -0
  158. data/lib/spree/core/search/base.rb +17 -22
  159. data/lib/spree/core/version.rb +1 -1
  160. data/lib/spree/core.rb +8 -4
  161. data/lib/spree/i18n.rb +1 -1
  162. data/lib/spree/money.rb +2 -1
  163. data/lib/spree/permitted_attributes.rb +21 -3
  164. data/lib/spree/testing_support/authorization_helpers.rb +6 -3
  165. data/lib/spree/testing_support/capybara_config.rb +3 -1
  166. data/lib/spree/testing_support/common_rake.rb +17 -4
  167. data/lib/spree/testing_support/extension_rake.rb +2 -2
  168. data/lib/spree/testing_support/factories/address_factory.rb +1 -1
  169. data/lib/spree/testing_support/factories/classification_factory.rb +8 -0
  170. data/lib/spree/testing_support/factories/cms_page_factory.rb +20 -0
  171. data/lib/spree/testing_support/factories/cms_section_factory.rb +31 -0
  172. data/lib/spree/testing_support/factories/customer_return_factory.rb +24 -17
  173. data/lib/spree/testing_support/factories/icon_factory.rb +7 -0
  174. data/lib/spree/testing_support/factories/line_item_factory.rb +6 -2
  175. data/lib/spree/testing_support/factories/menu_factory.rb +16 -0
  176. data/lib/spree/testing_support/factories/menu_item_factory.rb +10 -0
  177. data/lib/spree/testing_support/factories/options_factory.rb +5 -0
  178. data/lib/spree/testing_support/factories/order_factory.rb +11 -2
  179. data/lib/spree/testing_support/factories/payment_method_factory.rb +6 -2
  180. data/lib/spree/testing_support/factories/product_factory.rb +17 -1
  181. data/lib/spree/testing_support/factories/product_property_factory.rb +1 -1
  182. data/lib/spree/testing_support/factories/promotion_factory.rb +18 -9
  183. data/lib/spree/testing_support/factories/property_factory.rb +22 -0
  184. data/lib/spree/testing_support/factories/stock_location_factory.rb +5 -4
  185. data/lib/spree/testing_support/factories/store_credit_factory.rb +1 -0
  186. data/lib/spree/testing_support/factories/store_factory.rb +11 -0
  187. data/lib/spree/testing_support/factories/taxon_factory.rb +3 -1
  188. data/lib/spree/testing_support/factories/taxon_image_factory.rb +7 -0
  189. data/lib/spree/testing_support/factories/taxonomy_factory.rb +1 -0
  190. data/lib/spree/testing_support/factories/user_factory.rb +7 -2
  191. data/lib/spree/testing_support/factories/variant_factory.rb +2 -2
  192. data/lib/spree/testing_support/flatpickr_capybara.rb +58 -35
  193. data/lib/spree/testing_support/locale_helpers.rb +1 -1
  194. data/lib/spree/testing_support/order_walkthrough.rb +9 -9
  195. data/lib/spree/testing_support/rspec_retry_config.rb +5 -0
  196. data/lib/tasks/core.rake +1 -1
  197. data/spec/fixtures/favicon.ico +0 -0
  198. data/spec/fixtures/files/icon_256x256.gif +0 -0
  199. data/spec/fixtures/files/icon_256x256.png +0 -0
  200. data/spec/fixtures/files/icon_512x512.png +0 -0
  201. data/spec/fixtures/files/img_256x128.png +0 -0
  202. data/spree_core.gemspec +12 -11
  203. metadata +211 -159
  204. data/app/assets/images/logo/spree_50.png +0 -0
  205. data/app/assets/images/noimage/large.png +0 -0
  206. data/app/assets/images/noimage/mini.png +0 -0
  207. data/app/assets/images/noimage/product.png +0 -0
  208. data/app/assets/images/noimage/small.png +0 -0
  209. data/app/assets/javascripts/spree.js +0 -78
  210. data/app/controllers/spree/errors_controller.rb +0 -11
  211. data/app/helpers/spree/mail_helper.rb +0 -29
  212. data/app/mailers/spree/base_mailer.rb +0 -46
  213. data/app/mailers/spree/order_mailer.rb +0 -26
  214. data/app/mailers/spree/reimbursement_mailer.rb +0 -12
  215. data/app/mailers/spree/shipment_mailer.rb +0 -12
  216. data/app/mailers/spree/test_mailer.rb +0 -8
  217. data/app/models/spree/validations/db_maximum_length_validator.rb +0 -22
  218. data/app/views/layouts/spree/base_mailer.html.erb +0 -46
  219. data/app/views/spree/errors/forbidden.html.erb +0 -0
  220. data/app/views/spree/errors/unauthorized.html.erb +0 -0
  221. data/app/views/spree/order_mailer/cancel_email.html.erb +0 -24
  222. data/app/views/spree/order_mailer/cancel_email.text.erb +0 -38
  223. data/app/views/spree/order_mailer/confirm_email.html.erb +0 -23
  224. data/app/views/spree/order_mailer/confirm_email.text.erb +0 -39
  225. data/app/views/spree/order_mailer/store_owner_notification_email.html.erb +0 -23
  226. data/app/views/spree/order_mailer/store_owner_notification_email.text.erb +0 -38
  227. data/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb +0 -56
  228. data/app/views/spree/reimbursement_mailer/reimbursement_email.text.erb +0 -24
  229. data/app/views/spree/shared/_base_mailer_footer.html.erb +0 -12
  230. data/app/views/spree/shared/_base_mailer_header.html.erb +0 -13
  231. data/app/views/spree/shared/_base_mailer_stylesheets.html.erb +0 -456
  232. data/app/views/spree/shared/_error_messages.html.erb +0 -11
  233. data/app/views/spree/shared/_mailer_line_item.html.erb +0 -16
  234. data/app/views/spree/shared/_paths.html.erb +0 -8
  235. data/app/views/spree/shared/_purchased_items_table.html.erb +0 -69
  236. data/app/views/spree/shared/purchased_items_table/_adjustment.html.erb +0 -13
  237. data/app/views/spree/shared/purchased_items_table/_line_item.html.erb +0 -27
  238. data/app/views/spree/shared/purchased_items_table/_subtotal.html.erb +0 -13
  239. data/app/views/spree/shared/purchased_items_table/_total.html.erb +0 -13
  240. data/app/views/spree/shipment_mailer/shipped_email.html.erb +0 -36
  241. data/app/views/spree/shipment_mailer/shipped_email.text.erb +0 -17
  242. data/app/views/spree/test_mailer/test_email.html.erb +0 -40
  243. data/app/views/spree/test_mailer/test_email.text.erb +0 -4
  244. data/config/initializers/assets.rb +0 -2
  245. data/config/initializers/premailer_assets.rb +0 -1
  246. data/config/initializers/premailer_rails.rb +0 -3
  247. data/db/migrate/20140805171219_make_existing_credit_cards_default.rb +0 -10
  248. data/lib/generators/spree/dummy/templates/initializers/bullet.rb +0 -5
  249. data/lib/generators/spree/install/templates/vendor/assets/javascripts/spree/backend/all.js +0 -15
  250. data/lib/generators/spree/install/templates/vendor/assets/javascripts/spree/frontend/all.js +0 -16
  251. data/lib/generators/spree/install/templates/vendor/assets/stylesheets/spree/backend/all.css +0 -16
  252. data/lib/generators/spree/install/templates/vendor/assets/stylesheets/spree/frontend/all.css +0 -16
  253. data/lib/generators/spree/mailers_preview/mailers_preview_generator.rb +0 -23
  254. data/lib/generators/spree/mailers_preview/templates/mailers/previews/order_preview.rb +0 -13
  255. data/lib/generators/spree/mailers_preview/templates/mailers/previews/reimbursement_preview.rb +0 -5
  256. data/lib/generators/spree/mailers_preview/templates/mailers/previews/shipment_preview.rb +0 -5
  257. data/lib/generators/spree/mailers_preview/templates/mailers/previews/user_preview.rb +0 -11
  258. data/lib/tasks/email.rake +0 -10
  259. data/vendor/assets/javascripts/cleave.js +0 -1669
  260. data/vendor/assets/javascripts/fetch.umd.js +0 -531
  261. data/vendor/assets/javascripts/jquery.payment.js +0 -652
  262. data/vendor/assets/javascripts/jsuri.js +0 -458
  263. data/vendor/assets/javascripts/polyfill.min.js +0 -1
@@ -0,0 +1,41 @@
1
+ module Spree
2
+ module CreditCards
3
+ class Destroy
4
+ prepend Spree::ServiceModule::Base
5
+
6
+ def call(card:)
7
+ ApplicationRecord.transaction do
8
+ run :invalidate_payments
9
+ run :void_payments
10
+ run :destroy
11
+ end
12
+ end
13
+
14
+ protected
15
+
16
+ def invalidate_payments(card:)
17
+ payment_scope(card).checkout.each(&:invalidate!)
18
+
19
+ success(card: card)
20
+ end
21
+
22
+ def void_payments(card:)
23
+ payment_scope(card).where.not(state: :checkout).each(&:void!)
24
+
25
+ success(card: card)
26
+ end
27
+
28
+ def destroy(card:)
29
+ if card.destroy
30
+ success(card: card)
31
+ else
32
+ failure(card.errors.full_messages.to_sentance)
33
+ end
34
+ end
35
+
36
+ def payment_scope(card)
37
+ card.payments.valid.joins(:order).merge(Spree::Order.incomplete)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -2,34 +2,46 @@ module Spree
2
2
  class BaseSorter
3
3
  def initialize(scope, params = {}, allowed_sort_attributes = [])
4
4
  @scope = scope
5
- @sort = params[:sort]
6
5
  @allowed_sort_attributes = allowed_sort_attributes
6
+ @sort = sort_fields(params[:sort])
7
7
  end
8
8
 
9
9
  def call
10
- by_param_attribute(scope)
10
+ by_param_attributes(scope)
11
11
  end
12
12
 
13
13
  protected
14
14
 
15
15
  attr_reader :scope, :collection, :sort, :allowed_sort_attributes
16
16
 
17
- def by_param_attribute(scope)
18
- return scope if sort_field.blank? || !allowed_sort_attributes.include?(sort_field.to_sym)
17
+ def by_param_attributes(scope)
18
+ return scope if sort.empty?
19
19
 
20
- scope.order("#{sort_field}": order_direction)
20
+ sort.each do |value, order|
21
+ next if value.blank? || allowed_sort_attributes.exclude?(value.to_sym)
22
+
23
+ scope = scope.order("#{value}": order)
24
+ end
25
+
26
+ scope
27
+ end
28
+
29
+ def sort_fields(sort)
30
+ return [] if sort.nil?
31
+
32
+ sort.split(',').map { |field| [sort_field(field), order_direction(field)] }
21
33
  end
22
34
 
23
- def desc_order
24
- @desc_order ||= String(sort)[0] == '-'
35
+ def desc_order(field)
36
+ String(field)[0] == '-'
25
37
  end
26
38
 
27
- def sort_field
28
- @sort_field ||= desc_order ? sort[1..-1] : sort
39
+ def sort_field(field)
40
+ desc_order(field) ? field[1..-1] : field
29
41
  end
30
42
 
31
- def order_direction
32
- desc_order ? :desc : :asc
43
+ def order_direction(field)
44
+ desc_order(field) ? :desc : :asc
33
45
  end
34
46
  end
35
47
  end
@@ -7,8 +7,9 @@ module Spree
7
7
  end
8
8
 
9
9
  def call
10
- products = by_param_attribute(scope)
10
+ products = by_param_attributes(scope)
11
11
  products = by_price(products)
12
+ products = by_sku(products)
12
13
 
13
14
  products.distinct
14
15
  end
@@ -17,18 +18,33 @@ module Spree
17
18
 
18
19
  attr_reader :sort, :scope, :currency, :allowed_sort_attributes
19
20
 
20
- def price?
21
- sort_field == 'price'
22
- end
23
-
24
21
  def by_price(scope)
25
- return scope unless price?
22
+ return scope unless (value = sort_by?('price'))
26
23
 
27
24
  scope.joins(master: :prices).
28
25
  select("#{Spree::Product.table_name}.*, #{Spree::Price.table_name}.amount").
29
26
  distinct.
30
27
  where(spree_prices: { currency: currency }).
31
- order("#{Spree::Price.table_name}.amount #{order_direction}")
28
+ order("#{Spree::Price.table_name}.amount #{value[1]}")
29
+ end
30
+
31
+ def by_sku(scope)
32
+ return scope unless (value = sort_by?('sku'))
33
+
34
+ select_product_attributes = if scope.to_sql.include?("#{Spree::Product.table_name}.*")
35
+ ''
36
+ else
37
+ "#{Spree::Product.table_name}.*, "
38
+ end
39
+
40
+ scope.joins(:master).
41
+ select("#{select_product_attributes}#{Spree::Variant.table_name}.sku").
42
+ where(Spree::Variant.table_name.to_s => { is_master: true }).
43
+ order("#{Spree::Variant.table_name}.sku #{value[1]}")
44
+ end
45
+
46
+ def sort_by?(field)
47
+ sort.detect { |s| s[0] == field }
32
48
  end
33
49
  end
34
50
  end
@@ -2,6 +2,11 @@
2
2
  # Validates a field based on the maximum length of the underlying DB field, if there is one.
3
3
  class DbMaximumLengthValidator < ActiveModel::EachValidator
4
4
  def validate_each(record, attribute, value)
5
+ ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
6
+ `DbMaximumLengthValidator` is deprecated and will be removed in Spree 5.0.
7
+ Please remove any `db_maximum_length: true` validations from your codebase
8
+ DEPRECATION
9
+
5
10
  limit = if defined?(Globalize)
6
11
  record.class.translation_class.columns_hash[attribute.to_s].limit
7
12
  else
@@ -1,6 +1,8 @@
1
1
  class EmailValidator < ActiveModel::EachValidator
2
+ EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
3
+
2
4
  def validate_each(record, attribute, value)
3
- unless value =~ /\A[^@\s]+@[^@\s]+\z/
5
+ unless value =~ EMAIL_REGEX
4
6
  record.errors.add(attribute, :invalid, **{ value: value }.merge!(options))
5
7
  end
6
8
  end
@@ -3,3 +3,5 @@ class ActiveStorage::PurgeJob < ActiveStorage::BaseJob
3
3
  blob.purge unless blob.attachments.present?
4
4
  end
5
5
  end
6
+
7
+ Rails.application.config.active_storage.content_types_to_serve_as_binary.delete('image/svg+xml')
@@ -101,6 +101,7 @@ en:
101
101
  shipping_category: Shipping Category
102
102
  tax_category: Tax Category
103
103
  less_than: Less than
104
+ more_than: More than
104
105
  spree/promotion:
105
106
  advertise: Advertise
106
107
  code: Code
@@ -183,6 +184,12 @@ en:
183
184
  spree/address:
184
185
  one: Address
185
186
  other: Addresses
187
+ spree/cms_page:
188
+ one: Page
189
+ other: Pages
190
+ spree/cms_section:
191
+ one: Section
192
+ other: Sections
186
193
  spree/country:
187
194
  one: Country
188
195
  other: Countries
@@ -324,6 +331,22 @@ en:
324
331
  base:
325
332
  card_expired: "Card has expired"
326
333
  expiry_invalid: "Card expiration is invalid"
334
+ spree/legacy_user:
335
+ attributes:
336
+ bill_address_id:
337
+ belongs_to_other_user: belongs to other user
338
+ deprecated_in_completed_order: deprecated in completed order
339
+ ship_address_id:
340
+ belongs_to_other_user: belongs to other user
341
+ deprecated_in_completed_order: deprecated in completed order
342
+ spree/user:
343
+ attributes:
344
+ bill_address_id:
345
+ belongs_to_other_user: belongs to other user
346
+ deprecated_in_completed_order: deprecated in completed order
347
+ ship_address_id:
348
+ belongs_to_other_user: belongs to other user
349
+ deprecated_in_completed_order: deprecated in completed order
327
350
  spree/line_item:
328
351
  attributes:
329
352
  currency:
@@ -532,23 +555,97 @@ en:
532
555
  adjustment_total: Adjustment Total
533
556
  adjustments: Adjustments
534
557
  admin:
558
+ cms:
559
+ all_pages: All Pages
560
+ add_new_page: Add New Page
561
+ add_new_section: Add New Section
562
+ content: Content
563
+ click_here: click here
564
+ draft_mode: Draft Mode
565
+ full_width: Full width
566
+ link_to_taxon: Link to Taxon
567
+ link_to_product: Link to Product
568
+ title: Title
569
+ fit: Fit To
570
+ info_hero_image_body: "<p>The Hero Image section adds a large image with a button and tagline text to your page.</p>
571
+ <p>The button can link to a Product, Taxon or Page. This section can be set to fit within the central container or to the edges of the screen.</p>
572
+ <p><b>Tip:</b> Use a hero image with no button text or title, and then set the <b>Fit:</b> to <b>Container</b> and <b>Gutters</b> to <b>Use Gutters</b> this creates an image section that looks great above a Side-by-Side Images section, or an Image Gallery section.</p>
573
+ <p>Experiment with the settings, and don't be afraid to use more than one Hero Image section per page.</p>"
574
+ info_image_gallery_body: "<p>The Image Gallery section can be configured in several ways. For example, each image can link to a product or taxon. If you do not provide a link, you can display three images. Additionally, you can also use labels to add text to your images.</p>
575
+ <p>There are two layout configurations for the Image Gallery section, with the taller image used on the left or the right. You can also set this section to fit the edges of the screen or the central container to match your website's style.</p>"
576
+ info_product_carousel_body: "<p>Product Carousel is a simple section to use. Search for the taxon you wish to display, save the changes, and the products in your chosen taxon will be displayed on your page.</p>"
577
+ info_featured_article_body: "<p>The Feature Article section allows you to add rich text to your page with a set title subtitle and linking button.</p>
578
+ <p>This section can be set to use full screen or container and also use gutters.</p>"
579
+ info_side_by_side_images_body: "<p>The Side-by-Side Images section can be configured in several ways, you have the option of using them as plane images, images with text, and either of those options can be clickable links if a link is set.</p>
580
+ <p><b>Tip:</b> You can blow these images out to the edge of the screen and remove the gutters to create a completely different look.</p>"
581
+ info_rich_text_content_body: "<p>The Rich Text Content section is simply a section that offers nothing more than an area of rich text editor content to be displayed on your page.</p>"
582
+ brand_bar:
583
+ uses_menu: This section uses your Spree Menu named <b>%{menu}</b> to manage the images and links,
584
+ vist_menu_to_edit: to edit this menu.
585
+ full_width_on_small: Full width on small devices
586
+ button_text: Button Text
587
+ go_to_fullscreen_section_manager: Go To Fullscreen Section Manager
588
+ page_type: Page Type
589
+ gutters: Gutters
590
+ you_have_no_pages: You have no Pages, click the <b>+ Add New Page</b> button to get started.
591
+ new_page: New Page
592
+ toggle_page_visibility: Toggle page visibility
593
+ meta_title: Meta Title
594
+ meta_description: Meta Description
595
+ preview_page: Preview Page
596
+ full_screen_mode: '<span class="exit">Exit </span>Full Screen Mode'
597
+ hero:
598
+ aspect_ratio: Please use an image with the aspect ratio of 12:5 (2400px x 1000px)
599
+ select_page_type: Select a page type
600
+ section_type: Section Type
601
+ subtitle: Subtitle
602
+ set_gutters: Set Gutters
603
+ click_button_to_change_page_type: Click the <b>%{button_type}</b> button to load the options for this page type.
604
+ more_page_settings: '<span class="more">More</span><span class="less">Less</span> Page Settings'
605
+ seo_settings: SEO Settings
606
+ no_sections_found_please_add_one: Add your first section to this page by clicking the <b>+ Add New Section</b> button above.
607
+ click_create_to_load_new_link: 'Click the <b>Create</b> button below to save your new page section, and load the section settings.'
608
+ click_update_to_load_new_link: 'Click the <b>Update</b> button below to load the new section settings.'
609
+ settings_for: 'Options For: <b>%{section}</b>'
610
+ page_sections: '%{page_name} Sections'
611
+ page_sections_info: 'The area below represents your %{page_type} displayed in %{store}, add sections and drag them into position'
612
+ visible: Visible
613
+ side_by_side:
614
+ left_image: Left Image
615
+ right_image: Right Image
616
+ image_info: 'Please use an image with an aspect ratio of 54:35 (1468px x 952px).'
617
+ image_gallery:
618
+ display_labels: Display labels
619
+ image_a: Image A
620
+ image_b: Image B
621
+ image_c: Image C
622
+ layout_style: Layout Style
623
+ square_image: Please use an image with an aspect ratio of 18:13 (1080px x 780px).
624
+ tall_image: Please use an image with an aspect ratio of 27:40 (1080px x 1600px).
625
+ linkable:
626
+ seach_for_a_page: Search for a page
535
627
  tab:
536
628
  configuration: Configuration
629
+ content: Content
537
630
  option_types: Option Types
538
631
  orders: Orders
539
632
  overview: Overview
633
+ pages: Pages
540
634
  products: Products
541
635
  promotions: Promotions
542
636
  promotion_categories: Promotion Categories
543
637
  properties: Properties
544
638
  prototypes: Prototypes
545
639
  reports: Reports
640
+ navigation: Navigation
546
641
  taxonomies: Taxonomies
547
642
  taxons: Taxons
548
643
  users: Users
549
644
  return_authorizations: Return Authorizations
550
645
  customer_returns: Customer Returns
551
646
  order:
647
+ changing_store_warning: If you change the store this order belongs to, the order will be reset.
648
+ once_an_order_is_complete_you_can_not_change_store: 'Sorry, once an order is complete, you can no longer change the store that the order belongs to.'
552
649
  events:
553
650
  approve: approve
554
651
  cancel: cancel
@@ -556,6 +653,8 @@ en:
556
653
  resend: Resend
557
654
  orders:
558
655
  cart: Cart
656
+ reports:
657
+ for: For %{store_name}
559
658
  return_authorization:
560
659
  product: Product
561
660
  user:
@@ -571,7 +670,57 @@ en:
571
670
  store_credits: Store Credits
572
671
  no_store_credit: User has no Store Credit available.
573
672
  available_store_credit: User has %{amount} in Store Credit available.
673
+ navigation:
674
+ all_menus: All Menus
675
+ add_new_menu: Add New Menu
676
+ add_new_item: 'Add New Item'
677
+ code: Code
678
+ default_menus_info:
679
+ title: Default Menus
680
+ body: "Default menus are menus whose language matches the associated store's default language.<br><br>
681
+ <h5>Example</h5>If you have a store that uses Spanish as the default language but also offers the options of German and French; your default header menu for this store would be set to use <b>Español (es)</b> for the language and <b>Header</b> as the location.<br><br>
682
+ <h5>Why Are Default Menus Important?</h5> Default menus are displayed to your visitor if no menu is available in the current language they are browsing. It is recommended that you create a default menu for each menu location within each store.<br><br>
683
+ <h5>More Information</h5>To learn more about menus, view the official Spree user documentation by <a href='https://guides.spreecommerce.org/user/navigation/building_the_main_menu.html' target='_blank' class='alert-link'>clicking here</a>."
684
+ allow_this_menu_item_to_contain_nested_menu_items: Allow this Menu Item to contain nested items
685
+ back_to_all_menus: Back To All Menus
686
+ click_create_to_load_new_link: 'Click the <b>Create</b> button below to change the link field.'
687
+ click_update_to_load_new_link: 'Click the <b>Update</b> button below to change the link field.'
688
+ give_your_menu_a_unique_name: 'Use the unique code to identify your menu: spree-eu-main'
689
+ link_settings: Link Settings
690
+ link_to: Link To
691
+ image_alt_text: Add alt text to your image
692
+ image_asset: Add a Promotion image or Link icon.
693
+ move_could_not_be_saved: 'ERROR: This move could not be saved.'
694
+ managing_by_store_title: 'Managing Menus By Store'
695
+ managing_by_store: <p>You are managing the menus for <b>%{store}</b>. To manage menus for other stores, change the global store using the drop-down in the main navbar found at the top of the screen.</p>
696
+ new_menu_item: New Menu Item
697
+ new_menu: New Menu
698
+ nested_under: Nested under
699
+ no_menu_items: '<b>%{menu}</b> has no items. Click the <b>Add New Item</b> button to begin adding links to this menu.'
700
+ nested_under_info: Quickly nest your Menu Item if you already know where it needs to be.
701
+ item_type: Item Type
702
+ image_info: '<b>NOTE:</b> You can attach an image to any menu item, but your image will only be displayed in the main menu when nested inside a container with the code <b>promo</b>.<br><br> For best results use images with a width of 540px and height of 350px.'
703
+ open_link_in_new_window: Open this link in a new window
704
+ menu_item_type_container_message: "Containers are menu items that do not link to a destination. If you are building the Spree Main Menu
705
+ create containers with the code: <b>category</b> or <b>promo</b>, and then nest your links inside these containers build out your menu.
706
+ <br><br> For an indepth guide to building the main menu see the documenttation page <a href='https://guides.spreecommerce.org/user/navigation/building_the_main_menu.html' target='_blank' class='alert-link'>Building The Main Menu</a>"
707
+ menus: Menus
708
+ menu_items: '%{menu_name} Items'
709
+ public_details: Public Details
710
+ subtitle: Subtitle
711
+ url_info: 'The URL field can link to an external website using <b>https://example.com</b>, link to an otherwise unreachable internal path using <b>/policies/privacy</b>,
712
+ launch an email client using <b>mailto:sales@example.com</b> or used to create a clickable phone number with <b>tel:123456789</b>'
713
+ seach_for_a_product: Search for a Product
714
+ seach_for_a_taxon: Search for a Taxon
715
+ settings: Settings
716
+ set_a_code: "Adding a code is optional but can be useful if you need to identify this menu item. When building
717
+ the Spree main menu use the code <b>category</b> or <b>promo</b> to create the containers that organize links and promotions appropriately. To learn more view the documentation by <a href='https://guides.spreecommerce.org/user/navigation/add_menu_items.html' target='_blank' class='alert-link'>clicking here</a>."
718
+ type: Type
719
+ used_in: Used In
720
+ you_have_no_menus: You have no Menus, click the Add New Menu button to create your first Menu.
721
+ this_link_takes_you_to_your_stores_home_page: This link takes you to your stores home page.
574
722
  administration: Administration
723
+ add_new_store: Add New Store
575
724
  advertise: Advertise
576
725
  agree_to_privacy_policy: Agree to Privacy Policy
577
726
  agree_to_terms_of_service: Agree to Terms of Service
@@ -629,6 +778,8 @@ en:
629
778
  canceled: Canceled
630
779
  canceler: Canceler
631
780
  canceled_at: Canceled at
781
+ cannot_be_destroyed: Order cannot be destroyed.
782
+ cannot_empty: Cannot empty order.
632
783
  cannot_empty_completed_order: Order has already been processed so it cannot be emptied
633
784
  cannot_create_payment_without_payment_methods: You cannot create a payment for an order without any payment methods defined.
634
785
  cannot_create_customer_returns: Cannot create customer returns as this order has no shipped units.
@@ -669,7 +820,7 @@ en:
669
820
  checkout_page:
670
821
  main_navigation: Main navigation
671
822
  checkout_navigation: Checkout navigation
672
- back_to_cart: back to the cart
823
+ back_to_cart: back to cart
673
824
  delivery_method: delivery method
674
825
  header: Checkout
675
826
  product: Product
@@ -736,6 +887,7 @@ en:
736
887
  created_by: Created By
737
888
  credit: Credit
738
889
  credit_card: Credit Card
890
+ credit_card_remove_confirmation: Are you sure you want to delete the credit card?
739
891
  credit_cards: Credit Cards
740
892
  credit_owed: Credit Owed
741
893
  credited: Credited
@@ -788,6 +940,7 @@ en:
788
940
  display: Display
789
941
  doesnt_track_inventory: It doesn't track inventory
790
942
  dont_have_account: No account?
943
+ draft_mode: Draft Mode
791
944
  edit: Edit
792
945
  editing_resource: 'Editing %{resource}'
793
946
  editing_rma_reason: Editing RMA Reason
@@ -818,6 +971,8 @@ en:
818
971
  error: error
819
972
  errors:
820
973
  messages:
974
+ store_association_can_not_be_changed: The store association can not be changed
975
+ store_is_already_set: Store is already set
821
976
  blank: can't be blank
822
977
  could_not_create_taxon: Could not create taxon
823
978
  no_shipping_methods_available: No shipping methods available for selected location, please change your address and try again.
@@ -856,6 +1011,8 @@ en:
856
1011
  existing_shipments: Existing shipments
857
1012
  facebook: Facebook
858
1013
  failed_payment_attempts: Failed Payment Attempts
1014
+ favicon: 'Favicon'
1015
+ favicon_upload_info: "File format: PNG or ICO. File resolution: up to 256x256. File size: up to 1MB"
859
1016
  filename: Filename
860
1017
  fill_in_customer_info: Please fill in customer info
861
1018
  filter: Filter
@@ -915,6 +1072,7 @@ en:
915
1072
  icon: Icon
916
1073
  image: Image
917
1074
  images: Images
1075
+ image_alt_text: Add Alt text to your image
918
1076
  implement_eligible_for_return: "Must implement #eligible_for_return? for your EligibilityValidator."
919
1077
  implement_requires_manual_intervention: "Must implement #requires_manual_intervention? for your EligibilityValidator."
920
1078
  in_stock: In Stock
@@ -964,6 +1122,7 @@ en:
964
1122
  items_to_be_reimbursed: Items to be reimbursed
965
1123
  items_reimbursed: Items reimbursed
966
1124
  join_slack: Join Slack
1125
+ language: Language
967
1126
  last_name: Last Name
968
1127
  lastname: Last Name
969
1128
  last_name_begins_with: Last Name Begins With
@@ -982,7 +1141,7 @@ en:
982
1141
  log_in_to_continue: Log in to continue
983
1142
  logs: "Logs"
984
1143
  logged_in_as: Logged in as
985
- logged_in_succesfully: Logged in successfully
1144
+ logged_in_successfully: Logged in successfully
986
1145
  logged_out: You have been logged out.
987
1146
  login: Login
988
1147
  login_as_existing: Login as Existing Customer
@@ -1005,6 +1164,7 @@ en:
1005
1164
  match_choices:
1006
1165
  all: All
1007
1166
  none: None
1167
+ max: 'Max'
1008
1168
  max_items: Max Items
1009
1169
  member_since: Member Since
1010
1170
  memo: Memo
@@ -1013,6 +1173,7 @@ en:
1013
1173
  meta_title: Meta Title
1014
1174
  metadata: Metadata
1015
1175
  mutable: Mutable
1176
+ min: 'Min'
1016
1177
  minimal_amount: Minimal Amount
1017
1178
  missing_return_authorization: ! 'Missing Return Authorization for %{item_name}.'
1018
1179
  month: Month
@@ -1121,6 +1282,7 @@ en:
1121
1282
  open: Open
1122
1283
  open_all_adjustments: Open All Adjustments
1123
1284
  option_type: Option Type
1285
+ option_type_filterable_info: 'When an option type is set to Filterable, your storefront visitors are presented with the option to filter a taxon of products based on the option type. A typical example of this would be to filter clothing by size and color.<br><br><b>Please Note:</b> Filters will only be visible in the storefront taxons that contain products with this option type set.'
1124
1286
  option_type_placeholder: Choose an option type
1125
1287
  option_types: Option Types
1126
1288
  option_value: Option Value
@@ -1188,6 +1350,7 @@ en:
1188
1350
  backordered_confirm_info: Selected item is backordered so expect delays. Are you sure you want to order it?
1189
1351
  overview: Overview
1190
1352
  package_from: package from
1353
+ page: Page
1191
1354
  page_not_found: Sorry! Page you are looking can’t be found.
1192
1355
  pagination:
1193
1356
  next_page: next page &raquo;
@@ -1257,6 +1420,8 @@ en:
1257
1420
  price: price
1258
1421
  price_high_to_low: PRICE (HIGH - LOW)
1259
1422
  price_low_to_high: PRICE (LOW - HIGH)
1423
+ name_a_z: NAME (A-Z)
1424
+ name_z_a: NAME (Z-A)
1260
1425
  result: RESULT
1261
1426
  results_for: RESULTS FOR
1262
1427
  size: SIZE
@@ -1281,6 +1446,7 @@ en:
1281
1446
  price_sack: Price Sack
1282
1447
  process: Process
1283
1448
  product: Product
1449
+ product_name: Product Name
1284
1450
  product_details: Product Details
1285
1451
  product_has_no_description: This product has no description
1286
1452
  product_not_available_in_this_currency: This product is not available in the selected currency.
@@ -1457,6 +1623,8 @@ en:
1457
1623
  say_yes: 'Yes'
1458
1624
  scope: Scope
1459
1625
  search: Search
1626
+ search_by: 'Search by:'
1627
+ search_order_number: Order Number
1460
1628
  search_results: Search results for '%{keywords}'
1461
1629
  searching: Searching
1462
1630
  secure_connection_type: Secure Connection Type
@@ -1470,6 +1638,7 @@ en:
1470
1638
  select_a_store_credit_reason: Select a reason for the store credit
1471
1639
  select_an_option: Select an option
1472
1640
  select_stock: Select stock
1641
+ select_stores: Select Store(s)
1473
1642
  selected_quantity_not_available: ! 'selected of %{item} is not available.'
1474
1643
  send_copy_of_all_mails_to: Send Copy of All Mails To
1475
1644
  send_mails_as: Send Mails As
@@ -1623,7 +1792,6 @@ en:
1623
1792
  customer_support_email_help: "This email is visible to your Store visitors in the Footer section"
1624
1793
  new_order_notifications_email_help: "If you want to receive an email notification every time someone places an Order please provide an email address for that notification to be sent to"
1625
1794
  seo_robots: "Please check <a href='https://developers.google.com/search/reference/robots_meta_tag' target='_blank'>this page for more help</a>"
1626
- store_set_default_button: Set as default
1627
1795
  stores: Stores
1628
1796
  store_credit_name: Store Credit
1629
1797
  store_credit:
@@ -1670,6 +1838,7 @@ en:
1670
1838
  successfully_removed: ! '%{resource} has been successfully removed!'
1671
1839
  successfully_updated: ! '%{resource} has been successfully updated!'
1672
1840
  summary: Summary
1841
+ support: Support
1673
1842
  supported_currencies: Supported Currencies
1674
1843
  supported_currencies_long: A comma separated list of supported currencies
1675
1844
  supported_locales: Supported Locales
@@ -1706,6 +1875,7 @@ en:
1706
1875
  message: If you have received this email, then your email settings are correct.
1707
1876
  subject: Test Mail
1708
1877
  test_mode: Test Mode
1878
+ this_menu_already_has_a_root_item: This Menu already has a root item
1709
1879
  thank_you_for_your_order: Thank you for your business. Please print out a copy of this confirmation page for your records.
1710
1880
  there_are_no_items_for_this_order: There are no items for this order. Please add an item to the order to continue.
1711
1881
  there_were_problems_with_the_following_fields: There were problems with the following fields
@@ -1770,6 +1940,10 @@ en:
1770
1940
  variants: Variants
1771
1941
  version: Version
1772
1942
  void: Void
1943
+ we_will_be_back: We will be back.
1944
+ we_are_busy_updating: "We're updating the %{store_name} homepage."
1945
+ we_are_busy_updating_page: "We're busy updating this page."
1946
+ please_check_back_soon: Please check back soon.
1773
1947
  weight: Weight
1774
1948
  what_is_a_cvv: What is a (CVV) Credit Card Code?
1775
1949
  what_is_this: What's This?