spree_frontend 4.4.0 → 4.5.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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +18 -17
  3. data/.eslintrc +1 -1
  4. data/Gemfile +4 -8
  5. data/README.md +55 -2
  6. data/app/assets/config/spree_frontend_manifest.js +1 -0
  7. data/app/assets/javascripts/spree/{api → frontend/api}/main.js +4 -4
  8. data/app/assets/javascripts/spree/{api → frontend/api}/storefront/cart.js +1 -1
  9. data/app/assets/javascripts/spree/frontend/checkout/address.js +3 -3
  10. data/app/assets/javascripts/spree/frontend/currency.js +6 -7
  11. data/app/assets/javascripts/spree/frontend/locale.es6 +1 -2
  12. data/app/assets/javascripts/{spree.js → spree/frontend/main.js} +5 -5
  13. data/app/assets/javascripts/spree/frontend/{turbolinks_scroll_fix.js → turbo_scroll_fix.js} +3 -3
  14. data/app/assets/javascripts/spree/frontend/views/spree/home/product_carousels.js +1 -1
  15. data/app/assets/javascripts/spree/frontend/views/spree/product/related.js +1 -1
  16. data/app/assets/javascripts/spree/frontend/views/spree/products/cart_form.js +8 -8
  17. data/app/assets/javascripts/spree/frontend/views/spree/products/description.js +1 -1
  18. data/app/assets/javascripts/spree/frontend/views/spree/products/index.js +1 -1
  19. data/app/assets/javascripts/spree/frontend/views/spree/shared/mobile_navigation.js +4 -4
  20. data/app/assets/javascripts/spree/frontend/views/spree/shared/variant_select.js +3 -3
  21. data/app/assets/javascripts/spree/frontend.js +10 -17
  22. data/app/controllers/spree/addresses_controller.rb +2 -2
  23. data/app/controllers/spree/checkout_controller.rb +2 -2
  24. data/app/controllers/spree/locale_controller.rb +2 -1
  25. data/app/controllers/spree/orders_controller.rb +1 -1
  26. data/app/helpers/spree/frontend_helper.rb +14 -8
  27. data/app/helpers/spree/navigation_helper.rb +1 -1
  28. data/app/helpers/spree/products_filters_helper.rb +1 -1
  29. data/app/views/spree/checkout/edit.html.erb +1 -1
  30. data/app/views/spree/checkout/registration.html.erb +1 -1
  31. data/app/views/spree/orders/_line_item.html.erb +1 -1
  32. data/app/views/spree/orders/_line_item_data.html.erb +1 -1
  33. data/app/views/spree/products/_color_option_type.html.erb +2 -2
  34. data/app/views/spree/products/_filters_desktop.html.erb +3 -3
  35. data/app/views/spree/products/_filters_mobile.html.erb +2 -2
  36. data/app/views/spree/products/_thumbnails.html.erb +2 -2
  37. data/app/views/spree/shared/_head.html.erb +3 -2
  38. data/app/views/spree/shared/_line_item.html.erb +1 -1
  39. data/app/views/spree/shared/_link_to_account.html.erb +1 -1
  40. data/app/views/spree/shared/_login.html.erb +1 -1
  41. data/app/views/spree/shared/_main_nav_bar.html.erb +1 -1
  42. data/app/views/spree/shared/_nav_bar.html.erb +1 -1
  43. data/app/views/spree/shared/_order_details.html.erb +1 -1
  44. data/app/views/spree/shared/_translations.html.erb +1 -1
  45. data/app/views/spree/shared/carousel/_single.html.erb +2 -2
  46. data/app/views/spree/shared/carousel/_thumbnails.html.erb +1 -1
  47. data/app/views/spree/shared/cms/sections/_hero_image.html.erb +9 -9
  48. data/app/views/spree/shared/cms/sections/_image_gallery.html.erb +21 -21
  49. data/app/views/spree/shared/cms/sections/_side_by_side_images.html.erb +14 -14
  50. data/app/views/spree/taxons/_header.html.erb +1 -1
  51. data/app/views/spree/users/_address_controls.html.erb +1 -1
  52. data/lib/generators/spree/frontend/install/install_generator.rb +1 -1
  53. data/lib/spree/frontend/configuration.rb +18 -0
  54. data/lib/spree/frontend/engine.rb +3 -8
  55. data/lib/spree/frontend/version.rb +1 -1
  56. data/lib/spree/frontend.rb +2 -1
  57. data/spree_frontend.gemspec +3 -2
  58. metadata +35 -21
  59. data/app/models/spree/frontend_configuration.rb +0 -16
@@ -27,10 +27,11 @@ module Spree
27
27
  private
28
28
 
29
29
  def should_build_new_url?
30
+ return false if request.env['HTTP_REFERER'].blank?
30
31
  if request.env['HTTP_REFERER'].match(REDIRECT_TO_ROOT)
31
32
  false
32
33
  else
33
- request.env['HTTP_REFERER'].present? && request.env['HTTP_REFERER'] != request.env['REQUEST_URI']
34
+ request.env['HTTP_REFERER'] != request.env['REQUEST_URI']
34
35
  end
35
36
  end
36
37
  end
@@ -25,7 +25,7 @@ module Spree
25
25
  end
