spree_storefront 5.1.8 → 5.2.0.rc1

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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spree/account/newsletter_controller.rb +2 -0
  3. data/app/controllers/spree/errors_controller.rb +21 -0
  4. data/app/controllers/spree/newsletter_subscribers_controller.rb +27 -13
  5. data/app/controllers/spree/policies_controller.rb +2 -20
  6. data/app/controllers/spree/store_controller.rb +2 -2
  7. data/app/helpers/spree/page_helper.rb +38 -2
  8. data/app/helpers/spree/payment_methods_helper.rb +7 -0
  9. data/app/helpers/spree/storefront_helper.rb +18 -0
  10. data/app/helpers/spree/theme_helper.rb +10 -2
  11. data/app/helpers/spree/turbo_helper.rb +2 -1
  12. data/app/javascript/spree/storefront/application.js +1 -0
  13. data/app/javascript/spree/storefront/controllers/prefetch_lazy_controller.js +26 -0
  14. data/app/javascript/spree/storefront/controllers/toggle_menu_controller.js +0 -1
  15. data/app/views/layouts/spree/storefront.html.erb +5 -14
  16. data/app/views/spree/checkout/_footer.html.erb +14 -9
  17. data/app/views/spree/checkout/_line_items.html.erb +2 -2
  18. data/app/views/spree/checkout/_missing_line_items.html.erb +1 -1
  19. data/app/views/spree/checkout/_payment_method.html.erb +15 -0
  20. data/app/views/spree/checkout/_payment_methods.html.erb +1 -18
  21. data/app/views/spree/checkout/_summary.html.erb +3 -3
  22. data/app/views/spree/checkout/payment/_gateway.html.erb +3 -3
  23. data/app/views/spree/errors/403.html.erb +7 -0
  24. data/app/views/spree/errors/403.json.erb +1 -0
  25. data/app/views/spree/errors/404.html.erb +7 -0
  26. data/app/views/spree/errors/404.json.erb +1 -0
  27. data/app/views/spree/errors/422.html.erb +7 -0
  28. data/app/views/spree/errors/422.json.erb +1 -0
  29. data/app/views/spree/errors/500.html.erb +7 -0
  30. data/app/views/spree/errors/500.json.erb +1 -0
  31. data/app/views/spree/errors/503.html.erb +7 -0
  32. data/app/views/spree/errors/503.json.erb +1 -0
  33. data/app/views/spree/home/index.html.erb +3 -1
  34. data/app/views/spree/newsletter_subscribers/create.turbo_stream.erb +1 -1
  35. data/app/views/themes/default/spree/account/_orders.html.erb +1 -1
  36. data/app/views/themes/default/spree/account/addresses/index.html.erb +1 -1
  37. data/app/views/themes/default/spree/account/gift_cards/index.html.erb +1 -1
  38. data/app/views/themes/default/spree/account/store_credits/index.html.erb +1 -1
  39. data/app/views/themes/default/spree/metafields/_boolean.html.erb +5 -0
  40. data/app/views/themes/default/spree/metafields/_json.html.erb +3 -0
  41. data/app/views/themes/default/spree/metafields/_long_text.html.erb +1 -0
  42. data/app/views/themes/default/spree/metafields/_number.html.erb +1 -0
  43. data/app/views/themes/default/spree/metafields/_rich_text.html.erb +1 -0
  44. data/app/views/themes/default/spree/metafields/_short_text.html.erb +1 -0
  45. data/app/views/themes/default/spree/orders/_cart.html.erb +1 -1
  46. data/app/views/themes/default/spree/orders/_line_item.html.erb +1 -1
  47. data/app/views/themes/default/spree/page_sections/_announcement_bar.html.erb +1 -1
  48. data/app/views/themes/default/spree/page_sections/_breadcrumbs.html.erb +18 -0
  49. data/app/views/themes/default/spree/page_sections/_custom_code.html.erb +1 -1
  50. data/app/views/themes/default/spree/page_sections/_featured_posts.html.erb +1 -1
  51. data/app/views/themes/default/spree/page_sections/_featured_taxon.html.erb +1 -1
  52. data/app/views/themes/default/spree/page_sections/_featured_taxons.html.erb +1 -1
  53. data/app/views/themes/default/spree/page_sections/_footer.html.erb +2 -2
  54. data/app/views/themes/default/spree/page_sections/_header.html.erb +140 -139
  55. data/app/views/themes/default/spree/page_sections/_image_banner.html.erb +5 -4
  56. data/app/views/themes/default/spree/page_sections/_image_with_text.html.erb +3 -2
  57. data/app/views/themes/default/spree/page_sections/_newsletter.html.erb +43 -39
  58. data/app/views/themes/default/spree/page_sections/_page_title.html.erb +1 -1
  59. data/app/views/themes/default/spree/page_sections/_product_details.html.erb +47 -66
  60. data/app/views/themes/default/spree/page_sections/_rich_text.html.erb +1 -1
  61. data/app/views/themes/default/spree/page_sections/_taxon_banner.html.erb +1 -1
  62. data/app/views/themes/default/spree/page_sections/_taxon_grid.html.erb +1 -1
  63. data/app/views/themes/default/spree/page_sections/_video.html.erb +1 -1
  64. data/app/views/themes/default/spree/page_sections/nav/_desktop.html.erb +1 -1
  65. data/app/views/themes/default/spree/page_sections/nav/_mobile.html.erb +4 -9
  66. data/app/views/themes/default/spree/policies/show.html.erb +8 -9
  67. data/app/views/themes/default/spree/products/_add_to_waitlist.html.erb +3 -3
  68. data/app/views/themes/default/spree/products/_breadcrumbs.html.erb +1 -1
  69. data/app/views/themes/default/spree/products/_color_swatches.html.erb +2 -2
  70. data/app/views/themes/default/spree/products/_description.html.erb +11 -0
  71. data/app/views/themes/default/spree/products/_details.html.erb +2 -2
  72. data/app/views/themes/default/spree/products/_featured_image.html.erb +2 -8
  73. data/app/views/themes/default/spree/products/_media_gallery.html.erb +1 -1
  74. data/app/views/themes/default/spree/products/_metafields.html.erb +18 -0
  75. data/app/views/themes/default/spree/products/_quantity_selector.html.erb +1 -2
  76. data/app/views/themes/default/spree/settings/show.html.erb +2 -2
  77. data/app/views/themes/default/spree/shared/_address.html.erb +1 -1
  78. data/app/views/themes/default/spree/shared/_css_variables.html.erb +1 -1
  79. data/app/views/themes/default/spree/shared/_json_ld.html.erb +1 -1
  80. data/app/views/themes/default/spree/shared/_logo.html.erb +2 -9
  81. data/app/views/themes/default/spree/shared/_meta_tags.html.erb +6 -2
  82. data/app/views/themes/default/spree/shared/_order_details.html.erb +2 -2
  83. data/app/views/themes/default/spree/shared/_order_shipment.html.erb +1 -1
  84. data/app/views/themes/default/spree/wishlists/show.html.erb +1 -1
  85. data/config/initializers/assets.rb +3 -1
  86. data/config/locales/en.yml +5 -2
  87. data/config/routes.rb +9 -1
  88. data/lib/generators/spree/storefront/install/install_generator.rb +2 -1
  89. data/lib/generators/spree/storefront/install/templates/{application.tailwind.css → application.css} +105 -14
  90. data/lib/generators/spree/storefront/install/templates/tailwind.config.js +3 -114
  91. data/lib/spree/storefront/configuration.rb +3 -0
  92. data/lib/spree/storefront/engine.rb +5 -3
  93. data/lib/spree/storefront.rb +1 -3
  94. metadata +43 -34
