spree_storefront 5.3.5 → 5.4.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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +17 -9
  3. data/README.md +2 -0
  4. data/Rakefile +15 -8
  5. data/app/controllers/spree/account/orders_controller.rb +1 -1
  6. data/app/controllers/spree/addresses_controller.rb +1 -1
  7. data/app/controllers/spree/line_items_controller.rb +1 -1
  8. data/app/controllers/spree/orders_controller.rb +1 -1
  9. data/app/controllers/spree/store_controller.rb +3 -2
  10. data/app/finders/spree/storefront/variant_finder.rb +2 -2
  11. data/app/helpers/spree/cart_helper.rb +1 -1
  12. data/app/helpers/spree/filters_helper.rb +2 -2
  13. data/app/helpers/spree/page_helper.rb +5 -1
  14. data/app/helpers/spree/products_helper.rb +4 -4
  15. data/app/helpers/spree/storefront_helper.rb +1 -1
  16. data/app/helpers/spree/turbo_helper.rb +4 -2
  17. data/app/views/spree/admin/shared/_page_section_image.html.erb +4 -0
  18. data/app/views/spree/admin/shared/_page_section_logo.html.erb +1 -0
  19. data/app/views/spree/admin/stores/form/_checkout.html.erb +49 -0
  20. data/app/views/spree/admin/stores/form/_checkout_links.html.erb +28 -0
  21. data/app/views/spree/checkout/_line_item.html.erb +1 -1
  22. data/app/views/spree/checkout/_payment_methods.html.erb +14 -12
  23. data/app/views/themes/default/spree/orders/_line_item.html.erb +1 -1
  24. data/app/views/themes/default/spree/products/_color_swatches.html.erb +2 -2
  25. data/app/views/themes/default/spree/products/_details.html.erb +3 -3
  26. data/app/views/themes/default/spree/products/_featured_image.html.erb +2 -2
  27. data/app/views/themes/default/spree/products/_filters.html.erb +1 -1
  28. data/app/views/themes/default/spree/products/_json_ld.html.erb +1 -1
  29. data/app/views/themes/default/spree/products/_variant_options.html.erb +1 -1
  30. data/app/views/themes/default/spree/products/_variant_picker.html.erb +1 -1
  31. data/app/views/themes/default/spree/shared/_line_item_options.html.erb +2 -2
  32. data/app/views/themes/default/spree/shared/_order_line_item.html.erb +1 -1
  33. data/config/locales/en.yml +23 -0
  34. data/lib/spree/storefront/engine.rb +6 -0
  35. metadata +26 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 798daa308afdbd8f2f636114c013744bafec9dad364624d494052f8dee209dad
4
- data.tar.gz: 3e47218e8e1f56dcd14f42c3a840d5768f57ecb34e4173ba2dcf0534b8f4465c
3
+ metadata.gz: e4f4278e4de4bbae1edaebfb19c6f5aaa3d9715a460435997521404c55777ec0
4
+ data.tar.gz: fa94ea40e743864d935d550e178a710fa6aad34b264efdfe9faaa3bb85e7cbb1
5
5
  SHA512:
6
- metadata.gz: 0ad7a112edd84357b63afb788dae88ea515e173c473b4050751382f42959d1585324a9e2ae8c321b7a63f735f7d3cedf7f0e0062c5c925f69a1f4b33fb4bbe4c
7
- data.tar.gz: 1c3b513f445d85021a4b75db0e52c49ab117ac07421b79578627c02f2b9c552da50484716dea20572974b3cdb17e97cef8163fa5527c65e1f1950959af2249d6
6
+ metadata.gz: 2e01ff11030ec87b69fbc6f6c265d8a446dd5b4f6b5f085a5d7ce80a275cc13a02f127f138f85c5cad96b793ada8cdb6e4077a0e52c5f643e33c5c90306d7407
7
+ data.tar.gz: e9d6530f6e12c1646558028f2bdec15cca750bec1dcc4385840aa78af00cffdd97cf6c43476c574fef4192a8625a1322bae757be4ec3b547cdea07ed2fccd585
data/LICENSE.md CHANGED
@@ -1,13 +1,21 @@
1
- # License
1
+ The MIT License (MIT)
2
2
 
3
- Copyright © 2024-present, Vendo Connect Inc.
3
+ Copyright (c) 2024-present Vendo Connect Inc., Vendo Sp z o.o.
4
4
 
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
6
11
 
