spree_core 5.0.1 → 5.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a60d5a6d4ba0fd4d7e223de06835389a8c4c39572dabe07e29a4fb5312d2548
4
- data.tar.gz: 1163cb99eaca807157669cc6ae77f3c2eae58c8b63de520b27c329244c870d22
3
+ metadata.gz: 61dc753fc9921cc827589519ccd19bdd4db91ff9ba052174e84e6681578b67a3
4
+ data.tar.gz: 9e992274856bc445de5a7b4041126721e992e1554aa0d677ff87c908a52c6cc9
5
5
  SHA512:
6
- metadata.gz: d69a80bb1326c8f17f29c299701c20b372736a16002688a51cb0f9cef9f95a650ef3f2eb860e5d671e3fda54745fc2eace0b54a534e746d0b12e0337ea7cb547
7
- data.tar.gz: 20864a616e90144196cf5b3d8a4b4d8ef35bed9bf85415a1ed07361b1c4451fd77716adfdfbb9a122ac0284eee6b2b00e2d9b24f5dddf825167eb7fe2f5e97c7
6
+ metadata.gz: 6a6b74d64d7be259de034cfc831f6eaf9877f9f801a3312adda2af3983060948e8434e2ef4d7ad4b3fdbeac7ff366ae6d87a210b27f7172769abbda9243e46b5
7
+ data.tar.gz: f31e47f912ee551e853fe190e1acd34009d3c191cc9666797db4986fbecbb445062e6533de35489998dbdea569d85fd9bf0fd54ee3e27047c5c373e6c2a62ad6
@@ -1,6 +1,27 @@
1
1
  module Spree
2
2
  module Addresses
3
3
  class Find < ::Spree::BaseFinder
4
+ def initialize(scope:, params:)
5
+ super
6
+ @exclude_quick_checkout = params.dig(:filter, :exclude_quick_checkout)
7
+ end
8
+
9
+ def execute
10
+ addresses = scope
11
+ exclude_quick_checkout(addresses)
12
+ end
13
+
14
+ private
15
+
16
+ def exclude_quick_checkout?
17
+ @exclude_quick_checkout.present?
18
+ end
19
+
20
+ def exclude_quick_checkout(addresses)
21
+ return addresses unless exclude_quick_checkout?
22
+
23
+ addresses.not_quick_checkout
24
+ end
4
25
  end
5
26
  end
6
27
  end
@@ -12,6 +12,7 @@ module Spree
12
12
  @taxons = taxon_ids(params.dig(:filter, :taxons))
13
13
  @concat_taxons = taxon_ids(params.dig(:filter, :concat_taxons))
14
14
  @name = params.dig(:filter, :name)
15
+ @slug = params.dig(:filter, :slug)
15
16
  @options = params.dig(:filter, :options).try(:to_unsafe_hash)
16
17
  @option_value_ids = params.dig(:filter, :option_value_ids)
17
18
  @sort_by = params.dig(:sort_by)
@@ -41,6 +42,7 @@ module Spree
41
42
  products = by_taxons(products)
42
43
  products = by_concat_taxons(products)
43
44
  products = by_name(products)
45
+ products = by_slug(products)
44
46
  products = by_options(products)
45
47
  products = by_option_value_ids(products)
46
48
  products = by_properties(products)
@@ -60,7 +62,7 @@ module Spree
60
62
 
61
63
  attr_reader :ids, :skus, :price, :currency, :taxons, :concat_taxons, :name, :options, :option_value_ids, :scope,
62
64
  :sort_by, :deleted, :discontinued, :properties, :store, :in_stock, :backorderable, :purchasable, :tags,
63
- :query, :vendor_ids, :out_of_stock
65
+ :query, :vendor_ids, :out_of_stock, :slug
64
66
 
65
67
  def query?
66
68
  query.present?
@@ -94,6 +96,10 @@ module Spree
94
96
  name.present?
95
97
  end
96
98
 
99
+ def slug?
100
+ slug.present?
101
+ end
102
+
97
103
  def options?
98
104
  options.present?
99
105
  end
@@ -172,6 +178,12 @@ module Spree
172
178
  products.i18n { name.matches("%#{product_name}%") }