@@ -0,0 +1 @@
1
+ <%= metafield.value %>
@@ -2,7 +2,7 @@
2
2
  <div class="h-full flex flex-col" id="cart-container" data-cart-target="container">
3
3
  <%== color_options_style_for_line_items(@line_items) %>
4
4
  <ul class="w-full" id="line-items">
5
- <%= render collection: @line_items, partial: 'spree/orders/line_item', cached: spree_base_cache_scope %>
5
+ <%= render collection: @line_items, partial: 'spree/orders/line_item', cached: spree_storefront_base_cache_scope %>
6
6
  </ul>
7
7
  <%= render 'spree/orders/summary', order: @order %>
8
8
  </div>
@@ -16,7 +16,7 @@
16
16
  <%= link_to line_item.name, spree_storefront_resource_url(line_item.product), class: 'font-semibold text-text', data: { 'turbo-frame': '_top' } %>
17
17
 
18
18
  <%= form_for line_item, url: spree.line_item_url(line_item, order_token: line_item.order.token), method: :delete, data: { controller: 'turbo-stream-form' } do |item_form| %>
19
- <%= button_tag type: :submit, class: 'remove-line-item-button h-100', data: { action: "click->cart#disableCart turbo-stream-form:submit-end->cart#enableCart" } do %>
19
+ <%= button_tag type: :submit, class: 'remove-line-item-button', data: { action: "click->cart#disableCart turbo-stream-form:submit-end->cart#enableCart" } do %>
20
20
  <%= render 'spree/shared/icons/cross', size: 16 %>
21
21
  <% end %>
22
22
  <% end %>
@@ -1,4 +1,4 @@
1
- <% cache_unless page_builder_enabled?, spree_base_cache_scope.call(section) do %>
1
+ <% cache_unless page_builder_enabled?, spree_storefront_base_cache_scope.call(section) do %>
2
2
  <% if section.present? && section.text.body.to_plain_text.present? %>
3
3
  <div
4
4
  class='w-full justify-center items-center flex announcement-bar'