26
26
  end
27
27
  else
28
- respond_with(@order)
28
+ respond_with(@order, status: :unprocessable_entity)
29
29
  end
30
30
  end
31
31
 
@@ -9,12 +9,18 @@ module Spree
9
9
  end
10
10
 
11
11
  def logo(image_path = nil, options = {})
12
- image_path ||= if current_store.logo.attached? && current_store.logo.variable?
13
- main_app.url_for(current_store.logo.variant(resize: '244x104>'))
14
- elsif current_store.logo.attached? && current_store.logo.image?
15
- main_app.url_for(current_store.logo)
12
+ logo_attachment = if defined?(Spree::StoreLogo) && current_store.logo.is_a?(Spree::StoreLogo)
13
+ current_store.logo.attachment # Spree v5
14
+ else
15
+ current_store.logo # Spree 4.x
16
+ end
17
+
18
+ image_path ||= if logo_attachment&.attached? && logo_attachment&.variable?
19
+ main_app.cdn_image_url(logo_attachment.variant(resize: '244x104>'))
20
+ elsif logo_attachment&.attached? && logo_attachment&.image?
21
+ main_app.cdn_image_url(current_store.logo)
16
22
  else
17
- 'logo/spree_50.png'
23
+ asset_path('logo/spree_50.png')
18
24
  end
19
25
 
20
26
  path = spree.respond_to?(:root_path) ? spree.root_path : main_app.root_path
@@ -165,7 +171,7 @@ module Spree
165
171
  image = default_image_for_product_or_variant(product)
166
172
 
167
173
  image_url = if image.present?
168
- main_app.url_for(image.url('plp'))
174
+ main_app.cdn_image_url(image.url('plp'))
169
175
  else
170
176
  asset_path('noimage/plp.svg')
171
177
  end
@@ -200,7 +206,7 @@ module Spree
200
206
  widths = { lg: 1200, md: 992, sm: 768, xs: 576 }
201
207
  set = []
202
208
  widths.each do |key, value|
203
- file = main_app.url_for(image.url("plp_and_carousel_#{key}"))
209
+ file = main_app.cdn_image_url(image.url("plp_and_carousel_#{key}"))
204
210
 
205
211
  set << "#{file} #{value}w"
206
212
  end
@@ -352,7 +358,7 @@ module Spree
352
358
  def spree_social_link(service)
353
359
  return '' if current_store.send(service).blank?
354
360
 
355
- link_to "https://#{service}.com/#{current_store.send(service)}", target: :blank, rel: 'nofollow noopener', 'aria-label': service do
361
+ link_to "https://#{service}.com/#{current_store.send(service)}", target: '_blank', rel: 'nofollow noopener', 'aria-label': service do
356
362
  content_tag :figure, id: service, class: 'px-2' do
357
363
  icon(name: service, width: 22, height: 22)
358
364
  end
@@ -67,7 +67,7 @@ module Spree
67
67
  "/#{I18n.locale}"
68
68
  end
69
69
 
70
- if Spree::MenuItem::DYNAMIC_RESOURCE_TYPE.include? item.linked_resource_type
70
+ if ['Spree::Product', 'Spree::Taxon', 'Spree::CmsPage'].include?(item.linked_resource_type)
71
71
  output_locale.to_s + item.link
72
72
  elsif item.linked_resource_type == 'Home Page'
73
73
  "/#{locale_param}"
@@ -67,7 +67,7 @@ module Spree
67
67
  }
68
68
  end
69
69
  else
70
- filter_content_tag(option_value.name, opts.merge(is_selected: is_selected))
70
+ filter_content_tag(option_value.presentation, opts.merge(is_selected: is_selected))
71
71
  end
72
72
  end
73
73
  end
@@ -33,7 +33,7 @@ end
33
33
  </div>
34
34
 
35
35
  <div class="row checkout-content" data-hook="checkout_content">
36
- <%= form_for @order, url: spree.update_checkout_path(@order.state), html: { id: "checkout_form_#{@order.state}", class: "w-100 d-lg-flex align-items-lg-baseline flex-wrap position-relative" } do |form| %>
36
+ <%= form_for @order, url: spree.update_checkout_path(@order.state), html: { id: "checkout_form_#{@order.state}", class: "w-100 d-lg-flex align-items-lg-baseline flex-wrap position-relative", data: { turbo: false } } do |form| %>
37
37
  <div class="<%= if @order.state != 'confirm' then 'col-lg-6' else 'col-md-12' end %>" data-hook="checkout_form_wrapper">
38
38
  <%= form.hidden_field :state_lock_version %>
39
39
  <%= render @order.state, form: form %>
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
  <% path = spree.respond_to?(:update_checkout_registration_path) ? spree.update_checkout_registration_path : spree_signup_path %>
17
17
 
18
- <%= form_for @order, url: path, method: :put, html: { id: 'checkout_form_registration' } do |f| %>
18
+ <%= form_for @order, url: path, method: :put, html: { id: 'checkout_form_registration', data: { turbo: false } } do |f| %>
19
19
  <div class="form-group">
20
20
  <p class="form-group checkout-content-inner-field">
21
21
  <%= f.email_field :email, class: 'spree-flat-input', placeholder: Spree.t(:email) %>