7
- This program is distributed in the hope that it will be useful,
8
- but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- GNU Affero General Public License for more details.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
11
14
 
12
- You should have received a copy of the GNU Affero General Public License
13
- along with this program. If not, see [https://www.gnu.org/licenses/](https://www.gnu.org/licenses/).
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  Spree Storefront provides a modern, fully-featured Rails-based storefront for Spree Commerce with a responsive design and optimized shopping experience.
6
6
 
7
+ ![Spree Storefront](storefront.png)
8
+
7
9
  ## Overview
8
10
 
9
11
  This gem includes:
data/Rakefile CHANGED
@@ -1,23 +1,30 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/testtask'
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
4
  require 'rspec/core/rake_task'
5
- require 'spree/testing_support/common_rake'
5
+ require 'spree/testing_support/extension_rake'
6
6
 
7
7
  RSpec::Core::RakeTask.new
8
8
 
9
- task default: :spec
9
+ task :default do
10
+ if Dir['spec/dummy'].empty?
11
+ Rake::Task[:test_app].invoke
12
+ Dir.chdir('../../')
13
+ end
14
+ Rake::Task[:spec].invoke
15
+ end
10
16
 
11
- desc "Generates a dummy app for testing"
17
+ desc 'Generates a dummy app for testing'
12
18
  task :test_app do
13
19
  ENV['LIB_NAME'] = 'spree/storefront'
14
-
15
- Rake::Task['common:test_app'].execute(
20
+ Rake::Task['extension:test_app'].execute(
16
21
  user_class: 'Spree::User',
17
22
  admin_user_class: 'Spree::AdminUser',
18
23
  authentication: 'devise',
19
24
  install_admin: true,
25
+ install_storefront: true,
20
26
  css: true,
21
27
  javascript: true
22
28
  )
29
+ system({ 'BUNDLE_GEMFILE' => File.expand_path('Gemfile', __dir__) }, 'bundle exec rails g spree_posts:install')
23
30
  end
@@ -30,7 +30,7 @@ module Spree
30
30
  end
31
31
 
32
32
  def load_order_details
33
- @order = orders_scope.find_by!(number: params[:id])
33
+ @order = order_finder.new(user: try_spree_current_user, store: current_store, param: params[:id]).execute.first!
34
34
  @shipments = @order.shipments.includes(:stock_location, :address, selected_shipping_rate: :shipping_method, inventory_units: :line_item)
35
35
  end
36
36
  end
@@ -105,7 +105,7 @@ module Spree
105
105
  @address ||= if [:new, :create].include?(action)
106
106
  Spree::Address.new(country: current_store.default_country, user: try_spree_current_user)
107
107
  else
108
- Spree::Address.find(params[:id])
108
+ Spree::Address.find_by_param!(params[:id])
109
109
  end
110
110
 
111
111
  authorize! action, @address
@@ -81,7 +81,7 @@ module Spree
81
81
  end
82
82
 
83
83
  def load_line_item
84
- @line_item = @order.line_items.find(params[:id])
84
+ @line_item = @order.line_items.find_by_param!(params[:id])
85
85
  end
86
86
 
87
87
  def line_item_params
@@ -16,7 +16,7 @@ module Spree
16
16
 
17
17
  # GET /orders/:id
18
18
  def show
19
- @order = complete_order_finder.new(number: params[:id], token: params[:token], store: current_store).execute.first
19
+ @order = complete_order_finder.new(param: params[:id], token: params[:token], store: current_store).execute.first
20
20
 
21
21
  raise ActiveRecord::RecordNotFound if @order.blank?
22
22
 
@@ -184,9 +184,10 @@ module Spree
184
184
  # These includes are not picked automatically by ar_lazy_preload gem so we need to specify them manually.
185
185
  def storefront_products_includes
186
186
  {
187
+ primary_media: [attachment_attachment: :blob],
187
188
  taxons: [],
188
- master: [:images, :prices, { stock_items: :stock_location }],
189
- variants: [:images, :prices, { stock_items: :stock_location }]
189
+ master: [:prices, { stock_items: :stock_location }],
190
+ variants: [:prices, { stock_items: :stock_location }]
190
191
  }
191
192
  end
192
193
 
@@ -48,7 +48,7 @@ module Spree
48
48
  variant = @product.variants.find(variant_id)
49
49
  @variant_from_options = variant
50
50
  @selected_variant = variant
51
- elsif product_option_types.size == 1 && product_option_types.first.color?
51
+ elsif product_option_types.size == 1 && product_option_types.first.color_swatch?
52
52
  @selected_variant = @variant_from_options = @product.variants.find { |v| v.purchasable? && v.price_in(current_currency).amount.present? }
53
53
  elsif @product.variants.size == 1 || product_has_only_one_secondary_option_type_value?
54
54
  @variant_from_options = @product.variants.first
@@ -64,7 +64,7 @@ module Spree
64
64
 
65
65
  def product_has_only_one_secondary_option_type_value?
66
66
  return false unless product_option_types.size == 2
67
- return false unless product_option_types.first.color?
67
+ return false unless product_option_types.first.color_swatch?
68
68
 
69
69
  @product.
70
70
  option_values.
@@ -31,7 +31,7 @@ module Spree
31
31
  @color_options_style_for_line_items = begin
32
32
  colors = line_items.map(&:variant).map do |v|
33
33
  color_option_values = v.option_values.includes(:option_type).find_all do |ov|
34
- ov.option_type.color?
34
+ ov.option_type.color_swatch?
35
35
  end
36
36
 
37
37
  color_option_values.map do |ov|
@@ -26,7 +26,7 @@ module Spree
26
26
  def product_filters_aggregations
27
27
  @product_filters_aggregations ||= Rails.cache.fetch(["product-filters-aggregations", storefront_products_for_filters.cache_key_with_version], expires_in: 1.day) do
28
28
  storefront_products_for_filters.
29
- joins(variants_including_master: :option_values).
29
+ joins(variants: :option_values).
30
30
  group("#{Spree::OptionValue.table_name}.id").
31
31
  distinct.
32
32
  count
@@ -36,7 +36,7 @@ module Spree
36
36
  def product_single_filter_aggregations
37
37
  @product_single_filter_aggregations ||= Rails.cache.fetch(["product-single-filter-aggregations", default_storefront_products_for_filters.cache_key_with_version], expires_in: 1.day) do
38
38
  default_storefront_products_for_filters.
39
- joins(variants_including_master: :option_values).
39
+ joins(variants: :option_values).
40
40
  group("#{Spree::OptionValue.table_name}.id").
41
41
  distinct.
42
42
  count
@@ -28,6 +28,9 @@ module Spree
28
28
  def render_section(section, variables = {}, lazy_allowed: true)
29
29
  return '' if section.blank?
30
30
 
31
+ hidden = section.can_be_hidden? && !section.preferred_visible
32
+ return '' if hidden && !page_builder_enabled?
33
+
31
34
  variables[:section] = section
32
35
  variables[:loaded] = true
33
36
 
@@ -41,7 +44,8 @@ module Spree
41
44
  editor_id: css_id,
42
45
  editor_name: section.name,
43
46
  editor_link: spree.edit_admin_page_section_path(section)
44
- }
47
+ },
48
+ style: (hidden ? 'opacity: 0.4;' : nil)
45
49
  ) do