@@ -0,0 +1,18 @@
1
+ <div style="<%= section_styles(section) %>">
2
+ <div class="page-container">
3
+ <nav id="breadcrumbs" aria-label="breadcrumbs">
4
+ <% if @product.present? %>
5
+ <% taxons = product_breadcrumb_taxons(@product) %>
6
+
7
+ <ul class="inline-flex gap-3 text-sm">
8
+ <% taxons.each_with_index do |taxon, index| %>
9
+ <li class="opacity-50"><%= link_to taxon.name, spree.nested_taxons_path(taxon), title: taxon.name %></li>
10
+ <div class="breadcrumb-square opacity-50 <%= 'hidden md:block' if index == taxons.length - 1 %>"></div>
11
+ <% end %>
12
+
13
+ <li class="hidden lg:block text-text opacity-100"><%= @product.name %></li>
14
+ </ul>
15
+ <% end %>
16
+ </nav>
17
+ </div>
18
+ </div>
@@ -1,4 +1,4 @@
1
- <% cache_unless page_builder_enabled?, spree_base_cache_scope.call(section) do %>
1
+ <% cache_unless page_builder_enabled?, spree_storefront_base_cache_scope.call(section) do %>
2
2
  <div style="<%= section_styles(section) %>">
3
3
  <%= raw(section.preferred_custom_code) %>
4
4
  </div>
@@ -41,7 +41,7 @@
41
41
  <div class='swiper-wrapper px-4 lg:px-0 h-auto'>
42
42
  <%= render partial: "spree/posts/post",
43
43
  collection: section.posts,
44
- cached: spree_base_cache_scope,
44
+ cached: spree_storefront_base_cache_scope,
45
45
  as: :post %>
46
46
  </div>
47
47
  <%= button_tag class: "absolute p-2 bg-white rounded-full z-10 border border-accent left-0 disabled:hidden hover:border-primary ml-2 lg:ml-0 swiper-custom-button-prev-#{section.id} block top-[100px]", aria: { label: "Previous posts" }, style: "transform: translate(-50%, -50%);" do %>
@@ -1,4 +1,4 @@
1
- <% cache_unless page_builder_enabled?, [spree_base_cache_key, section.cache_key_with_version, loaded.to_b] do %>
1
+ <% cache_unless page_builder_enabled?, [spree_storefront_base_cache_key, section.cache_key_with_version, loaded.to_b] do %>
2
2
  <div style='<%= section_styles(section) %>' class='animate-fadeIn'>
3
3
  <div class='page-container'>
4
4
  <% heading_size = case section.preferred_heading_size
@@ -1,4 +1,4 @@
1
- <% cache_unless page_builder_enabled?, spree_base_cache_scope.call(section) do %>
1
+ <% cache_unless page_builder_enabled?, spree_storefront_base_cache_scope.call(section) do %>
2
2
  <div class="page-container py-5" style="<%= section_styles(section) %>">
3
3
  <% heading_size = case section.preferred_heading_size
4
4
  when 'small' then 'text-base font-medium'
@@ -1,4 +1,4 @@
1
- <% cache_unless page_builder_enabled?, [*spree_base_cache_scope.call(section), current_store] do %>
1
+ <% cache_unless page_builder_enabled?, [*spree_storefront_base_cache_scope.call(section), current_store] do %>
2
2
  <footer
3
3
  id='footer'
4
4
  <% unless current_theme_preview %>
@@ -32,7 +32,7 @@
32
32
  <div class="gap-1 flex flex-col py-6 md:py-0">
33
33
  <h3 class="text-sm py-2"><%= Spree.t(:follow_us) %></h3>
34
34
  <div class="flex flex-wrap gap-2 max-w-48 py-2">
35
- <% cache spree_base_cache_scope.call(current_store) do %>
35
+ <% cache spree_storefront_base_cache_scope.call(current_store) do %>
36
36
  <% Spree::Store::SUPPORTED_SOCIAL_NETWORKS.each do |media| %>
37
37
  <% if current_store.send(media).present? %>
38
38
  <%= link_to current_store.send("#{media}_link") do %>