173
179
  end
174
180
 
181
+ def by_slug(products)
182
+ return products unless slug.present?
183
+
184
+ products.i18n.where(slug: slug)
185
+ end
186
+
175
187
  def by_options(products)
176
188
  return products unless options?
177
189
 
@@ -512,6 +512,17 @@ module Spree
512
512
  where conditions.inject(:or)
513
513
  end
514
514
 
515
+ def self.slug_available?(slug, id)
516
+ !where(slug: slug).where.not(id: id).exists?
517
+ end
518
+
519
+ def ensure_slug_is_unique(candidate_slug)
520
+ return slug if candidate_slug.blank? || slug.blank?
521
+ return candidate_slug if self.class.slug_available?(candidate_slug, id)
522
+
523
+ normalize_friendly_id([candidate_slug, uuid_for_friendly_id])
524
+ end
525
+
515
526
  # Suitable for displaying only variants that has at least one option value.
516
527
  # There may be scenarios where an option type is removed and along with it
517
528
  # all option values. At that point all variants associated with only those
@@ -187,7 +187,7 @@ module Spree
187
187
  #
188
188
  default_scope { order(created_at: :asc) }
189
189
  scope :by_custom_domain, ->(url) { left_joins(:custom_domains).where("#{Spree::CustomDomain.table_name}.url" => url) }
190
- scope :by_url, ->(url) { where("#{table_name}.url like ?", "%#{url}%") }
190
+ scope :by_url, ->(url) { where(url: url).or(where("#{table_name}.url like ?", "%#{url}%")) }
191
191
 
192
192
  #
193
193
  # Delegations
@@ -113,6 +113,9 @@ module Spree
113
113
  end
114
114
  end
115
115
 
116
+ # Creates a new preview for the theme
117
+ #
118
+ # @return [Spree::Theme]
116
119
  def create_preview
117
120
  ActiveRecord::Base.connected_to(role: :writing) do
118
121
  ApplicationRecord.transaction do
@@ -152,16 +155,46 @@ module Spree
152
155
  end
153
156
  end
154
157
 
158
+ # Returns an array of available layout section classes for the theme
159
+ #
160
+ # @return [Array<Class>]
155
161
  def available_layout_sections
156
- Rails.application.config.spree.theme_layout_sections
162
+ [
163
+ *Rails.application.config.spree.theme_layout_sections,
164
+ *custom_layout_sections
165
+ ]
166
+ end
167
+
168
+ # Returns an array of custom layout section classes for the theme
169
+ #
170
+ # @return [Array<Class>]
171
+ def custom_layout_sections
172
+ # you can override this method in your theme to return a list of custom layout sections for your theme
173
+ # [Spree::PageSections::Custom, Spree::PageSections::Custom2]
174
+ []
157
175
  end
158
176
 
177
+ # Returns an array of available page section classes for the theme
178
+ #
179
+ # @return [Array<Class>]
159
180
  def available_page_sections
160
181
  return @available_page_sections if @available_page_sections
161
182
 
162
- @available_page_sections ||= Rails.application.config.spree.page_sections.find_all do |section_class|
163
- section_class.role == 'content'
164
- end.sort_by(&:name)
183
+ @available_page_sections ||= [
184
+ *Rails.application.config.spree.page_sections.find_all do |section_class|
185
+ section_class.role == 'content'
186
+ end,
187
+ *custom_page_sections
188
+ ].sort_by(&:name)
189
+ end
190
+
191
+ # Returns an array of custom page section classes for the theme
192
+ #
193
+ # @return [Array<Class>]
194
+ def custom_page_sections
195
+ # you can override this method in your theme to return a list of custom page sections for your theme
196
+ # [Spree::PageSections::Custom, Spree::PageSections::Custom2]
197
+ []
165
198
  end
166
199
 
167
200
  def restore_defaults!
@@ -3,6 +3,8 @@ module Spree
3
3
  class SetFallbackLocaleForStore
4
4
  def call(store:)
5
5
  store_default_locale = store.default_locale