46
50
  render('/' + section.to_partial_path, **variables)
47
51
  end
@@ -82,9 +82,9 @@ module Spree
82
82
  selected_variant.option_values.find { |ov| ov.option_type_id == option_type.id }
83
83
  elsif product_selected_options_hash.present? && product_selected_options_hash[option_type.id.to_s].present? # user selected variant which is not available
84
84
  option_type.option_values.find { |v| v.name == product_selected_options_hash[option_type.id.to_s] }
85
- elsif option_type.color? && (available_variant = product.first_available_variant(current_currency))
85
+ elsif option_type.color_swatch? && (available_variant = product.first_available_variant(current_currency))
86
86
  available_variant.option_values.find { |ov| ov.option_type_id == option_type.id }
87
- elsif option_type.color? && product.first_available_variant(current_currency).nil?
87
+ elsif option_type.color_swatch? && product.first_available_variant(current_currency).nil?
88
88
  product.variants.first&.option_values&.find { |ov| ov.option_type_id == option_type.id }
89
89
  end
90
90
  end
@@ -112,7 +112,7 @@ module Spree
112
112
  end
113
113
 
114
114
  images << product.master&.images&.to_a
115
- images << product.default_image if images.flatten.compact.empty?
115
+ images << product.primary_media if images.flatten.compact.empty?
116
116
 
117
117
  images.flatten.compact.uniq(&:id)
118
118
  end
@@ -226,7 +226,7 @@ module Spree
226
226
  end
227
227
 
228
228
  def option_type_colors_preview_styles(option_type)