@@ -1,159 +1,160 @@
1
- <% layout = section.preferred_layout %>
2
- <header
3
- class='header-<%= layout %>'
4
- data-controller='header toggle-menu slideover <%= "slideover-account" if show_account_pane? %>'
5
- data-toggle-menu-class='hamburger-visible'
6
- data-slideover-invisible-class='translate-x-full,opacity-0'
7
- data-slideover-visible-class='translate-x-0,opacity-100'
8
- data-slideover-active-target='#slideover-cart'
9
- data-slideover-account-invisible-class='translate-x-full,opacity-0'
10
- data-slideover-account-visible-class='translate-x-0,opacity-100'
11
- data-slideover-account-active-target='#slideover-account'
12
- >
13
- <nav
14
- aria-label='Top'
15
- style="<%= section_styles(section) %>"
16
- class="relative transition-transform duration-300">
17
- <div class='page-container'>
18
- <div class='flex items-center<%= " lg:items-end" if layout == "logo-centered" %> <%= " lg:items-center" unless layout == "logo-centered" %> justify-between '>
19
- <% unless layout == 'logo-centered' %>
20
- <div class='hidden lg:flex' id='header-logo'>
21
- <%= render 'spree/shared/logo', logo: section.logo, height: section.preferred_desktop_logo_height %>
22
- </div>
23
- <% end %>
24
- <div class='flex -order-1 flex-1 <%= " lg:flex-none lg:order-1 z-10 lg:mr-8" unless layout == "logo-centered" %>'>
25
- <!-- Mobile menu toggle, controls the 'mobileMenuOpen' state. -->
26
- <button
27
- type='button'
28
- data-action='click->toggle-menu#toggle touch->toggle-menu#toggle'
29
- class='relative w-6 lg:hidden'
30
- data-toggle-menu-target='button'
31
- >
32
- <span class='sr-only'><%= Spree.t(:toggle_menu) %></span>
33
- <div
34
- class='absolute top-0'
35
- >
36
- <%= render 'spree/shared/icons/menu', color: section.preferred_text_color %>
37
- </div>
38
- <div
39
- class='absolute top-0 opacity-0'
40
- >
41
- <%= render 'spree/shared/icons/close', color: section.preferred_text_color %>
1
+ <% cache_unless page_builder_enabled?, [spree_storefront_base_cache_scope.call(section), request.path] do %>
2
+ <% layout = section.preferred_layout %>
3
+ <header
4
+ class='header-<%= layout %>'
5
+ data-controller='header toggle-menu slideover <%= "slideover-account" if show_account_pane? %>'
6
+ data-toggle-menu-class='hamburger-visible'
7
+ data-slideover-invisible-class='translate-x-full,opacity-0'
8
+ data-slideover-visible-class='translate-x-0,opacity-100'
9
+ data-slideover-active-target='#slideover-cart'
10
+ data-slideover-account-invisible-class='translate-x-full,opacity-0'
11
+ data-slideover-account-visible-class='translate-x-0,opacity-100'
12
+ data-slideover-account-active-target='#slideover-account'
13
+ >
14
+ <nav
15
+ aria-label='Top'
16
+ style="<%= section_styles(section) %>"
17
+ class="relative transition-transform duration-300">
18
+ <div class='page-container'>
19
+ <div class='flex items-center<%= " lg:items-end" if layout == "logo-centered" %> <%= " lg:items-center" unless layout == "logo-centered" %> justify-between '>
20
+ <% unless layout == 'logo-centered' %>
21
+ <div class='hidden lg:flex' id='header-logo'>
22
+ <%= render 'spree/shared/logo', logo: section.logo, height: section.preferred_desktop_logo_height %>
42
23
  </div>
43
- </button>
44
- <!-- Search button -->
45
- <div class='<%= "lg:relative" unless layout == "logo-centered" %> flex'>
24
+ <% end %>
25
+ <div class='flex -order-1 flex-1 <%= " lg:flex-none lg:order-1 z-10 lg:mr-8" unless layout == "logo-centered" %>'>
26
+ <!-- Mobile menu toggle, controls the 'mobileMenuOpen' state. -->
46
27
  <button
47
- class='flex items-center ml-4 lg:ml-0'
48
- id='open-search'
49
- data-action='click->toggle-menu#hide touch->toggle-menu#hide'
28
+ type='button'
29
+ data-action='click->toggle-menu#toggle touch->toggle-menu#toggle'
30
+ class='relative w-6 lg:hidden'
31
+ data-toggle-menu-target='button'
50
32
  >
51
- <%= render 'spree/shared/icons/search', color: section.preferred_text_color %>
52
- <span class='hidden lg:block ml-2 text-sm !leading-6 uppercase'><%= Spree.t(:search) %></span>
33
+ <span class='sr-only'><%= Spree.t(:toggle_menu) %></span>
34
+ <div
35
+ class='absolute top-0'
36
+ >
37
+ <%= render 'spree/shared/icons/menu', color: section.preferred_text_color %>
38
+ </div>
39
+ <div
40
+ class='absolute top-0 opacity-0'
41
+ >
42
+ <%= render 'spree/shared/icons/close', color: section.preferred_text_color %>
43
+ </div>
53
44
  </button>
45
+ <!-- Search button -->
46
+ <div class='<%= "lg:relative" unless layout == "logo-centered" %> flex'>
47
+ <button
48
+ class='flex items-center ml-4 lg:ml-0'
49
+ id='open-search'
50
+ data-action='click->toggle-menu#hide touch->toggle-menu#hide'
51
+ >
52
+ <%= render 'spree/shared/icons/search', color: section.preferred_text_color %>
53
+ <span class='hidden lg:block ml-2 text-sm !leading-6 uppercase'><%= Spree.t(:search) %></span>
54
+ </button>
55
+ </div>
54
56
  </div>
55
- </div>
56
- <div class='flex items-center flex-col<%= " lg:flex-1" unless layout == "logo-centered" %> header-nav-container'>
57
- <!-- Logo -->
58
- <div class='<%= "flex lg:pb-4" if layout == "logo-centered" %><%= "lg:hidden" unless layout == "logo-centered" %>' id='header-logo'>
59
- <%= render 'spree/shared/logo', logo: section.logo, height: section.preferred_desktop_logo_height %>
60
- </div>
61
- <!-- Desktop Menu -->
62
- <% if layout == 'nav-centered' %>
63
- <div
64
- class='hidden lg:flex absolute top-px left-1/2 -translate-x-1/2 justify-center w-[calc(100%-29rem)] overflow-auto'
65
- >
66
- <% end %>
67
- <div class='hidden lg:flex<%= " w-full px-12" if layout == "left" %>'>
68
- <div class='flex flex-wrap justify-center mx-4 h-full'>
69
- <%= render 'spree/page_sections/nav/desktop', section: section %>
57
+ <div class='flex items-center flex-col<%= " lg:flex-1" unless layout == "logo-centered" %> header-nav-container'>
58
+ <!-- Logo -->
59
+ <div class='<%= "flex lg:pb-4" if layout == "logo-centered" %><%= "lg:hidden" unless layout == "logo-centered" %>' id='header-logo'>
60
+ <%= render 'spree/shared/logo', logo: section.logo, height: section.preferred_desktop_logo_height %>
61
+ </div>
62
+ <!-- Desktop Menu -->
63
+ <% if layout == 'nav-centered' %>
64
+ <div
65
+ class='hidden lg:flex absolute top-px left-1/2 -translate-x-1/2 justify-center w-[calc(100%-29rem)] overflow-auto'
66
+ >
67
+ <% end %>
68
+ <div class='hidden lg:flex<%= " w-full px-12" if layout == "left" %>'>
69
+ <div class='flex flex-wrap justify-center mx-4 h-full'>
70
+ <%= render 'spree/page_sections/nav/desktop', section: section %>
71
+ </div>
70
72
  </div>
71
73
  </div>
72
- </div>
73
- <% if layout == 'nav-centered' %></div>
74
- <% end %>
75
- <div
76
- class='flex items-center gap-4 flex-1 justify-end<%= " lg:flex-none order-2" unless layout == "logo-centered" %>'
77
- >
78
- <% if should_render_currency_dropdown? || should_render_locale_dropdown? %>
79
- <div
80
- data-controller="modal"
81
- data-modal-allow-background-close="true"
82
- data-modal-
83
- class="hidden lg:flex"
84
- data-modal-backdrop-color-value="rgba(0,0,0,0.32)">
85
- <%= button_tag class: 'flex gap-2 items-center', data: {action: 'modal#open'} do %>
86
- <% if should_render_currency_dropdown? %>
87
- <span>
88
- <%= "#{current_currency} (#{currency_money(current_currency).symbol})" %>
89
- </span>
74
+ <% if layout == 'nav-centered' %></div>
75
+ <% end %>
76
+ <div
77
+ class='flex items-center gap-4 flex-1 justify-end<%= " lg:flex-none order-2" unless layout == "logo-centered" %>'
78
+ >
79
+ <% if should_render_currency_dropdown? || should_render_locale_dropdown? %>
80
+ <div
81
+ data-controller="modal"
82
+ data-modal-disable-backdrop="true"
83
+ class="hidden lg:flex">
84
+ <%= button_tag class: 'flex gap-2 items-center', data: {action: 'modal#open'} do %>
85
+ <% if should_render_currency_dropdown? %>
86
+ <span>
87
+ <%= "#{current_currency} (#{currency_money(current_currency).symbol})" %>
88
+ </span>
89
+ <% end %>
90
+ <% if should_render_locale_dropdown? %>
91
+ <span class="uppercase <%= should_render_currency_dropdown?.presence && "border-l pl-2" %> flex items-center gap-1">
92
+ <% country_code = current_locale.to_s.split("-").last %>
93
+ <%= svg_country_icon(country_code) %>
94
+ <span ><%= country_code %></span>
95
+ </span>
96
+ <% end %>
90
97
  <% end %>
91
- <% if should_render_locale_dropdown? %>
92
- <span class="uppercase <%= should_render_currency_dropdown?.presence && "border-l pl-2" %> flex items-center gap-1">
93
- <% country_code = current_locale.to_s.split("-").last %>
94
- <%= svg_country_icon(country_code) %>
95
- <span ><%= country_code %></span>
96
- </span>
98
+ <%= turbo_frame_tag :settings_modal, src: spree.settings_path, loading: :lazy %>
99
+ </div>
100
+ <% end %>
101
+ <!-- Desktop Account -->
102
+ <div class='hidden lg:flex'>
103
+ <% if show_account_pane? %>
104
+ <button
105
+ data-action='click->slideover-account#toggle click@window->slideover-account#hide click->toggle-menu#hide touch->toggle-menu#hide'
106
+ >
107
+ <%= render 'spree/shared/icons/account', color: section.preferred_text_color, section: section %>
108
+ </button>
109
+ <% else %>
110
+ <%= link_to spree.account_path do %>
111
+ <%= render 'spree/shared/icons/account', color: section.preferred_text_color, section: section %>
97
112
  <% end %>
98
113
  <% end %>
99
- <%= turbo_frame_tag :settings_modal, src: spree.settings_path, loading: :lazy %>
100
114
  </div>
101
- <% end %>
102
- <!-- Desktop Account -->
103
- <div class='hidden lg:flex'>
104
115
  <% if show_account_pane? %>
105
- <button
106
- data-action='click->slideover-account#toggle click@window->slideover-account#hide click->toggle-menu#hide touch->toggle-menu#hide'
107
- >
108
- <%= render 'spree/shared/icons/account', color: section.preferred_text_color, section: section %>
109
- </button>
116
+ <%= form_with url: spree.account_wishlist_path, method: :get, data: { turbo_stream: true } do %>
117
+ <button
118
+ type="submit"
119
+ id="wishlist-icon"
120
+ class="flex items-end">
121
+ <%= render 'spree/shared/wishlist_icon', wishlist: current_wishlist, background_color: section.preferred_background_color %>
122
+ </button>
123
+ <% end %>
110
124
  <% else %>
