spree_core 5.0.2 → 5.0.4
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 +4 -4
- data/app/models/spree/order.rb +5 -0
- data/app/models/spree/page_blocks/products/buy_buttons.rb +8 -0
- data/app/models/spree/page_blocks/products/quantity_selector.rb +4 -0
- data/app/models/spree/page_blocks/products/variant_picker.rb +4 -0
- data/app/models/spree/page_sections/featured_product.rb +4 -0
- data/app/models/spree/page_sections/image_banner.rb +12 -0
- data/app/models/spree/page_sections/image_with_text.rb +12 -0
- data/app/models/spree/page_sections/newsletter.rb +1 -1
- data/app/models/spree/page_sections/rich_text.rb +11 -0
- data/app/models/spree/page_sections/video.rb +8 -0
- data/app/models/spree/product.rb +10 -2
- data/app/models/spree/shipment.rb +1 -1
- data/app/models/spree/store.rb +3 -1
- data/app/models/spree/theme.rb +37 -4
- data/app/models/spree/variant.rb +9 -1
- data/config/locales/en.yml +5 -1
- data/db/migrate/20230110142344_backfill_friendly_id_slug_locale.rb +3 -1
- data/lib/spree/core/controller_helpers/auth.rb +1 -0
- data/lib/spree/core/controller_helpers/order.rb +2 -1
- data/lib/spree/core/engine.rb +1 -8
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/testing_support/capybara_config.rb +1 -1
- data/lib/spree/testing_support/factories/stock_item_factory.rb +5 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dad7a44435e17f7a0b717356dfe3f8f70cac0e9a18f38f505ded42f3908faf5
|
4
|
+
data.tar.gz: 109859dd8b1790ab9c0a22c1457e03e81708d79007664f0c8afae841573dd43e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f09637caac881e203c1ff4f1104c2035c89df6cf671d619b7b9e4786a82a4d65332e6537fa4932545e1782203c82f1b41bb6e4c416674df57de95ccbb014410f
|
7
|
+
data.tar.gz: 2e499043d9f6393d208ce6cdb823059e734748e79924612d408e6de48d5e36c89cb1799405dd62da06e53aa6b8df3693033a267948fb3e6a4fc2077d4efbce2d
|
data/app/models/spree/order.rb
CHANGED
@@ -443,6 +443,7 @@ module Spree
|
|
443
443
|
# @return [Array<Spree::Variant>] the backordered variants for the order
|
444
444
|
def backordered_variants
|
445
445
|
variants.
|
446
|
+
where(track_inventory: true).
|
446
447
|
joins(:stock_items, :product).
|
447
448
|
where(Spree::StockItem.table_name => { count_on_hand: ..0, backorderable: true })
|
448
449
|
end
|
@@ -814,6 +815,10 @@ module Spree
|
|
814
815
|
csv_lines
|
815
816
|
end
|
816
817
|
|
818
|
+
def all_line_items
|
819
|
+
line_items
|
820
|
+
end
|
821
|
+
|
817
822
|
private
|
818
823
|
|
819
824
|
def link_by_email
|
@@ -26,10 +26,22 @@ module Spree
|
|
26
26
|
]
|
27
27
|
end
|
28
28
|
|
29
|
+
def available_blocks_to_add
|
30
|
+
[
|
31
|
+
Spree::PageBlocks::Buttons,
|
32
|
+
Spree::PageBlocks::Heading,
|
33
|
+
Spree::PageBlocks::Text
|
34
|
+
]
|
35
|
+
end
|
36
|
+
|
29
37
|
def blocks_available?
|
30
38
|
true
|
31
39
|
end
|
32
40
|
|
41
|
+
def can_sort_blocks?
|
42
|
+
true
|
43
|
+
end
|
44
|
+
|
33
45
|
def icon_name
|
34
46
|
'slideshow'
|
35
47
|
end
|
@@ -27,6 +27,14 @@ module Spree
|
|
27
27
|
]
|
28
28
|
end
|
29
29
|
|
30
|
+
def available_blocks_to_add
|
31
|
+
[
|
32
|
+
Spree::PageBlocks::Buttons,
|
33
|
+
Spree::PageBlocks::Heading,
|
34
|
+
Spree::PageBlocks::Text
|
35
|
+
]
|
36
|
+
end
|
37
|
+
|
30
38
|
def default_links
|
31
39
|
@default_links.presence || [
|
32
40
|
Spree::PageLink.new(
|
@@ -40,6 +48,10 @@ module Spree
|
|
40
48
|
true
|
41
49
|
end
|
42
50
|
|
51
|
+
def can_sort_blocks?
|
52
|
+
true
|
53
|
+
end
|
54
|
+
|
43
55
|
def icon_name
|
44
56
|
'photo'
|
45
57
|
end
|
@@ -8,10 +8,21 @@ module Spree
|
|
8
8
|
]
|
9
9
|
end
|
10
10
|
|
11
|
+
def available_blocks_to_add
|
12
|
+
[
|
13
|
+
Spree::PageBlocks::Heading,
|
14
|
+
Spree::PageBlocks::Text
|
15
|
+
]
|
16
|
+
end
|
17
|
+
|
11
18
|
def blocks_available?
|
12
19
|
true
|
13
20
|
end
|
14
21
|
|
22
|
+
def can_sort_blocks?
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
15
26
|
def icon_name
|
16
27
|
'text-caption'
|
17
28
|
end
|
@@ -44,6 +44,10 @@ module Spree
|
|
44
44
|
]
|
45
45
|
end
|
46
46
|
|
47
|
+
def available_blocks_to_add
|
48
|
+
[Spree::PageBlocks::Heading]
|
49
|
+
end
|
50
|
+
|
47
51
|
def icon_name
|
48
52
|
'movie'
|
49
53
|
end
|
@@ -52,6 +56,10 @@ module Spree
|
|
52
56
|
true
|
53
57
|
end
|
54
58
|
|
59
|
+
def can_sort_blocks?
|
60
|
+
true
|
61
|
+
end
|
62
|
+
|
55
63
|
def video_embed
|
56
64
|
@video_embed ||= ::ActionText::VideoEmbed.find_by(id: preferred_youtube_video_embed_id) if preferred_youtube_video_embed_id.present?
|
57
65
|
end
|
data/app/models/spree/product.rb
CHANGED
@@ -595,7 +595,11 @@ module Spree
|
|
595
595
|
join_translation_table(Taxonomy).
|
596
596
|
find_by(Taxonomy.translation_table_alias => { name: Spree.t(:taxonomy_brands_name) })
|
597
597
|
else
|
598
|
-
taxons.
|
598
|
+
if taxons.loaded?
|
599
|
+
taxons.find { |taxon| taxon.taxonomy.name == Spree.t(:taxonomy_brands_name) }
|
600
|
+
else
|
601
|
+
taxons.joins(:taxonomy).find_by(Taxonomy.table_name => { name: Spree.t(:taxonomy_brands_name) })
|
602
|
+
end
|
599
603
|
end
|
600
604
|
end
|
601
605
|
|
@@ -606,7 +610,11 @@ module Spree
|
|
606
610
|
order(depth: :desc).
|
607
611
|
find_by(Taxonomy.translation_table_alias => { name: Spree.t(:taxonomy_categories_name) })
|
608
612
|
else
|
609
|
-
taxons.
|
613
|
+
if taxons.loaded?
|
614
|
+
taxons.find { |taxon| taxon.taxonomy.name == Spree.t(:taxonomy_categories_name) }
|
615
|
+
else
|
616
|
+
taxons.joins(:taxonomy).order(depth: :desc).find_by(Taxonomy.table_name => { name: Spree.t(:taxonomy_categories_name) })
|
617
|
+
end
|
610
618
|
end
|
611
619
|
end
|
612
620
|
|
@@ -430,7 +430,7 @@ module Spree
|
|
430
430
|
end
|
431
431
|
|
432
432
|
def manifest_unstock(item)
|
433
|
-
stock_location.unstock
|
433
|
+
stock_location.unstock(item.variant, item.quantity, self) if item.variant.track_inventory?
|
434
434
|
end
|
435
435
|
|
436
436
|
def recalculate_adjustments
|
data/app/models/spree/store.rb
CHANGED
@@ -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
|
@@ -338,6 +338,8 @@ module Spree
|
|
338
338
|
end
|
339
339
|
end
|
340
340
|
|
341
|
+
# Returns the default stock location for the store or creates a new one if it doesn't exist
|
342
|
+
# @return [Spree::StockLocation]
|
341
343
|
def default_stock_location
|
342
344
|
@default_stock_location ||= begin
|
343
345
|
stock_location_scope = Spree::StockLocation.order_default
|
data/app/models/spree/theme.rb
CHANGED
@@ -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
|
-
|
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 ||=
|
163
|
-
|
164
|
-
|
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!
|
data/app/models/spree/variant.rb
CHANGED
@@ -73,6 +73,8 @@ module Spree
|
|
73
73
|
after_create :create_stock_items
|
74
74
|
after_create :set_master_out_of_stock, unless: :is_master?
|
75
75
|
after_commit :clear_line_items_cache, on: :update
|
76
|
+
|
77
|
+
after_create :create_default_stock_item, unless: :track_inventory?
|
76
78
|
after_update_commit :handle_track_inventory_change
|
77
79
|
|
78
80
|
after_commit :remove_prices_from_master_variant, on: [:create, :update], unless: :is_master?
|
@@ -553,11 +555,17 @@ module Spree
|
|
553
555
|
line_items.update_all(updated_at: Time.current)
|
554
556
|
end
|
555
557
|
|
558
|
+
def create_default_stock_item
|
559
|
+
return if stock_items.any?
|
560
|
+
|
561
|
+
Spree::Store.current.default_stock_location.set_up_stock_item(self)
|
562
|
+
end
|
563
|
+
|
556
564
|
def handle_track_inventory_change
|
557
565
|
return unless track_inventory_previously_changed?
|
558
566
|
return if track_inventory
|
559
567
|
|
560
|
-
stock_items.update_all(
|
568
|
+
stock_items.update_all(count_on_hand: 0, updated_at: Time.current)
|
561
569
|
end
|
562
570
|
|
563
571
|
def remove_prices_from_master_variant
|
data/config/locales/en.yml
CHANGED
@@ -769,7 +769,6 @@ en:
|
|
769
769
|
compare_at_amount: Compare at amount
|
770
770
|
compare_at_price: Compare at price
|
771
771
|
complete: complete
|
772
|
-
conditions: Conditions
|
773
772
|
configuration: Configuration
|
774
773
|
configurations: Configurations
|
775
774
|
confirm: Confirm
|
@@ -1430,6 +1429,9 @@ en:
|
|
1430
1429
|
newsletter_form:
|
1431
1430
|
button_text_default: Submit
|
1432
1431
|
placeholder_default: Enter your email
|
1432
|
+
products:
|
1433
|
+
buy_buttons:
|
1434
|
+
display_name: Add To Cart
|
1433
1435
|
page_not_found: Sorry! Page you are looking can’t be found.
|
1434
1436
|
page_sections:
|
1435
1437
|
announcement_bar:
|
@@ -2120,6 +2122,7 @@ en:
|
|
2120
2122
|
translations_for: "%{resource_name} translations"
|
2121
2123
|
tree: Tree
|
2122
2124
|
true_label: 'TRUE'
|
2125
|
+
try_removing_filters: Try removing some filters to see more products
|
2123
2126
|
twitter: Twitter
|
2124
2127
|
type: Type
|
2125
2128
|
type_to_search: Type to search
|
@@ -2141,6 +2144,7 @@ en:
|
|
2141
2144
|
update_contact_information: Update contact information
|
2142
2145
|
update_shipping_address: Update shipping address
|
2143
2146
|
updated: Updated
|
2147
|
+
updated_at: Updated at
|
2144
2148
|
updating: Updating
|
2145
2149
|
upload_image: Upload image
|
2146
2150
|
url: URL
|
@@ -1,6 +1,8 @@
|
|
1
1
|
class BackfillFriendlyIdSlugLocale < ActiveRecord::Migration[6.1]
|
2
2
|
def up
|
3
|
-
|
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
|
@@ -26,6 +26,7 @@ module Spree
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def set_token
|
29
|
+
Spree::Deprecation.warn('set_token is deprecated and will be removed in Spree 5.2. Please use create_token_cookie(token) instead.')
|
29
30
|
cookies.permanent.signed[:token] ||= cookies.signed[:guest_token]
|
30
31
|
cookies.permanent.signed[:token] ||= {
|
31
32
|
value: generate_token,
|
@@ -118,7 +118,8 @@ module Spree
|
|
118
118
|
value: token,
|
119
119
|
expires: 90.days.from_now,
|
120
120
|
secure: Rails.configuration.force_ssl || Rails.application.config.ssl_options[:secure_cookies],
|
121
|
-
domain: current_store.url_or_custom_domain
|
121
|
+
domain: current_store.url_or_custom_domain,
|
122
|
+
httponly: true
|
122
123
|
}
|
123
124
|
end
|
124
125
|
|
data/lib/spree/core/engine.rb
CHANGED
@@ -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
|
data/lib/spree/core/version.rb
CHANGED
@@ -20,7 +20,7 @@ Capybara.register_driver :selenium_chrome_headless do |app|
|
|
20
20
|
options = ::Selenium::WebDriver::Chrome::Options.new
|
21
21
|
options.add_argument '--headless'
|
22
22
|
options.add_argument '--disable-gpu'
|
23
|
-
options.add_argument '--window-size=
|
23
|
+
options.add_argument '--window-size=1440,900'
|
24
24
|
options.add_argument '--disable-search-engine-choice-screen'
|
25
25
|
|
26
26
|
# Disable timers being throttled in background pages/tabs. Useful for parallel test runs.
|
@@ -11,6 +11,10 @@ FactoryBot.define do
|
|
11
11
|
)&.destroy
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
transient do
|
15
|
+
adjust_count_on_hand { true }
|
16
|
+
end
|
17
|
+
|
18
|
+
after(:create) { |object, evaluator| object.adjust_count_on_hand(10) if evaluator.adjust_count_on_hand }
|
15
19
|
end
|
16
20
|
end
|
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.
|
4
|
+
version: 5.0.4
|
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-
|
13
|
+
date: 2025-05-22 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.
|
1311
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v5.0.4
|
1312
1312
|
documentation_uri: https://docs.spreecommerce.org/
|
1313
|
-
source_code_uri: https://github.com/spree/spree/tree/v5.0.
|
1313
|
+
source_code_uri: https://github.com/spree/spree/tree/v5.0.4
|
1314
1314
|
post_install_message:
|
1315
1315
|
rdoc_options: []
|
1316
1316
|
require_paths:
|