@@ -16,7 +16,7 @@
16
16
  <% variant.option_values.sort { |ov| ov.option_type.position }.each do |ov| %>
17
17
  <li class="item-details">
18
18
  <% # TODO: rework option values so options_text method can be used here %>
19
- <%= "#{ov.option_type.presentation}: #{ov.name.titleize}" %>
19
+ <%= "#{ov.option_type.presentation}: #{ov.presentation}" %>
20
20
  </li>
21
21
  <% end %>
22
22
  </ul>
@@ -22,7 +22,7 @@
22
22
  <% end %>
23
23
 
24
24
  <div class="shopping-cart-item-delete <%= additional_classes %>" data-hook="cart_item_delete">
25
- <%= link_to '#', class: 'delete', id: "delete_#{dom_id(line_item)}", data: { turbolinks: false, id: dom_id(line_item), variant_sku: line_item.sku, variant_name: line_item.name, variant_price: line_item.price, variant_options: line_item.options_text }, aria: { label: Spree.t('cart_page.remove_from_cart') } do %>
25
+ <%= link_to '#', class: 'delete', id: "delete_#{dom_id(line_item)}", data: { turbo: false, id: dom_id(line_item), variant_sku: line_item.sku, variant_name: line_item.name, variant_price: line_item.price, variant_options: line_item.options_text }, aria: { label: Spree.t('cart_page.remove_from_cart') } do %>
26
26
  <%= icon(name: 'garbage',
27
27
  classes: 'shopping-cart-item-delete-icon',
28
28
  width: 18.9,
@@ -9,14 +9,14 @@
9
9
  <li>
10
10
  <%= label_tag "variant_option_value_id_#{option_type[:id]}_#{option_value[:id]}",
11
11
  class: "m-1 m-sm-2 m-md-1 color-select-label",
12
- title: option_value[:name]&.humanize,
12
+ title: option_value[:presentation],
13
13
  data: { toggle: "tooltip", placement: "bottom" } do %>
14
14
 
15
15
  <%= radio_button_tag "variant_option_value_id_#{option_type[:id]}",
16
16
  option_value[:id],
17
17
  option_value[:is_default] && index == 0,
18
18
  class: "product-variants-variant-values-radio",
19
- aria: { label: option_value[:name] },
19
+ aria: { label: option_value[:presentation] },
20
20
  data: {
21
21
  "option-type-index" => index,
22
22
  "presentation" => option_value[:presentation],
@@ -9,7 +9,7 @@
9
9
  <% option_type_name = ot_filter_param.titleize %>
10
10
  <% collapsed = params[ot_filter_param].blank? %>
11
11
 
12
- <button class="card-header <%= 'collapsed' if collapsed %> px-1 plp-filters-card-header" id="filters<%= option_type_name %>" data-toggle="collapse" data-target="#collapseFilter<%= option_type_name %>" aria-expanded="<%= !collapsed %>" aria-controls="collapseFilter<%= option_type_name %>" role="heading" aria-level="2">
12
+ <button class="card-header <%= 'collapsed' if collapsed %> px-1 plp-filters-card-header" id="filters<%= ot_filter_param %>" data-toggle="collapse" data-target="#collapseFilter<%= ot_filter_param %>" aria-expanded="<%= !collapsed %>" aria-controls="collapseFilter<%= ot_filter_param %>" role="heading" aria-level="2">
13
13
  <%= option_type.presentation %>
14
14
  <%= icon(name: 'plus',
15
15
  classes: 'mt-1 float-right arrow plp-filters-card-header-arrow--plus',
@@ -20,7 +20,7 @@
20
20
  width: 16,
21
21
  height: 16) %>
22
22
  </button>
23
- <div id="collapseFilter<%= option_type_name %>" class="collapse <%= 'show' unless collapsed %>" aria-labelledby="filters<%= option_type_name %>">
23
+ <div id="collapseFilter<%= ot_filter_param %>" class="collapse <%= 'show' unless collapsed %>" aria-labelledby="filters<%= ot_filter_param %>">
24
24
  <div class="card-body px-0 pt-1">
25
25
  <%= render 'spree/shared/option_values',
26
26
  option_type: option_type,
@@ -36,7 +36,7 @@
36
36
  <% property_name = property.name %>
37
37
  <% collapsed = params.dig(:properties, property.filter_param).blank? %>
38
38
  <button class="card-header <%= 'collapsed' if collapsed %> px-1 plp-filters-card-header" id="filters<%= property_name %>" data-toggle="collapse" data-target="#collapseFilter<%= property_name %>" aria-expanded="<%= !collapsed %>" aria-controls="collapseFilter<%= property_name %>" role="heading" aria-level="2">
39
- <%= property.presentation.titleize %>
39
+ <%= property.presentation %>
40
40
  <%= icon(name: 'plus',
41
41
  classes: 'mt-1 float-right arrow plp-filters-card-header-arrow--plus',
42
42
  width: 16,
@@ -16,7 +16,7 @@
16
16
 
17
17
  <div class="card plp-overlay-card">
18
18
  <div class="card-header text-uppercase <%= 'collapsed' if params[ot_downcase_name].blank? %> plp-overlay-card-header" data-toggle="collapse" id="filtersMobile<%= option_type_name %>" data-target="#collapseFilterMobile<%= option_type_name %>" aria-expanded="true" aria-controls="collapseFilterMobile<%= option_type_name %>" role="heading" aria-level="3">
19
- <%= option_type_name %>
19
+ <%= option_type.presentation %>
20
20
  <%= icon(name: 'arrow-right',
21
21
  classes: 'spree-icon-arrow spree-icon-arrow-right mt-1 float-right arrow plp-overlay-card-header-arrow',
22
22
  width: 16,
@@ -36,7 +36,7 @@
36
36
  <% collapsed = params.dig(:properties, property.filter_param).blank? %>
37
37
  <div class="card plp-overlay-card">
38
38
  <div class="card-header text-uppercase <%= 'collapsed' if collapsed %> plp-overlay-card-header" data-toggle="collapse" id="filtersMobile<%= property_name %>" data-target="#collapseFilterMobile<%= property_name %>" aria-expanded="true" aria-controls="collapseFilterMobile<%= property_name %>" role="heading" aria-level="3">
39
- <%= property_name %>
39
+ <%= property.presentation %>
40
40
  <%= icon(name: 'arrow-right',
41
41
  classes: 'spree-icon-arrow spree-icon-arrow-right mt-1 float-right arrow plp-overlay-card-header-arrow',
42
42
  width: 16,
@@ -3,7 +3,7 @@
3
3
  <ul id="product-thumbnails" class="thumbnails d-flex w-100 pl-0 my-4" data-hook>
4
4
  <% @product.images.each do |i| %>
5
5
  <li class='tmb-all mr-2 tmb-<%= i.viewable.id %>'>
6
- <%= link_to(image_tag(main_app.url_for(i.url(:mini)), class: "img-thumbnail d-inline-block"), main_app.url_for(i.url(:product))) %>
6
+ <%= link_to(image_tag(main_app.cdn_image_url(i.url(:mini)), class: "img-thumbnail d-inline-block"), main_app.cdn_image_url(i.url(:product))) %>
7
7
  </li>
8
8
  <% end %>
9
9
 
@@ -11,7 +11,7 @@
11
11
  <% @product.variant_images.each do |i| %>
12
12
  <% next if @product.images.include?(i) %>
13
13
  <li class='vtmb mr-2 tmb-<%= i.viewable.id %>'>
14
- <%= link_to(image_tag(main_app.url_for(i.url(:mini)), class: "img-thumbnail"), main_app.url_for(i.url(:product))) %>
14
+ <%= link_to(image_tag(main_app.cdn_image_url(i.url(:mini)), class: "img-thumbnail"), main_app.cdn_image_url(i.url(:product))) %>
15
15
  </li>
16
16
  <% end %>
17
17
  <% end %>
@@ -5,9 +5,10 @@
5
5
  <%== meta_robots %>
6
6
  <%= canonical_tag(current_store.url) %>
7
7
  <%= favicon_link_tag(spree_favicon_path) %>
8
- <%= stylesheet_link_tag 'spree/frontend/all', media: 'screen', 'data-turbolinks-track': 'reload' %>
8
+ <%= stylesheet_link_tag 'spree/frontend/all', media: 'screen', data: { turbo_track: 'reload' } %>
9
9
  <%= csrf_meta_tags %>
10
10
  <%= render 'spree/shared/paths' %>
11
11
  <%= render 'spree/shared/locale_and_currency' %>
12
- <%= javascript_include_tag 'spree/frontend/all', defer: true, 'data-turbolinks-track': 'reload' %>
12
+ <%= javascript_include_tag "application", defer: true, data: { turbo_track: 'reload' } %>
13
+ <%= javascript_include_tag 'spree/frontend/all', defer: true, data: { turbo_track: 'reload' } %>
13
14
  <%= yield :head %>
@@ -8,7 +8,7 @@
8
8
  <% line_item.variant.option_values.sort { |ov| ov.option_type.position }.each do |ov| %>
9
9
  <li>
10
10
  <% # TODO: rework option values so options_text method can be used here %>
11
- <%= "#{ov.option_type.presentation}: #{ov.name.titleize}" %>
11
+ <%= "#{ov.option_type.presentation}: #{ov.presentation}" %>
12
12
  </li>
13
13
  <% end %>
14
14
  </ul>
@@ -1,6 +1,6 @@
1
1
  <% if try_spree_current_user %>
2
2
  <%= link_to Spree.t(:my_account).upcase, spree.account_path, class: 'dropdown-item' if spree.respond_to?(:account_path) %>
3
- <% if spree.respond_to(:admin_orders_path) %>
3
+ <% if spree.respond_to?(:admin_orders_path) %>
4
4
  <%= link_to Spree.t('nav_bar.admin_panel'), spree.admin_orders_path(locale: nil), class: 'dropdown-item text-uppercase' if try_spree_current_user.has_spree_role?(:admin) %>
5
5
  <% end %>
6
6
  <%= link_to Spree.t(:logout).upcase, spree_logout_path, class: 'dropdown-item', method: :get if defined?(spree_logout_path) %>
@@ -1,6 +1,6 @@
1
1
  <div class="col-lg-11 mx-auto">
2
2
  <h3 class="spree-mb-large spree-mt-large spree-header"><%= Spree.t(:log_in_to_continue) %></h3>
3
- <%= form_for Spree.user_class.new, as: :spree_user, url: spree_login_path do |f| %>
3
+ <%= form_for Spree.user_class.new, as: :spree_user, url: spree_login_path, data: { turbo: false } do |f| %>
4
4
  <div id="password-credentials" class="mb-4">
5
5
  <div class="form-group mb-4">
6
6
  <p class="form-group checkout-content-inner-field">
@@ -44,7 +44,7 @@
44
44
  <%= spree_nav_link_tag(promo_banner, { class: "dropdown-item" }) do %>
45
45
  <div class="category-image text-center my-4 mx-3">
46
46
  <% if promo_banner.icon.present? %>
47
- <%= image_tag main_app.url_for(promo_banner.icon.attachment), alt: promo_banner.icon.alt ,title: promo_banner.subtitle %>
47
+ <%= image_tag main_app.cdn_image_url(promo_banner.icon.attachment), alt: promo_banner.icon.alt ,title: promo_banner.subtitle %>
48
48
  <% end %>
49
49
  <div class="category-box">
50
50
  <div class="category-box-small-text">
@@ -1,4 +1,4 @@
1
- <ul id="nav-bar" class="nav align-items-center d-flex flex-nowrap justify-content-end navbar-right" data-turbo-permanent data-turbolinks-permanent>
1
+ <ul id="nav-bar" class="nav align-items-center d-flex flex-nowrap justify-content-end navbar-right" data-turbo-permanent data-turbo-permanent>
2
2
  <li>
3
3
  <div class="navbar-right-search-menu">
4
4
  <button type="button" class="navbar-right-dropdown-toggle search-icons" aria-label="<%= Spree.t('nav_bar.show_search') %>">
@@ -86,7 +86,7 @@
86
86
  <% item.variant.option_values.sort { |ov| ov.option_type.position }.each do |ov| %>
87
87
  <li>
88
88
  <% # TODO: rework option values so options_text method can be used here %>
89
- <%= "#{ov.option_type.presentation}: #{ov.name.titleize}" %>
89
+ <%= "#{ov.option_type.presentation}: #{ov.presentation}" %>
90
90
  </li>
91
91
  <% end %>
92
92
  </ul>
@@ -1,5 +1,5 @@
1
1
  <script>
2
- window.addEventListener('turbolinks:load', function() {
2
+ window.addEventListener('turbo:load', function() {
3
3
  Spree.translations = <%==
4
4
  {
5
5
  coupon_code_applied: Spree.t(:coupon_code_applied),
@@ -47,7 +47,7 @@
47
47
  data-variant-id="<%= image.viewable_id %>">
48
48
  <div class="product-carousel-item-squared <%= 'product-carousel-item-squared-only' if images.length == 1 %>">
49
49
  <% image_attrs = {
50
- src: main_app.url_for(image.url(zoomed ? :zoomed : :large)),
50
+ src: main_app.cdn_image_url(image.url(zoomed ? :zoomed : :large)),
51
51
  alt: image.alt || @product.name,
52
52
  class: "d-block w-100",
53
53
  width: zoomed ? 650 : 475,
@@ -66,7 +66,7 @@
66
66
  data-slide-to="<%= imageIndex %>"
67
67
  class="product-carousel-indicators-indicator product-carousel-indicators-indicator--visible<%= ' active' if imageIndex == 0 %>">
68
68
  <%= lazy_image(
69
- src: main_app.url_for(image.url(:pdp_thumbnail)),
69
+ src: main_app.cdn_image_url(image.url(:pdp_thumbnail)),
70
70
  class: 'd-block w-100',
71
71
  alt: image.alt || @product.name,
72
72
  width: image.style(:pdp_thumbnail)[:width],
@@ -20,7 +20,7 @@
20
20
  data-variant-is-master="<%= image.viewable_id == @product.master.id %>"
21
21
  data-variant-id="<%= image.viewable_id %>">
22
22
  <%= lazy_image(
23
- src: main_app.url_for(image.url(:pdp_thumbnail)),
23
+ src: main_app.cdn_image_url(image.url(:pdp_thumbnail)),
24
24
  class: 'd-block w-100',
25
25
  alt: image.alt || @product.name,
26
26
  width: 57,
@@ -10,30 +10,30 @@
10
10
  <div class="col-12 homepage-hero-image position-relative p-0 <%= section_padding %>">
11
11
 
12
12
  <div class="bg-light" style="--aspect-ratio:12/5;">
13
- <% if section.image_one.attached? %>
13
+ <% if section.image_one&.attachment&.attached? %>
14
14
 
15
15
  <!-- SM to MD -->
16
16
  <img class="d-block d-md-none lazyload"
17
- data-src="<%= main_app.url_for(section.img_one_sm) %>"
18
- data-srcset="<%= main_app.url_for(section.img_one_sm) %>"
17
+ data-src="<%= main_app.cdn_image_url(section.img_one_sm) %>"
18
+ data-srcset="<%= main_app.cdn_image_url(section.img_one_sm) %>"
19
19
  alt="<%= section&.title %>">
20
20
 
21
21
  <!-- MD to LG -->
22
22
  <img class="d-none d-md-block d-lg-none lazyload"
23
- data-src="<%= main_app.url_for(section.img_one_md) %>"
24
- data-srcset="<%= main_app.url_for(section.img_one_md) %>"
23
+ data-src="<%= main_app.cdn_image_url(section.img_one_md) %>"
24
+ data-srcset="<%= main_app.cdn_image_url(section.img_one_md) %>"
25
25
  alt="<%= section&.title %>">
26
26
 
27
27
  <!-- LG to XL -->
28
28
  <img class="d-none d-lg-block d-xl-none lazyload"
29
- data-src="<%= main_app.url_for(section.img_one_lg) %>"
30
- data-srcset="<%= main_app.url_for(section.img_one_lg) %>"
29
+ data-src="<%= main_app.cdn_image_url(section.img_one_lg) %>"
30
+ data-srcset="<%= main_app.cdn_image_url(section.img_one_lg) %>"
31
31
  alt="<%= section&.title %>">
32
32
 
33
33
  <!-- XL UP -->
34
34
  <img class="d-none d-xl-block lazyload"
35
- data-src="<%= main_app.url_for(section.img_one_xl) %>"
36
- data-srcset="<%= main_app.url_for(section.img_one_xl) %>"
35
+ data-src="<%= main_app.cdn_image_url(section.img_one_xl) %>"
36
+ data-srcset="<%= main_app.cdn_image_url(section.img_one_xl) %>"
37
37
  alt="<%= section&.title %>">
38
38
 
39
39
  <% else %>
@@ -64,24 +64,24 @@
64
64
  <div class="col-12">
65
65
 
66
66
  <%= link_to link_one, class: link_one_classes, style: '--aspect-ratio:18/13;' do %>
67
- <% if section.image_one.attached? && section.image_one.variable? %>
67
+ <% if section.image_one&.attachment&.attached? && section.image_one&.attachment&.variable? %>
68
68
 
69
69
  <!-- XS to MD -->
70
70
  <img class="d-md-none lazyload"
71
- data-src="<%= main_app.url_for(section.img_one_md) %>"
72
- data-srcset="<%= main_app.url_for(section.img_one_md) %>"
71
+ data-src="<%= main_app.cdn_image_url(section.img_one_md) %>"
72
+ data-srcset="<%= main_app.cdn_image_url(section.img_one_md) %>"
73
73
  alt="<%= section&.title_one %>">
74
74
 
75
75
  <!-- MD to XL -->
76
76
  <img class="d-none d-md-block d-xl-none lazyload"
77
- data-src="<%= main_app.url_for(section.img_one_lg) %>"
78
- data-srcset="<%= main_app.url_for(section.img_one_lg) %>"
77
+ data-src="<%= main_app.cdn_image_url(section.img_one_lg) %>"
78
+ data-srcset="<%= main_app.cdn_image_url(section.img_one_lg) %>"
79
79
  alt="<%= section&.title_one %>">
80
80
 
81
81
  <!-- XL UP -->
82
82
  <img class="d-none d-xl-block lazyload"
83
- data-src="<%= main_app.url_for(section.img_one_xl) %>"
84
- data-srcset="<%= main_app.url_for(section.img_one_xl) %>"
83
+ data-src="<%= main_app.cdn_image_url(section.img_one_xl) %>"
84
+ data-srcset="<%= main_app.cdn_image_url(section.img_one_xl) %>"
85
85
  alt="<%= section&.title_one %>">
86
86
  <% else %>
87
87
  <%= icon( name: 'card-image',
@@ -102,24 +102,24 @@
102
102
  <div class="col-12">
103
103
 
104
104
  <%= link_to link_three, class: link_three_classes, style: '--aspect-ratio:18/13;' do %>
105
- <% if section.image_three.attached? && section.image_three.variable? %>
105
+ <% if section.image_three&.attachment&.attached? && section.image_three&.attachment&.variable? %>
106
106
 
107
107
  <!-- XS to MD -->
108
108
  <img class="d-md-none lazyload"
109
- data-src="<%= main_app.url_for(section.img_three_md) %>"
110
- data-srcset="<%= main_app.url_for(section.img_three_md) %>"
109
+ data-src="<%= main_app.cdn_image_url(section.img_three_md) %>"
110
+ data-srcset="<%= main_app.cdn_image_url(section.img_three_md) %>"
111
111
  alt="<%= section&.title_three %>">
112
112
 
113
113
  <!-- MD to XL -->
114
114
  <img class="d-none d-md-block d-xl-none lazyload"
115
- data-src="<%= main_app.url_for(section.img_three_lg) %>"
116
- data-srcset="<%= main_app.url_for(section.img_three_lg) %>"
115
+ data-src="<%= main_app.cdn_image_url(section.img_three_lg) %>"
116
+ data-srcset="<%= main_app.cdn_image_url(section.img_three_lg) %>"
117
117
  alt="<%= section&.title_three %>">
118
118
 
119
119
  <!-- XL UP -->
120
120
  <img class="d-none d-xl-block lazyload"
121
- data-src="<%= main_app.url_for(section.img_three_xl) %>"
122
- data-srcset="<%= main_app.url_for(section.img_three_xl) %>"
121
+ data-src="<%= main_app.cdn_image_url(section.img_three_xl) %>"
122
+ data-srcset="<%= main_app.cdn_image_url(section.img_three_xl) %>"
123
123
  alt="<%= section&.title_three %>">
124
124
  <% else %>
125
125
  <%= icon( name: 'card-image',
@@ -139,24 +139,24 @@
139
139
  <!-- Right Block TALL -->
140
140
  <div class="col-6 <%= section_two_padding %>">
141
141
  <%= link_to link_two, class: link_two_classes, style: '--aspect-ratio:27/40;' do %>
142
- <% if section.image_two.attached? && section.image_two.variable? %>
142
+ <% if section.image_two&.attachment&.attached? && section.image_two&.attachment&.variable? %>
143
143
 
144
144
  <!-- XS to MD -->
145
145
  <img class="d-md-none lazyload"
146
- data-src="<%= main_app.url_for(section.img_two_md) %>"
147
- data-srcset="<%= main_app.url_for(section.img_two_md) %>"
146
+ data-src="<%= main_app.cdn_image_url(section.img_two_md) %>"
147
+ data-srcset="<%= main_app.cdn_image_url(section.img_two_md) %>"
148
148
  alt="<%= section&.title_two %>">
149
149
 
150
150
  <!-- MD to XL -->
151
151
  <img class="d-none d-md-block d-xl-none lazyload"
152
- data-src="<%= main_app.url_for(section.img_two_lg) %>"
153
- data-srcset="<%= main_app.url_for(section.img_two_lg) %>"
152
+ data-src="<%= main_app.cdn_image_url(section.img_two_lg) %>"
153
+ data-srcset="<%= main_app.cdn_image_url(section.img_two_lg) %>"
154
154
  alt="<%= section&.title_two %>">
155
155
 
156
156
  <!-- XL UP -->
157
157
  <img class="d-none d-xl-block lazyload"
158
- data-src="<%= main_app.url_for(section.img_two_xl) %>"
159
- data-srcset="<%= main_app.url_for(section.img_two_xl) %>"
158
+ data-src="<%= main_app.cdn_image_url(section.img_two_xl) %>"
159
+ data-srcset="<%= main_app.cdn_image_url(section.img_two_xl) %>"
160
160
  alt="<%= section&.title_two %>">
161
161
  <% else %>
162
162
  <%= icon( name: 'file-image',
@@ -36,23 +36,23 @@
36
36
  class: "d-flex align-items-end justify-content-center bg-light text-center overflow-hidden homepage-bottom-box #{'pointer-events-none cursor-default' unless link_one}",
37
37
  style: '--aspect-ratio:54/35;' do %>
38
38
 
39
- <% if section.image_one.attached? %>
39
+ <% if section.image_one&.attachment&.attached? %>
40
40
  <!-- XS to MD -->
41
41
  <img class="d-md-none lazyload"
42
- data-src="<%= main_app.url_for(section.img_one_md) %>"
43
- data-srcset="<%= main_app.url_for(section.img_one_md) %>"
42
+ data-src="<%= main_app.cdn_image_url(section.img_one_md) %>"
43
+ data-srcset="<%= main_app.cdn_image_url(section.img_one_md) %>"
44
44
  alt="<%= section&.title_one %>">
45
45
 
46
46
  <!-- MD to XL -->
47
47
  <img class="d-none d-md-block d-xl-none lazyload"
48
- data-src="<%= main_app.url_for(section.img_one_lg) %>"
49
- data-srcset="<%= main_app.url_for(section.img_one_lg) %>"
48
+ data-src="<%= main_app.cdn_image_url(section.img_one_lg) %>"
49
+ data-srcset="<%= main_app.cdn_image_url(section.img_one_lg) %>"
50
50
  alt="<%= section&.title_one %>">
51
51
 
52
52
  <!-- XL UP -->
53
53
  <img class="d-none d-xl-block lazyload"
54
- data-src="<%= main_app.url_for(section.img_one_xl) %>"
55
- data-srcset="<%= main_app.url_for(section.img_one_xl) %>"
54
+ data-src="<%= main_app.cdn_image_url(section.img_one_xl) %>"
55
+ data-srcset="<%= main_app.cdn_image_url(section.img_one_xl) %>"
56
56
  alt="<%= section&.title_one %>">
57
57
  <% else %>
58
58
  <%= icon( name: 'card-image',
@@ -79,23 +79,23 @@
79
79
  class: "d-flex align-items-end justify-content-center bg-light text-center overflow-hidden homepage-bottom-box #{'pointer-events-none cursor-default' unless link_two}",
80
80
  style: '--aspect-ratio:54/35;' do %>
81
81
 
82
- <% if section.image_two.attached? %>
82
+ <% if section.image_two&.attachment&.attached? %>
83
83
  <!-- XS to MD -->
84
84
  <img class="d-md-none lazyload"
85
- data-src="<%= main_app.url_for(section.img_two_md) %>"
86
- data-srcset="<%= main_app.url_for(section.img_two_md) %>"
85
+ data-src="<%= main_app.cdn_image_url(section.img_two_md) %>"
86
+ data-srcset="<%= main_app.cdn_image_url(section.img_two_md) %>"
87
87
  alt="<%= section&.title_two %>">
88
88
 
89
89
  <!-- MD to XL -->
90
90
  <img class="d-none d-md-block d-xl-none lazyload"
91
- data-src="<%= main_app.url_for(section.img_two_lg) %>"
92
- data-srcset="<%= main_app.url_for(section.img_two_lg) %>"
91
+ data-src="<%= main_app.cdn_image_url(section.img_two_lg) %>"
92
+ data-srcset="<%= main_app.cdn_image_url(section.img_two_lg) %>"
93
93
  alt="<%= section&.title_two %>">
94
94
 
95
95
  <!-- XL UP -->
96
96
  <img class="d-none d-xl-block lazyload"
97
- data-src="<%= main_app.url_for(section.img_two_xl) %>"
98
- data-srcset="<%= main_app.url_for(section.img_two_xl) %>"
97
+ data-src="<%= main_app.cdn_image_url(section.img_two_xl) %>"
98
+ data-srcset="<%= main_app.cdn_image_url(section.img_two_xl) %>"
99
99
  alt="<%= section&.title_two %>">
100
100
  <% else %>
101
101
  <%= icon( name: 'card-image',
@@ -13,7 +13,7 @@
13
13
  <% if @taxon.icon&.attachment %>
14
14
  <div class="d-none d-md-block pt-4 taxon-icon">
15
15
  <%= lazy_image(
16
- src: main_app.url_for(@taxon.icon.attachment),
16
+ src: main_app.cdn_image_url(@taxon.icon.attachment),
17
17
  alt: @taxon.description || Spree.t('taxon_missing_alt'),
18
18
  width: 1110,
19
19
  height: 300,
@@ -2,7 +2,7 @@
2
2
  <%= inline_svg_tag('edit.svg', width: 24, height: 24) %>
3
3
  <% end %>
4
4
 
5
- <%= link_to '#', class: 'js-delete-address-link ml-3', data: { turbolinks: false, hook: 'remove_address', address: spree.address_path(address) }, aria: { label: Spree.t('address_book.remove_address') } do %>
5
+ <%= link_to '#', class: 'js-delete-address-link ml-3', data: { turbo: false, hook: 'remove_address', address: spree.address_path(address) }, aria: { label: Spree.t('address_book.remove_address') } do %>
6
6
  <%= icon(name: 'garbage_2',
7
7
  classes: '',
8
8
  width: 24,
@@ -24,7 +24,7 @@ module Spree
24
24
  # SCSS theming
25
25
  template 'variables.scss', './app/assets/stylesheets/spree/frontend/variables/variables.scss'
26
26
  # Sprockets 4 manifest
27
- template 'app/assets/config/manifest.js'
27
+ template 'app/assets/config/manifest.js', force: Rails.env.test?
28
28
  # home page template
29
29
  directory 'home', './app/views/spree/home'
30
30
  end
@@ -0,0 +1,18 @@
1
+ module Spree
2
+ module Frontend
3
+ class Configuration < Preferences::Configuration
4
+ preference :additional_filters_partials, :array, default: %w()
5
+ preference :always_put_site_name_in_title, :boolean, default: true
6
+ preference :coupon_codes_enabled, :boolean, default: true # Determines if we show coupon code form at cart and checkout
7
+ preference :http_cache_enabled, :boolean, default: true
8
+ preference :layout, :string, default: 'spree/layouts/spree_application'
9
+ preference :locale, :string, default: nil
10
+ preference :products_filters, :array, default: %w(keywords price sort_by)
11
+ preference :remember_me_enabled, :boolean, default: true
12
+ preference :shipping_instructions, :boolean, default: false # Request instructions/info for shipping
13
+ preference :show_raw_product_description, :boolean, default: false
14
+ preference :show_store_selector, :boolean, default: false
15
+ preference :title_site_name_separator, :string, default: '-' # When always_put_site_name_in_title is true, insert a separator character before the site name in the title
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,5 @@
1
+ require_relative 'configuration'
2
+
1
3
  module Spree
2
4
  module Frontend
3
5
  class Engine < ::Rails::Engine
@@ -15,14 +17,7 @@ module Spree
15
17
  end
16
18
 
17
19
  initializer 'spree.frontend.environment', before: :load_config_initializers do |_app|
18
- Spree::Frontend::Config = Spree::FrontendConfiguration.new
19
- end
20
-
21
- initializer 'spree.frontend.checking_deprecated_preferences' do
22
- Spree::Frontend::Config.deprecated_preferences.each do |pref|
23
- # FIXME: we should only notify about deprecated preferences that are in use, not all of them
24
- # warn "[DEPRECATION] Spree::Frontend::Config[:#{pref[:name]}] is deprecated. #{pref[:message]}"
25
- end
20
+ Spree::Frontend::Config = Spree::Frontend::Configuration.new
26
21
  end
27
22
  end
28
23
  end
@@ -1,6 +1,6 @@
1
1
  module Spree
2
2
  module Frontend
3
- VERSION = '4.4.0'.freeze
3
+ VERSION = '4.5.0'.freeze
4
4
 
5
5
  def self.version
6
6
  VERSION