229
- return unless option_type.color?
229
+ return unless option_type.color_swatch?
230
230
 
231
231
  Spree::ColorsPreviewStylesPresenter.new(option_type.option_values.map { |ov| { name: ov.name, filter_name: ov.name } }).to_s
232
232
  end
@@ -60,7 +60,7 @@ module Spree
60
60
  return @page_image if @page_image.present?
61
61
 
62
62
  if object.is_a? Spree::Product
63
- @page_image = object.default_image&.attachment
63
+ @page_image = object.primary_media&.attachment
64
64
  elsif object.respond_to?(:image)
65
65
  @page_image = object.image
66
66
  end
@@ -1,8 +1,10 @@
1
1
  module Spree
2
2
  module TurboHelper
3
3
  def spree_turbo_update_flashes
4
- turbo_stream.update 'flash' do
5
- render 'spree/shared/flashes'
4
+ turbo_stream.update 'flashes' do
5
+ flash.map do |key, value|
6
+ render partial: 'spree/shared/flash', locals: { key: key, value: value, for_template: false }
7
+ end.join.html_safe
6
8
  end
7
9
  end
8
10
 
@@ -0,0 +1,4 @@
1
+ <%= f.spree_file_field :asset, width: 400, height: 128, auto_submit: true, label: Spree.t(:image) %>
2
+ <% if f.object.has_preference?(:image_alt) %>
3
+ <%= f.spree_text_field :preferred_image_alt, label: Spree.t(:alt_text), data: { action: 'auto-submit#submit' } %>
4
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= f.spree_file_field :asset, width: 400, height: 128, auto_submit: true, label: Spree.t(:logo) %>
@@ -0,0 +1,49 @@
1
+ <%= content_for(:page_title) do %>
2
+ <%= Spree.t(:checkout) %> <%= Spree.t(:settings) %>
3
+ <% end %>
4
+
5
+ <div class="card mb-6">
6
+ <div class="card-header">
7
+ <h5 class="card-title"><%= Spree.t(:settings) %></h5>
8
+ </div>
9
+
10
+ <div class="card-body">
11
+ <p class="text-muted mb-4">
12
+ <%= Spree.t('admin.checkout_settings.countries_managed_by_markets_html',
13
+ link: link_to(Spree.t('admin.markets.list'), spree.admin_markets_path)).html_safe %>
14
+ </p>
15
+
16
+ <hr class="my-6">
17
+
18
+ <%= f.spree_check_box :preferred_guest_checkout, label: Spree.t('admin.checkout_settings.guest_checkout.label'), help: Spree.t('admin.checkout_settings.guest_checkout.description') %>
19
+ <%= f.spree_check_box :preferred_company_field_enabled, label: Spree.t('admin.store_form.company_field.label'), help: Spree.t('admin.store_form.company_field.description') %>
20
+ <%= f.spree_check_box :preferred_special_instructions_enabled, label: Spree.t('admin.checkout_settings.special_instructions.label'), help: Spree.t('admin.checkout_settings.special_instructions.description') %>
21
+ </div>
22
+ </div>
23
+
24
+ <div class="card mb-6">
25
+ <div class="card-header">
26
+ <h5 class="card-title"><%= Spree.t(:checkout_message) %></h5>
27
+ </div>
28
+
29
+ <div class="card-body">
30
+ <%= f.spree_rich_text_area :checkout_message, label: false, help: Spree.t('admin.checkout_settings.checkout_message_description') %>
31
+ </div>
32
+ </div>
33
+
34
+ <% if current_store.respond_to?(:links) %>
35
+ <div class="card mb-6">
36
+ <div class="card-header">
37
+ <h5 class="card-title"><%= Spree.t('admin.checkout_settings.checkout_links.label') %></h5>
38
+ </div>
39
+
40
+ <div class="card-body">
41
+ <div class="alert alert-info">
42
+ <div>
43
+ <%= Spree.t('admin.checkout_settings.checkout_links.description') %>
44
+ </div>
45
+ </div>
46
+ <%= render 'spree/admin/stores/form/checkout_links' %>
47
+ </div>
48
+ </div>
49
+ <% end %>
@@ -0,0 +1,28 @@
1
+ <div id="checkout_links">
2
+ <% if current_store.links.any? %>
3
+ <ul class="list-group rounded-lg mb-6 border-gray-200"
4
+ data-controller="sortable"
5
+ data-sortable-handle-value=".handle"
6
+ data-sortable-resource-name-value="page_link"
7
+ data-sortable-response-kind-value="turbo-stream">
8
+ <% current_store.links.each do |link| %>
9
+ <li class="list-group-item p-0 hover:bg-gray-25"
10
+ data-sortable-update-url="<%= spree.admin_page_link_path(link, sorting_only: true, format: :turbo_stream) %>"
11
+ >
12
+ <%= turbo_frame_tag spree_dom_id(link), class: 'flex items-center w-full py-2 pl-6 pr-2' do %>
13
+ <%= link_to link.label, spree.edit_admin_page_link_path(link), class: 'block text-gray-900 flex-1 no-underline' %>
14
+ <span class="btn btn-sm handle shadow-none hover:bg-gray-100 px-1 cursor-move ml-4">
15
+ <%= icon 'grip-vertical', class: 'mr-0' %>
16
+ </span>
17
+ <% end %>
18
+ </li>
19
+ <% end %>
20
+ </ul>
21
+ <% else %>
22
+ <p class="text-gray-600 text-center p-12">
23
+ <%= Spree.t(:no_resource_found, resource: Spree::PageLink.model_name.human) %>
24
+ </p>
25
+ <% end %>
26
+
27
+ <%= link_to_with_icon 'plus', Spree.t(:add_link), spree.admin_store_links_path(current_store), class: 'btn btn-primary w-full', data: { turbo_method: :post } %>
28
+ </div>
@@ -3,7 +3,7 @@
3
3
  <span class="rounded-full text-xs text-center font-bold pl-[0.5px] py-1 w-6 text-sidebar-text bg-background absolute -right-2 -top-3">
4
4
  <%= line_item.quantity %>
5
5
  </span>
6
- <% image = line_item.variant.default_image %>
6
+ <% image = line_item.variant.primary_media %>
7
7
  <% if image.present? && image.attached? && image.variable? %>
8
8
  <%= spree_image_tag(image, class: 'rounded-sm border border-default bg-transparent object-cover object-center', loading: :lazy, variant: :mini, width: 64, height: 64) %>
9
9
  <% else %>
@@ -1,10 +1,10 @@
1
1
  <%= turbo_frame_tag :checkout_payment_methods do %>
2
- <% if !@order.payment_required? && @order.using_store_credit? %>
2
+ <% unless @order.payment_required? %>
3
3
  <div class="d-flex flex-column mb-5">
4
4
  <p>
5
5
  <% if @order.respond_to?(:gift_card) && @order.gift_card.present? %>
6
6
  <%= Spree.t('storefront.checkout.gift_card_amount_applied', amount: @order.display_gift_card_total, code: @order.gift_card.code) %>
7
- <% else %>
7
+ <% elsif @order.using_store_credit? %>
8
8
  <%= Spree.t('storefront.checkout.store_credits_amount_applied', amount: @order.display_total_applicable_store_credit.abs) %>
9
9
  <% end %>
10
10
 
@@ -39,13 +39,15 @@
39
39
 
40
40
  <%= render 'spree/checkout/terms_and_conditions' %>
41
41
 
42
- <div class="flex justify-end w-full gap-2">
43
- <button type="submit"
44
- id="checkout-payment-submit"
45
- class="btn-primary w-full lg:w-2/5 font-semibold checkout-content-save-continue-button my-5 !py-4"
46
- >
47
- <%= render 'button_processing', is_hidden: true %>
48
- <%= Spree.t(:pay) %>
49
- </button>
50
- </div>
51
- <% end %>
42
+ <% if @order.payment_required? %>
43
+ <div class="flex justify-end w-full gap-2">
44
+ <button type="submit"
45
+ id="checkout-payment-submit"
46
+ class="btn-primary w-full lg:w-2/5 font-semibold checkout-content-save-continue-button my-5 !py-4"
47
+ >
48
+ <%= render 'button_processing', is_hidden: true %>
49
+ <%= Spree.t(:pay) %>
50
+ </button>
51
+ </div>
52
+ <% end %>
53
+ <% end %>
@@ -2,7 +2,7 @@
2
2
  <li class="cart-line-item flex items-top py-6 px-4 w-full">
3
3
  <div class="line-item-overlay"></div>
4
4
  <div class="cart-product-image shrink-0" id="<%= dom_id(line_item) %>-image" data-turbo-permanent>
5
- <% image = line_item.variant.default_image %>
5
+ <% image = line_item.variant.primary_media %>
6
6
  <% if image.present? && image.attached? && image.variable? %>
7
7
  <%= link_to spree_storefront_resource_url(line_item.product), data: { 'turbo-frame': '_top' } do %>
8
8
  <%= spree_image_tag(image, width: 128, height: 128, variant: :small, class: 'object-cover', loading: :lazy) %>
@@ -1,4 +1,4 @@
1
- <% color_option = product.option_types.find { |option_type| option_type.color? } %>
1
+ <% color_option = product.option_types.find { |option_type| option_type.color_swatch? } %>
2
2
  <% variants_with_color = product.variants.find_all { |variant| variant.option_values.find { |ov| ov.option_type_id == color_option.id } } if color_option.present? %>
3
3
 
4
4
  <% if color_option.present? && variants_with_color.length > 0 %>
@@ -31,7 +31,7 @@
31
31
  color_preview_container_class: "lg:w-[28px] lg:h-[28px]",
32
32
  color_preview_class: "lg:top-[2px] lg:left-[2px]" %>
33
33
  <% end %>
34
- <% if selected_variant.has_images? || selected_variant.default_image.present? %>
34
+ <% if selected_variant.has_images? || selected_variant.primary_media.present? %>
35
35
  <template data-featured-image-template>
36
36
  <%= render 'spree/products/featured_image',
37
37
  object: selected_variant %>
@@ -26,15 +26,15 @@
26
26
  </div>
27
27
  <% end %>
28
28
 
29
- <% shipping_policy = current_store.customer_shipping_policy %>
30
- <% if shipping_policy.present? %>
29
+ <% shipping_policy = current_store.policies.find_by(slug: 'shipping-policy') %>
30
+ <% if shipping_policy&.with_body? %>
31
31
  <div class="product-property py-4 border-b border-default">
32
32
  <%= link_to "#property_shipping_policy", class: 'text-sm uppercase tracking-widest inline-flex w-full justify-between !border-b-transparent', data: { action: 'accordion#toggle' } do %>
33
33
  <%= Spree.t(:shipping_policy) %>
34
34
  <%= render 'spree/shared/icons/chevron_down' %>
35
35
  <% end %>
36
36
  <div class="text-sm st-accordion__content" data-accordion-id="property_shipping_policy">
37
- <div class="pt-4"><%= shipping_policy %></div>
37
+ <div class="pt-4"><%= shipping_policy.body %></div>
38
38
  </div>
39
39
  </div>
40
40
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <% with_cover_image ||= true %>
2
2
  <% object ||= product %>
3
3
 
4
- <% if object.default_image.present? && object.default_image.attached? %>
4
+ <% if object.primary_media.present? && object.primary_media.attached? %>
5
5
  <% height ||= theme_setting('product_listing_image_height') %>
6
6
  <% width ||= theme_setting('product_listing_image_width') %>
7
7
  <figure class="group <%= 'aspect-1' if height == width %> card-product-featured-images-container bg-transparent h-full">
@@ -13,7 +13,7 @@
13
13
  <% image_hover_class = object.secondary_image.present? && object.secondary_image.attached? ?
14
14
  "w-full group-hover:opacity-0 transition-opacity duration-500 z-10 relative h-full bg-background product-card !max-h-full #{object_class}" :
15
15
  "w-full h-full !max-h-full #{object_class}" %>
16
- <%= spree_image_tag(object.default_image, width: width, height: height, variant: :medium, loading: :lazy, alt: "#{object.name} #{Spree.t('storefront.products.primary_image', default: 'primary image')}", class: image_hover_class) %>
16
+ <%= spree_image_tag(object.primary_media, width: width, height: height, variant: :medium, loading: :lazy, alt: "#{object.name} #{Spree.t('storefront.products.primary_image', default: 'primary image')}", class: image_hover_class) %>
17
17
  <% if object.has_images? && object.image_count > 1 && object.secondary_image.present? && object.secondary_image.attached? %>
18
18
  <% secondary_image_class = "w-full absolute top-0 left-0 opacity-100 h-full !max-h-full #{object_class}" %>
19
19
  <%= spree_image_tag(object.secondary_image, width: width, height: height, variant: :medium, loading: :lazy, alt: "#{object.name} #{Spree.t('storefront.products.secondary_image', default: 'secondary image')}", class: secondary_image_class) %>
@@ -24,7 +24,7 @@
24
24
  <% end %>
25
25
 
26
26
  <% Spree::OptionType.filterable.order(:position).includes(:option_values).each do |filter| %>
27
- <% if filter.color? %>
27
+ <% if filter.color_swatch? %>
28
28
  <%= render 'spree/products/filters/colors', filter: filter, f: f %>
29
29
  <% else %>
30
30
  <%= render 'spree/products/filters/generic', filter: filter, f: f %>
@@ -7,7 +7,7 @@
7
7
  "url": <%= spree.product_url(product, host: current_store.url_or_custom_domain).to_json.html_safe %>,
8
8
  <% if product.has_images? %>
9
9
  "image": [
10
- <%= spree_image_url(product.default_image, variant: :large).to_json.html_safe %>
10
+ <%= spree_image_url(product.primary_media, variant: :large).to_json.html_safe %>
11
11
  ],
12
12
  <% end %>
13
13
  <% if product.description.present? %>
@@ -31,7 +31,7 @@
31
31
  <% end %>
32
32
  <% end %>
33
33
  <% end %>
34
- <% if option_type.color? %>
34
+ <% if option_type.color_swatch? %>
35
35
  <li role="option" aria-label="<%= value.presentation %>">
36
36
  <label class="cursor-pointer" aria-label="<%= value.presentation %>">
37
37
  <%= radio_button_tag option_type.presentation, value.name, selected_option == value,
@@ -3,7 +3,7 @@
3
3
  <div id='product-variant-picker' class="flex flex-col gap-y-4 mb-4 mt-2">
4
4
  <% product.option_types.each_with_index do |option_type, index| %>
5
5
  <% selected_option = product_selected_option_for_option(option_type, product: product, selected_variant: selected_variant, options_param_name: options_param_name) %>
6
- <% if option_type.color? %>
6
+ <% if option_type.color_swatch? %>
7
7
  <%= option_type_colors_preview_styles(option_type).html_safe %>
8
8
  <fieldset data-option-id="<%= option_type.id %>" class="flex flex-col gap-y-2">
9
9
  <span class="text-sm leading-4 uppercase tracking-widest"><%= option_type.presentation %>: <%= selected_option.presentation %></span>
@@ -1,6 +1,6 @@
1
1
  <% options = line_item.variant.option_values %>
2
2
 
3
- <% options.select { |ov| ov.option_type.color? }.each do |option| %>
3
+ <% options.select { |ov| ov.option_type.color_swatch? }.each do |option| %>
4
4
  <div>
5
5
  <input class="hidden color-input" value="<%= option.name %>" >
6
6
  <div class="label-container h-[30px] border border-default p-0.5 inline-flex items-center hover:border-dashed hover:border-primary">
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  </div>
13
13
  <% end %>
14
- <% options.reject { |ov| ov.option_type.color? }.each do |option| %>
14
+ <% options.reject { |ov| ov.option_type.color_swatch? }.each do |option| %>
15
15
  <div>
16
16
  <div class="h-[30px] border border-default px-2 inline-flex items-center hover:border-dashed hover:border-primary text-sm">
17
17
  <%= option.presentation %>
@@ -3,7 +3,7 @@
3
3
  <div class="flex flex-col gap-4">
4
4
  <div class="flex gap-4">
5
5
  <div class="shrink-0">
6
- <% image = line_item.variant.default_image %>
6
+ <% image = line_item.variant.primary_media %>
7
7
  <% if image.present? && image.attached? && image.variable? %>
8
8
  <%= link_to spree_storefront_resource_url(line_item.product, relative: true) do %>
9
9
  <%= spree_image_tag(image, width: 128, height: 128, variant: :small, loading: :lazy) %>
@@ -1,6 +1,29 @@
1
1
  ---
2
2
  en:
3
3
  spree:
4
+ admin:
5
+ checkout_settings:
6
+ checkout_links:
7
+ description: Links to these pages will be displayed in the checkout footer.
8
+ label: Checkout links
9
+ checkout_message_description: Visible to your customers on the checkout page in the right sidebar.
10
+ countries_managed_by_markets_html: Countries and shipping zones are managed through %{link}.
11
+ guest_checkout:
12
+ description: Allow customers to checkout without creating an account.
13
+ label: Allow guest checkout
14
+ special_instructions:
15
+ description: Allow customers to add special instructions to their order.
16
+ label: Display the special instructions field
17
+ markets:
18
+ list: Markets
19
+ store_form:
20
+ company_field:
21
+ description: It shows the company field on the address form in the My Account section and on the checkout address step.
22
+ label: Display the company address field
23
+ all_posts: All Posts
24
+ all_posts_with_tag: All Posts tagged with %{tag}
25
+ blog: Blog
26
+ order_already_updated: The order has already been updated.
4
27
  storefront:
5
28
  account:
6
29
  change_password: Change password
@@ -45,6 +45,12 @@ module Spree
45
45
  ENV['SPREE_STOREFRONT_PATH'] = root.to_s
46
46
  end
47
47
 
48
+ config.to_prepare do
49
+ Dir.glob(File.join(Spree::Storefront::Engine.root, 'app/**/*_decorator*.rb')) do |c|
50
+ Rails.configuration.cache_classes ? require(c) : load(c)
51
+ end
52
+ end
53
+
48
54
  config.after_initialize do
49
55
  Rails.application.config.spree_storefront.head_partials = []
50
56
  Rails.application.config.spree_storefront.body_start_partials = []
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_storefront
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.5
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vendo Connect Inc.
@@ -9,34 +9,20 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: spree
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - ">="
17
- - !ruby/object:Gem::Version
18
- version: 5.3.5
19
- type: :runtime
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: 5.3.5
26
12
  - !ruby/object:Gem::Dependency
27
13
  name: spree_page_builder
28
14
  requirement: !ruby/object:Gem::Requirement
29
15
  requirements:
30
16
  - - ">="
31
17
  - !ruby/object:Gem::Version
32
- version: 5.3.5
18
+ version: 5.4.0
33
19
  type: :runtime
34
20
  prerelease: false
35
21
  version_requirements: !ruby/object:Gem::Requirement
36
22
  requirements:
37
23
  - - ">="
38
24
  - !ruby/object:Gem::Version
39
- version: 5.3.5
25
+ version: 5.4.0
40
26
  - !ruby/object:Gem::Dependency
41
27
  name: active_link_to
42
28
  requirement: !ruby/object:Gem::Requirement
@@ -191,6 +177,20 @@ dependencies:
191
177
  - - "~>"
192
178
  - !ruby/object:Gem::Version
193
179
  version: '43.0'
180
+ - !ruby/object:Gem::Dependency
181
+ name: spree_dev_tools
182
+ requirement: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ type: :development
188
+ prerelease: false
189
+ version_requirements: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
194
  description: Modern fully featured storefront and checkout for Spree Commerce
195
195
  email: hello@spreecommerce.org
196
196
  executables: []
@@ -312,6 +312,10 @@ files:
312
312
  - app/views/spree/addresses/destroy.turbo_stream.erb
313
313
  - app/views/spree/addresses/edit.html.erb
314
314
  - app/views/spree/addresses/new.html.erb
315
+ - app/views/spree/admin/shared/_page_section_image.html.erb
316
+ - app/views/spree/admin/shared/_page_section_logo.html.erb
317
+ - app/views/spree/admin/stores/form/_checkout.html.erb
318
+ - app/views/spree/admin/stores/form/_checkout_links.html.erb
315
319
  - app/views/spree/checkout/_address.html.erb
316
320
  - app/views/spree/checkout/_address_list_item.html.erb
317
321
  - app/views/spree/checkout/_button_processing.html.erb
@@ -585,12 +589,12 @@ files:
585
589
  - vendor/javascript/swiper--bundle.js
586
590
  homepage: https://getvendo.com
587
591
  licenses:
588
- - AGPL-3.0-or-later
592
+ - MIT
589
593
  metadata:
590
- bug_tracker_uri: https://github.com/spree/spree/issues
591
- changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.5
594
+ bug_tracker_uri: https://github.com/spree/spree-rails-storefront/issues
595
+ changelog_uri: https://github.com/spree/spree-rails-storefront/releases/tag/v5.4.0
592
596
  documentation_uri: https://docs.spreecommerce.org/
593
- source_code_uri: https://github.com/spree/spree/tree/v5.3.5
597
+ source_code_uri: https://github.com/spree/spree-rails-storefront/tree/v5.4.0
594
598
  rdoc_options: []
595
599
  require_paths:
596
600
  - lib
@@ -605,7 +609,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
605
609
  - !ruby/object:Gem::Version
606
610
  version: '0'
607
611
  requirements: []
608
- rubygems_version: 4.0.3
612
+ rubygems_version: 4.0.2
609
613
  specification_version: 4
610
614
  summary: Modern fully featured storefront and checkout for Spree Commerce
611
615
  test_files: []