111
- <%= link_to spree.account_path do %>
112
- <%= render 'spree/shared/icons/account', color: section.preferred_text_color, section: section %>
125
+ <%= link_to spree.account_wishlist_path, id: "wishlist-icon" do %>
126
+ <%= render 'spree/shared/wishlist_icon', background_color: section.preferred_background_color %>
113
127
  <% end %>
114
128
  <% end %>
115
- </div>
116
- <% if show_account_pane? %>
117
- <%= form_with url: spree.account_wishlist_path, method: :get, data: { turbo_stream: true } do %>
118
- <button
119
- type="submit"
120
- id="wishlist-icon"
121
- class="flex items-end">
122
- <%= render 'spree/shared/wishlist_icon', wishlist: current_wishlist, background_color: section.preferred_background_color %>
123
- </button>
124
- <% end %>
125
- <% else %>
126
- <%= link_to spree.account_wishlist_path, id: "wishlist-icon" do %>
127
- <%= render 'spree/shared/wishlist_icon', background_color: section.preferred_background_color %>
128
- <% end %>
129
- <% end %>
130
- <!-- Cart -->
131
- <div
132
- data-action='click->toggle-menu#hide touch->toggle-menu#hide'
133
- >
134
- <%= render 'spree/shared/cart_icon' %>
129
+ <!-- Cart -->
130
+ <div
131
+ data-action='click->toggle-menu#hide touch->toggle-menu#hide'
132
+ >
133
+ <%= render 'spree/shared/cart_icon' %>
134
+ </div>
135
135
  </div>
136
136
  </div>
137
137
  </div>
138
- </div>
138
+ </nav>
139
139
  <div
140
- class='h-0 opacity-0 pointer-events-none hide-on-load'
141
- data-toggle-menu-target='toggleable'
142
- role='dialog'
143
- aria-modal='true'
144
- >
145
- <div
146
- class='flex justify-between flex-col lg:hidden w-full transition-transform translate-x-[-50%] has-[.currency-and-locale-modal:not(.hidden)]:transform-none body header--mobile-menu'
147
- data-toggle-menu-target='content'
148
- style='background-color: <%= section.preferred_background_color %>; height: calc(100dvh - 38px);'
149
- >
150
- <%= render 'spree/page_sections/nav/mobile', section: section %>
140
+ class='h-0 opacity-0 pointer-events-none hide-on-load'
141
+ data-toggle-menu-target='toggleable'
142
+ role='dialog'
143
+ aria-modal='true'
144
+ >
145
+ <div
146
+ class='flex justify-between flex-col lg:hidden w-full transition-transform translate-x-[-50%] has-[.currency-and-locale-modal:not(.hidden)]:transform-none body header--mobile-menu'
147
+ data-toggle-menu-target='content'
148
+ style='background-color: <%= section.preferred_background_color %>; height: calc(100dvh - 58px - 36px);'
149
+ >
150
+ <%= render 'spree/page_sections/nav/mobile', section: section %>
151
+ </div>
151
152
  </div>
152
- </div>
153
- </nav>
154
- <%= render 'spree/shared/cart_pane', section: section %>
155
- <% if show_account_pane? %>
156
- <%= render 'spree/shared/account_pane', section: section %>
157
- <% end %>
158
- <%= render 'spree/shared/search', section: section, logo: section.logo, logo_height: section.preferred_desktop_logo_height %>
159
- </header>
153
+
154
+ <%= render 'spree/shared/cart_pane', section: section %>
155
+ <% if show_account_pane? %>
156
+ <%= render 'spree/shared/account_pane', section: section %>
157
+ <% end %>
158
+ <%= render 'spree/shared/search', section: section, logo: section.logo, logo_height: section.preferred_desktop_logo_height %>
159
+ </header>
160
+ <% end %>
@@ -1,4 +1,5 @@
1
- <% cache_unless page_builder_enabled?, spree_base_cache_scope.call(section) do %>
1
+
2
+ <% cache_unless page_builder_enabled?, spree_storefront_base_cache_scope.call(section) do %>
2
3
  <div class="w-full relative image-banner" style="<%= section_styles(section) %>;height: <%= section.preferred_height %>px">
3
4
  <div class="w-full absolute left-0 image-banner--image-wrapper" style="height: <%= section.preferred_height %>px; opacity: <%= section.preferred_overlay_transparency %>%;">
4
5
  <% if section.image.attached? && section.image.variable? %>
@@ -9,7 +10,7 @@
9
10
  <source media="(max-width: 1080px)" srcset="<%= spree_image_url(section.image, width: 540, height: nil) %>">
10
11
  <source media="(max-width: 1200px)" srcset="<%= spree_image_url(section.image, width: 620, height: nil) %>">
11
12
  <source media="(min-width: 1201px)" srcset="<%= spree_image_url(section.image, width: 1000, height: nil) %>">