6
+ return unless store_default_locale.present?
7
+
6
8
  fallbacks = store.supported_locales_list.each_with_object({}) do |locale, object|
7
9
  object[locale] = [store_default_locale]
8
10
  end
@@ -527,7 +527,6 @@ en:
527
527
  account: Account
528
528
  account_info: Account info
529
529
  account_members: Team
530
- account_updated: Account updated
531
530
  action: Action
532
531
  actions:
533
532
  approve: Approve
@@ -770,7 +769,6 @@ en:
770
769
  compare_at_amount: Compare at amount
771
770
  compare_at_price: Compare at price
772
771
  complete: complete
773
- conditions: Conditions
774
772
  configuration: Configuration
775
773
  configurations: Configurations
776
774
  confirm: Confirm
@@ -1043,6 +1041,8 @@ en:
1043
1041
  font_size_scale: Font size scale
1044
1042
  fonts: Fonts
1045
1043
  footer: Footer
1044
+ forbidden: Access denied
1045
+ forbidden_message: You are not authorized to access this page.
1046
1046
  forgot_password: Forgot password?
1047
1047
  free: Free
1048
1048
  free_shipping: Free Shipping
@@ -1519,7 +1519,6 @@ en:
1519
1519
  permalink: Permalink
1520
1520
  personal_details: Personal details
1521
1521
  phone: Phone
1522
- place_now: Place now
1523
1522
  place_order: Place Order
1524
1523
  please_check_back_soon: Please check back soon.
1525
1524
  please_define_payment_methods: Please define some payment methods first.
@@ -1,6 +1,8 @@
1
1
  class BackfillFriendlyIdSlugLocale < ActiveRecord::Migration[6.1]
2
2
  def up
3
- FriendlyId::Slug.unscoped.update_all(locale: Spree::Store.default.default_locale)
3
+ if Spree::Store.default.present? && Spree::Store.default.default_locale.present?
4
+ FriendlyId::Slug.unscoped.update_all(locale: Spree::Store.default.default_locale)
5
+ end
4
6
  end
5
7
 
6
8
  def down
@@ -257,14 +257,7 @@ module Spree
257
257
  checkout_email_entered: 'Checkout Email Entered',
258
258
  checkout_step_viewed: 'Checkout Step Viewed',
259
259
  checkout_step_completed: 'Checkout Step Completed',
260
-
261
- order_completed: 'Order Completed',
262
- order_cancelled: 'Order Cancelled',
263
- order_refunded: 'Order Refunded',
264
- package_shipped: 'Package Shipped',
265
- order_fulfilled: 'Order Fulfilled',
266
-
267
- gift_card_issued: 'Gift Card Issued'
260
+ order_completed: 'Order Completed'
268
261
  }
269
262
  Rails.application.config.spree.analytics_event_handlers = []
270
263
  end
@@ -1,5 +1,5 @@
1
1
  module Spree
2
- VERSION = '5.0.1'.freeze
2
+ VERSION = '5.0.3'.freeze
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -94,6 +94,7 @@ module Spree
94
94
  :option_values_hash, :weight, :height, :width, :depth,
95
95
  :shipping_category_id, :tax_category_id,
96
96
  :cost_currency, :cost_price, :compare_at_price,
97
+ :slug,
97
98
  {
98
99
  tag_list: [],
99
100
  option_type_ids: [],
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-04-09 00:00:00.000000000 Z
13
+ date: 2025-05-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n-tasks
@@ -1308,9 +1308,9 @@ licenses:
1308
1308
  - BSD-3-Clause
1309
1309
  metadata:
1310
1310
  bug_tracker_uri: https://github.com/spree/spree/issues
1311
- changelog_uri: https://github.com/spree/spree/releases/tag/v5.0.1
1311
+ changelog_uri: https://github.com/spree/spree/releases/tag/v5.0.3
1312
1312
  documentation_uri: https://docs.spreecommerce.org/
1313
- source_code_uri: https://github.com/spree/spree/tree/v5.0.1
1313
+ source_code_uri: https://github.com/spree/spree/tree/v5.0.3
1314
1314
  post_install_message:
1315
1315
  rdoc_options: []
1316
1316
  require_paths: