spree_frontend 4.3.1 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +192 -0
  3. data/.codeclimate.yml +36 -0
  4. data/.deepsource.toml +19 -0
  5. data/.editorconfig +22 -0
  6. data/.eslintignore +7 -0
  7. data/.eslintrc +36 -0
  8. data/.gem_release.yml +7 -0
  9. data/.github/CONTRIBUTING.md +1 -0
  10. data/.github/ISSUE_TEMPLATE/bug_report.md +47 -0
  11. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  12. data/.github/ISSUE_TEMPLATE.md +39 -0
  13. data/.github/dependabot.yml +32 -0
  14. data/.gitignore +58 -0
  15. data/.rubocop.yml +197 -0
  16. data/.solargraph.yml +20 -0
  17. data/.stylelintignore +4 -0
  18. data/.stylelintrc +6 -0
  19. data/CODE_OF_CONDUCT.md +22 -0
  20. data/Gemfile +58 -3
  21. data/LICENSE +1 -1
  22. data/README.md +88 -0
  23. data/SECURITY.md +1 -0
  24. data/app/assets/config/spree_frontend_manifest.js +1 -0
  25. data/app/assets/javascripts/spree/{api → frontend/api}/main.js +4 -4
  26. data/app/assets/javascripts/spree/{api → frontend/api}/storefront/cart.js +1 -1
  27. data/app/assets/javascripts/spree/frontend/checkout/address.js +3 -3
  28. data/app/assets/javascripts/spree/frontend/currency.js +6 -7
  29. data/app/assets/javascripts/spree/frontend/locale.es6 +1 -2
  30. data/app/assets/javascripts/{spree.js → spree/frontend/main.js} +5 -5
  31. data/app/assets/javascripts/spree/frontend/{turbolinks_scroll_fix.js → turbo_scroll_fix.js} +3 -3
  32. data/app/assets/javascripts/spree/frontend/views/spree/home/product_carousels.js +1 -1
  33. data/app/assets/javascripts/spree/frontend/views/spree/product/related.js +1 -1
  34. data/app/assets/javascripts/spree/frontend/views/spree/products/cart_form.js +8 -8
  35. data/app/assets/javascripts/spree/frontend/views/spree/products/description.js +1 -1
  36. data/app/assets/javascripts/spree/frontend/views/spree/products/index.js +1 -1
  37. data/app/assets/javascripts/spree/frontend/views/spree/shared/mobile_navigation.js +4 -4
  38. data/app/assets/javascripts/spree/frontend/views/spree/shared/variant_select.js +3 -3
  39. data/app/assets/javascripts/spree/frontend.js +10 -17
  40. data/app/controllers/spree/addresses_controller.rb +4 -4
  41. data/app/controllers/spree/checkout_controller.rb +2 -2
  42. data/app/controllers/spree/locale_controller.rb +3 -2
  43. data/app/controllers/spree/orders_controller.rb +1 -1
  44. data/app/controllers/spree/store_controller.rb +42 -1
  45. data/app/helpers/spree/frontend_helper.rb +32 -8
  46. data/app/helpers/spree/navigation_helper.rb +2 -2
  47. data/app/helpers/spree/products_filters_helper.rb +1 -1
  48. data/app/helpers/spree/store_helper.rb +1 -1
  49. data/app/services/spree/build_localized_redirect_url.rb +101 -0
  50. data/app/views/spree/checkout/_delivery.html.erb +1 -1
  51. data/app/views/spree/checkout/edit.html.erb +1 -1
  52. data/app/views/spree/checkout/registration.html.erb +1 -1
  53. data/app/views/spree/orders/_line_item.html.erb +1 -1
  54. data/app/views/spree/orders/_line_item_data.html.erb +1 -1
  55. data/app/views/spree/products/_color_option_type.html.erb +2 -2
  56. data/app/views/spree/products/_description.html.erb +1 -1
  57. data/app/views/spree/products/_filters_desktop.html.erb +3 -3
  58. data/app/views/spree/products/_filters_mobile.html.erb +2 -2
  59. data/app/views/spree/products/_thumbnails.html.erb +2 -2
  60. data/app/views/spree/shared/_head.html.erb +3 -2
  61. data/app/views/spree/shared/_line_item.html.erb +1 -1
  62. data/app/views/spree/shared/_link_to_account.html.erb +3 -1
  63. data/app/views/spree/shared/_login.html.erb +1 -1
  64. data/app/views/spree/shared/_main_nav_bar.html.erb +1 -1
  65. data/app/views/spree/shared/_nav_bar.html.erb +1 -1
  66. data/app/views/spree/shared/_order_details.html.erb +1 -1
  67. data/app/views/spree/shared/_paths.html.erb +1 -1
  68. data/app/views/spree/shared/_translations.html.erb +1 -1
  69. data/app/views/spree/shared/carousel/_single.html.erb +2 -2
  70. data/app/views/spree/shared/carousel/_thumbnails.html.erb +1 -1
  71. data/app/views/spree/shared/cms/sections/_hero_image.html.erb +9 -9
  72. data/app/views/spree/shared/cms/sections/_image_gallery.html.erb +21 -21
  73. data/app/views/spree/shared/cms/sections/_side_by_side_images.html.erb +14 -14
  74. data/app/views/spree/taxons/_header.html.erb +1 -1
  75. data/app/views/spree/users/_address_controls.html.erb +1 -1
  76. data/config/routes.rb +4 -4
  77. data/lib/generators/spree/frontend/install/install_generator.rb +1 -1
  78. data/lib/spree/frontend/configuration.rb +18 -0
  79. data/lib/spree/frontend/engine.rb +3 -7
  80. data/lib/spree/frontend/version.rb +9 -0
  81. data/lib/spree/frontend.rb +2 -1
  82. data/license.md +13 -0
  83. data/spree_frontend.gemspec +5 -4
  84. metadata +58 -22
  85. data/app/models/spree/frontend_configuration.rb +0 -10
  86. data/app/views/spree/shared/_taxonomies.html.erb +0 -16