12
- <%= spree_image_tag(section.image, width: 1000, class: "w-full h-full object-cover", loading: "lazy") %>
13
+ <%= spree_image_tag(section.image, width: 1000, class: "w-full h-full object-cover", loading: "lazy", alt: section.image_alt) %>
13
14
  </picture>
14
15
  <% end %>
15
16
  </div>
@@ -23,7 +24,7 @@
23
24
  'justify-center'
24
25
  end
25
26
  %>
26
- <div class="flex h-full w-full items-center justify-center">
27
+ <div class="flex justify-center items-center w-full h-full">
27
28
  <div class="flex flex-col <%= vertical_alignment_class %> p-5 z-10 w-full gap-y-2 h-full image-banner--block-wrapper">
28
29
  <% section.blocks.includes(:rich_text_text, :links).each do |block| %>
29
30
  <% case block.type %>
@@ -38,7 +39,7 @@
38
39
  <% when 'Spree::PageBlocks::Buttons' %>
39
40
  <div <%= block_attributes(block) %> class="w-full text-center image-banner--buttons">
40
41
  <div class="inline-block">
41
- <div class="flex flex-col lg:flex-row gap-4">
42
+ <div class="flex flex-col gap-4 lg:flex-row">
42
43
  <% if block.link.present? %>
43
44
  <% if block.link.linkable_url.present? %>
44
45
  <%= page_builder_link_to block.link, label: block.link.label, class: "btn-#{block.preferred_button_style_1}", target: (block.link.open_in_new_tab ? "_blank" : nil) %>
@@ -1,4 +1,4 @@
1
- <% cache_unless page_builder_enabled?, spree_base_cache_scope.call(section) do %>
1
+ <% cache_unless page_builder_enabled?, spree_storefront_base_cache_scope.call(section) do %>
2
2
  <div style="<%= section_styles(section) %>" class="image-with-text <%= 'right-aligned' if section.preferred_desktop_image_alignment == 'right' %>">
3
3
  <div class="page-container">
4
4
  <div class="lg:grid lg:grid-cols-12 lg:gap-6 image-with-text--container">
@@ -8,6 +8,7 @@
8
8
  <%= image_tag spree_image_url(section.image, width: 1000, height: nil),
9
9
  class: "w-full h-full object-cover",
10
10
  loading: :lazy,
11
+ alt: section.image_alt,
11
12
  sizes: "(max-width: 1024px) 100vw, 50vw",