@@ -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,8 @@
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
- <%= 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) %>
3
+ <% if spree.respond_to?(:admin_orders_path) %>
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
+ <% end %>
4
6
  <%= link_to Spree.t(:logout).upcase, spree_logout_path, class: 'dropdown-item', method: :get if defined?(spree_logout_path) %>
5
7
  <% else %>
6
8
  <%= link_to Spree.t(:login).upcase, spree_login_path, class: 'dropdown-item' if defined?(spree_login_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>
@@ -2,7 +2,7 @@
2
2
  SpreePaths = <%==
3
3
  {
4
4
  mounted_at: Rails.application.routes.url_helpers.spree_path(trailing_slash: true),
5
- admin: Spree.admin_path.gsub(/\A(\/)?(.*[^\/])(\/)?\z/, '\\2/')
5
+ admin: Spree.respond_to?(:admin_path) ? Spree.admin_path.gsub(/\A(\/)?(.*[^\/])(\/)?\z/, '\\2/') : '/admin'
6
6
  }.to_json
7
7
  %>
8
8
  </script>
@@ -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,
data/config/routes.rb CHANGED
@@ -2,11 +2,11 @@ Spree::Core::Engine.add_routes do
2
2
  scope '(:locale)', locale: /#{Spree.available_locales.join('|')}/, defaults: { locale: nil } do
3
3
  root to: 'home#index'
4
4
 
5
- resources :products, only: [:index, :show], path: "/#{Spree::Config[:storefront_products_path]}"
5
+ resources :products, only: [:index, :show], path: '/products'
6
6
 
7
- get "/#{Spree::Config[:storefront_products_path]}/:id/related", to: 'products#related'
7
+ get '/products/:id/related', to: 'products#related'
8
8
  # route globbing for pretty nested taxon and product paths
9
- get "/#{Spree::Config[:storefront_taxons_path]}/*id", to: 'taxons#show', as: :nested_taxons
9
+ get '/t/*id', to: 'taxons#show', as: :nested_taxons
10
10
  get '/product_carousel/:id', to: 'taxons#product_carousel'
11
11
 
12
12
  # non-restful checkout stuff
@@ -34,7 +34,7 @@ Spree::Core::Engine.add_routes do
34
34
  get '/api_tokens', to: 'store#api_tokens'
35
35
  post '/ensure_cart', to: 'store#ensure_cart'
36
36
 
37
- get "#{Spree::Config[:storefront_pages_path]}/:slug", to: 'cms_pages#show', as: :page
37
+ get '/pages/:slug', to: 'cms_pages#show', as: :page
38
38
 
39
39
  get '/forbidden', to: 'errors#forbidden', as: :forbidden
40
40
  get '/unauthorized', to: 'errors#unauthorized', as: :unauthorized
@@ -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,13 +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
- warn "[DEPRECATION] Spree::Frontend::Config[:#{pref[:name]}] is deprecated. #{pref[:message]}"
24
- end
20
+ Spree::Frontend::Config = Spree::Frontend::Configuration.new
25
21
  end
26
22
  end
27
23
  end
@@ -0,0 +1,9 @@
1
+ module Spree
2
+ module Frontend
3
+ VERSION = '4.5.0'.freeze
4
+
5
+ def self.version
6
+ VERSION
7
+ end
8
+ end
9
+ end
@@ -9,7 +9,8 @@ require 'inline_svg'
9
9
  require 'popper_js'
10
10
  require 'canonical-rails'
11
11
  require 'jquery-rails'
12
- require 'turbolinks'
12
+ require 'jsbundling-rails'
13
+ require 'turbo-rails'
13
14
  require 'responders'
14
15
 
15
16
  require 'spree/frontend/middleware/seo_assist'
data/license.md ADDED
@@ -0,0 +1,13 @@
1
+ Spree License
2
+ =============
3
+
4
+ Copyright © 2007-2022, Spree Commerce Inc., Spark Solutions Sp. z o.o. and other contributors.
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+ * Neither the name of Spree Commerce Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ _This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage._
@@ -1,13 +1,13 @@
1
1
  # encoding: UTF-8
2
- require_relative '../core/lib/spree/core/version.rb'
2
+ require_relative 'lib/spree/frontend/version'
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.name = 'spree_frontend'
7
- s.version = Spree.version
7
+ s.version = Spree::Frontend.version
8
8
  s.authors = ['Sean Schofield', 'Spark Solutions']
9
9
  s.email = 'hello@spreecommerce.org'
10
- s.summary = 'The default Storefront built with Rails and Turbolinks for Spree eCommerce platform'
10
+ s.summary = 'The default Storefront built with Rails and Turbo/Hotwire for Spree eCommerce platform'
11
11
  s.description = s.summary
12
12
  s.homepage = 'https://spreecommerce.org'
13
13
  s.license = 'BSD-3-Clause'
@@ -33,9 +33,10 @@ Gem::Specification.new do |s|
33
33
  s.add_dependency 'glyphicons', '~> 1.0'
34
34
  s.add_dependency 'canonical-rails', '~> 0.2', '>= 0.2.10'
35
35
  s.add_dependency 'inline_svg', '~> 1.5'
36
+ s.add_dependency 'jsbundling-rails'
36
37
  s.add_dependency 'jquery-rails', '~> 4.3'
37
38
  s.add_dependency 'sass-rails', '>= 5'
38
- s.add_dependency 'turbolinks', '~> 5.2'
39
+ s.add_dependency 'turbo-rails'
39
40
  s.add_dependency 'responders'
40
41
  s.add_dependency 'sprockets', '~> 4.0'
41
42