12
13
  srcset: [640, 750, 828, 1080, 1200, 2000].map { |width|
13
14
  "#{spree_image_url(section.image, width: width / 2, height: nil)} #{width}w"
@@ -46,7 +47,7 @@
46
47
  <% when 'Spree::PageBlocks::Buttons' %>
47
48
  <div class="w-full image-with-text--buttons" <%= block_attributes(block) %>>
48
49
  <div class="inline-block">
49
- <div class="flex flex-col lg:flex-row gap-4">
50
+ <div class="flex flex-col gap-4 lg:flex-row">
50
51
  <% if block.link %>
51
52
  <%= page_builder_link_to block.link,
52
53
  label: block.link.label,
@@ -1,47 +1,51 @@
1
- <% img = section.image %>
1
+ <% loaded ||= false %>
2
2
 
3
- <div class="w-full flex justify-center items-center relative" style="<%= section_styles(section) %>">
4
- <% if img.attached? && img.variable? %>
3
+ <div class="w-full flex justify-center items-center relative min-h-[200px]" style="<%= section_styles(section) %>">
4
+ <% if loaded %>
5
+ <% img = section.image %>
6
+ <% if img.attached? && img.variable? %>
5
7
  <img
6
- class="w-full h-full absolute top-0 object-cover z-0"
8
+ class="object-cover absolute top-0 z-0 w-full h-full"
7
9
  style="opacity: <%= section.preferred_overlay_transparency %>%"
10
+ alt="<%= section.image_alt %>"
8
11
  src="<%= spree_image_url(img, width: 2000, height: nil) %>" />
9
- <% end %>
10
- <div class="w-full page-container flex flex-col text-center py-5 px-5 z-10">
11
- <% section.blocks.includes(:rich_text_text).each do |block| %>
12
- <% case block.type %>
13
- <% when 'Spree::PageBlocks::Heading' %>
14
- <h2 class='font-medium <%= block.preferred_size == 'small' ? 'text-xl lg:text-2xl' : block.preferred_size == 'medium' ? 'text-xl lg:text-3xl' : 'text-2xl lg:text-3xl' %>' <%= block_attributes(block) %>>
15
- <%= block.text.body %>
16
- </h2>
17
- <% when 'Spree::PageBlocks::Text' %>
18
- <div class='text-sm lg:text-base' <%= block_attributes(block) %>>
19
- <%= block.text.body %>
20
- </div>
21
- <% when 'Spree::PageBlocks::NewsletterForm' %>
22
- <%= form_for :newsletter, url: spree.newsletter_subscribers_path do |f| %>
23
- <div class="flex items-center flex-col md:flex-row w-full <%= block_css_classes(block) %>" <%= block_attributes(block) %>>
24
- <div class='relative w-full lg:w-[424px] flex'>
25
- <%= hidden_field_tag :section_id, section.id %>
26
- <%= f.email_field :email, placeholder: block.preferred_placeholder, required: true, class: 'focus:border-primary focus:ring-primary pr-36 text-sm bg-accent rounded-input border-accent py-2 px-4 w-full relative z-30 !leading-[46px]' %>
27
- <div class="absolute right-2 top-1/2 transform -translate-y-1/2 z-40">
28
- <%= f.submit block.preferred_button_text.html_safe, class: "#{block.preferred_button_style == 'secondary' ? 'btn-secondary' : 'btn-primary'} content-center" %>
12
+ <% end %>
13
+ <div class="w-full page-container flex flex-col text-center py-5 px-5 z-10">
14
+ <% section.blocks.includes(:rich_text_text).each do |block| %>
15
+ <% case block.type %>
16
+ <% when 'Spree::PageBlocks::Heading' %>
17
+ <h2 class='font-medium <%= block.preferred_size == 'small' ? 'text-xl lg:text-2xl' : block.preferred_size == 'medium' ? 'text-xl lg:text-3xl' : 'text-2xl lg:text-3xl' %>' <%= block_attributes(block) %>>
18
+ <%= block.text.body %>
19
+ </h2>
20
+ <% when 'Spree::PageBlocks::Text' %>
21
+ <div class='text-sm lg:text-base' <%= block_attributes(block) %>>
22
+ <%= block.text.body %>
23
+ </div>
24
+ <% when 'Spree::PageBlocks::NewsletterForm' %>
25
+ <%= form_for :newsletter, url: spree.newsletter_subscribers_path do |f| %>
26
+ <div class="flex items-center flex-col md:flex-row w-full <%= block_css_classes(block) %>" <%= block_attributes(block) %>>
27
+ <div class='relative w-full lg:w-[424px] flex'>
28
+ <%= hidden_field_tag :section_id, section.id %>
29
+ <%= f.email_field :email, placeholder: block.preferred_placeholder, required: true, class: 'focus:border-primary focus:ring-primary pr-36 text-sm bg-accent rounded-input border-accent py-2 px-4 w-full relative z-30 !leading-[46px]' %>
30
+ <div class="absolute right-2 top-1/2 transform -translate-y-1/2 z-40">
31
+ <%= f.submit block.preferred_button_text.html_safe, class: "#{block.preferred_button_style == 'secondary' ? 'btn-secondary' : 'btn-primary'} content-center" %>
32
+ </div>
29
33
  </div>
30
34
  </div>
31
- </div>
32
- <% end %>
33
- <% when 'Spree::PageBlocks::Subheading' %>
34
- <h3 class='<%= block.size == 'small' ? 'text-lg' : block.size == 'medium' ? 'text-xl' : 'text-xl' %>' <%= block_attributes(block) %>>
35
- <%= block.text.body %>
36
- </h3>
37
- <% when 'Spree::PageBlocks::Image' %>
38
- <div <%= block_attributes(block) %> class="flex justify-center w-full">
39
- <% if block.image.attached? && block.image.variable? %>
40
- <% image_style = "aspect-ratio: #{spree_asset_aspect_ratio(block.image)}; --desktop-height: #{block.preferred_height}px; --mobile-height: #{block.preferred_mobile_height}px;" %>
41
- <%= image_tag spree_image_url(block.image, width: 1000, height: 1000), height: block.preferred_height, class: "custom-desktop-height custom-mobile-height", style: image_style %>
42
35
  <% end %>
43
- </div>
36
+ <% when 'Spree::PageBlocks::Subheading' %>
37
+ <h3 class='<%= block.size == 'small' ? 'text-lg' : block.size == 'medium' ? 'text-xl' : 'text-xl' %>' <%= block_attributes(block) %>>
38
+ <%= block.text.body %>
39
+ </h3>
40
+ <% when 'Spree::PageBlocks::Image' %>
41
+ <div <%= block_attributes(block) %> class="flex justify-center w-full">
42
+ <% if block.image.attached? && block.image.variable? %>
43
+ <% image_style = "aspect-ratio: #{spree_asset_aspect_ratio(block.image)}; --desktop-height: #{block.preferred_height}px; --mobile-height: #{block.preferred_mobile_height}px;" %>
44
+ <%= image_tag spree_image_url(block.image, width: 1000, height: 1000), alt: block.image_alt, height: block.preferred_height, class: "custom-desktop-height custom-mobile-height", style: image_style %>
45
+ <% end %>
46
+ </div>
47
+ <% end %>
44
48
  <% end %>
45
- <% end %>
46
- </div>
47
- </div>
49
+ </div>
50
+ <% end %>
51
+ </div>
@@ -1,4 +1,4 @@
1
- <% cache_unless page_builder_enabled?, spree_base_cache_scope.call(section) do %>
1
+ <% cache_unless page_builder_enabled?, spree_storefront_base_cache_scope.call(section) do %>
2
2
  <div class="page-container">
3
3
  <h1 class="text-xl lg:text-2xl font-medium py-10 lg:pt-16 lg:pb-6" style="<%= section_heading_styles(section) %>">
4
4
  <%= section.preferred_title.presence || title %>