spree_storefront 5.0.3 → 5.1.0.beta

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/storefront_page_builder.css +12 -7
  3. data/app/controllers/concerns/spree/locale_urls.rb +13 -1
  4. data/app/controllers/concerns/spree/storefront/devise_concern.rb +42 -0
  5. data/app/controllers/spree/account/wished_items_controller.rb +0 -2
  6. data/app/controllers/spree/addresses_controller.rb +5 -1
  7. data/app/controllers/spree/checkout_controller.rb +27 -9
  8. data/app/controllers/spree/contacts_controller.rb +1 -1
  9. data/app/controllers/spree/products_controller.rb +1 -3
  10. data/app/controllers/spree/store_controller.rb +16 -9
  11. data/app/controllers/spree/taxons_controller.rb +1 -3
  12. data/app/helpers/spree/analytics_helper.rb +6 -2
  13. data/app/helpers/spree/checkout_analytics_helper.rb +1 -1
  14. data/app/helpers/spree/checkout_helper.rb +1 -1
  15. data/app/helpers/spree/filters_helper.rb +1 -1
  16. data/app/helpers/spree/fonts_helper.rb +3 -1
  17. data/app/helpers/spree/page_helper.rb +15 -0
  18. data/app/helpers/spree/products_helper.rb +13 -1
  19. data/app/helpers/spree/storefront_helper.rb +12 -0
  20. data/app/helpers/spree/storefront_locale_helper.rb +3 -0
  21. data/app/helpers/spree/theme_helper.rb +76 -0
  22. data/app/helpers/spree/wishlist_helper.rb +3 -0
  23. data/app/javascript/spree/storefront/controllers/product_form_controller.js +21 -18
  24. data/app/javascript/spree/storefront/controllers/quantity_picker_controller.js +16 -9
  25. data/app/javascript/spree/storefront/controllers/slideover_controller.js +2 -0
  26. data/app/javascript/spree/storefront/controllers/wished_item_controller.js +4 -2
  27. data/app/views/devise/registrations/_form.html.erb +2 -2
  28. data/app/views/devise/sessions/new.html.erb +16 -0
  29. data/app/views/layouts/spree/checkout.html.erb +1 -1
  30. data/app/views/layouts/spree/storefront.html.erb +1 -1
  31. data/app/views/spree/account/wished_items/create.turbo_stream.erb +1 -0
  32. data/app/views/spree/addresses/edit.html.erb +4 -0
  33. data/app/views/spree/addresses/new.html.erb +3 -0
  34. data/app/views/spree/checkout/edit.html.erb +5 -3
  35. data/app/views/spree/line_items/create.turbo_stream.erb +1 -0
  36. data/app/views/spree/line_items/destroy.turbo_stream.erb +2 -0
  37. data/app/views/spree/products/show.html.erb +2 -1
  38. data/app/views/themes/default/spree/account/addresses/_address.html.erb +14 -4
  39. data/app/views/themes/default/spree/account/addresses/_edit_address_modal.html.erb +38 -0
  40. data/app/views/themes/default/spree/account/addresses/_new_address_modal.html.erb +38 -0
  41. data/app/views/themes/default/spree/account/addresses/index.html.erb +22 -2
  42. data/app/views/themes/default/spree/orders/_line_item_quantity.html.erb +1 -1
  43. data/app/views/themes/default/spree/orders/edit.html.erb +2 -0
  44. data/app/views/themes/default/spree/page_sections/_newsletter.html.erb +1 -1
  45. data/app/views/themes/default/spree/page_sections/_product_grid.html.erb +16 -9
  46. data/app/views/themes/default/spree/products/_add_to_cart_button.html.erb +8 -2
  47. data/app/views/themes/default/spree/products/_add_to_wishlist.html.erb +2 -0
  48. data/app/views/themes/default/spree/products/filters/_taxons.erb +5 -5
  49. data/app/views/themes/default/spree/shared/_error_messages.html.erb +1 -1
  50. data/lib/generators/spree/storefront/devise/devise_generator.rb +47 -0
  51. data/lib/generators/spree/storefront/devise/templates/user_passwords_controller.rb +17 -0
  52. data/lib/generators/spree/storefront/devise/templates/user_registrations_controller.rb +17 -0
  53. data/lib/generators/spree/storefront/devise/templates/user_sessions_controller.rb +17 -0
  54. data/lib/spree/storefront/engine.rb +7 -1
  55. metadata +13 -6
@@ -11,6 +11,8 @@
11
11
  <% else %>
12
12
  <%= render 'spree/orders/cart' %>
13
13
  <% end %>
14
+
15
+ <%= render_storefront_partials(:cart_partials) %>
14
16
  <% end %>
15
17
 
16
18
  <% if !turbo_frame_request? && !turbo_stream_request? %>
@@ -38,7 +38,7 @@
38
38
  <div <%= block_attributes(block) %> class="flex justify-center w-full">
39
39
  <% if block.image.attached? && block.image.variable? %>
40
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, width: block.preferred_width, class: "custom-desktop-height custom-mobile-height", style: image_style %>
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
42
  <% end %>
43
43
  </div>
44
44
  <% end %>
@@ -37,16 +37,23 @@
37
37
  </div>
38
38
  </div>
39
39
 
40
- <% if products %>
41
- <div style='<%= section_styles(section) %>'>
42
- <div class='page-container'>
43
- <div class='grid gap-y-8 gap-x-4 grid-cols-2 lg:grid-cols-4 lg:gap-x-6 lg:gap-y-10 mb-7' id='products'>
40
+ <div style="<%= section_styles(section) %>">
41
+ <div class="page-container">
42
+ <% if products.any? %>
43
+ <div class="grid gap-y-8 gap-x-4 grid-cols-2 lg:grid-cols-4 lg:gap-x-6 lg:gap-y-10 mb-7" id="products">
44
44
  <%= render 'spree/shared/products', products: products %>
45
45
  </div>
46
- </div>
47
- <%= render 'spree/products/show_more_button' %>
48
- </div>
49
46
 
50
- <%= render 'spree/products/json_ld_list', products: products unless turbo_frame_request? %>
51
- <% end %>
47
+ <%= render 'spree/products/show_more_button' %>
48
+ <%= render('spree/products/json_ld_list', products: products) unless turbo_frame_request? %>
49
+ <% else %>
50
+ <div class="grid">
51
+ <div class="text-center py-10">
52
+ <h2 class="text-xl font-semibold mb-2"><%= Spree.t(:no_products_found) %></h2>
53
+ <p class="text-sm"><%= Spree.t(:try_removing_filters) %></p>
54
+ </div>
55
+ </div>
56
+ <% end %>
57
+ </div>
58
+ </div>
52
59
  <% end %>
@@ -16,7 +16,10 @@ variant_not_available = selected_variant.nil? ||
16
16
  <%= button_tag type: (variant_not_available || not_all_options_selected ? 'button' : 'submit'),
17
17
  class: 'btn-primary btn-icon w-full h-12 add-to-cart-button',
18
18
  data: {
19
- action: ('modal#open' if variant_not_available),
19
+ action: [
20
+ 'click->product-form#showNotSelectedOptions',
21
+ ('click->modal#open' if variant_not_available)
22
+ ].compact.join(' '),
20
23
  product_form_target: 'submit'
21
24
  },
22
25
  disabled: product.price_in(current_currency).zero? do %>
@@ -38,7 +41,10 @@ variant_not_available = selected_variant.nil? ||
38
41
  <%= button_tag type: (variant_not_available || not_all_options_selected ? 'button' : 'submit'),
39
42
  class: 'btn-primary btn-icon w-full h-12 add-to-cart-button',
40
43
  data: {
41
- action: ('modal#open' if variant_not_available),
44
+ action: [
45
+ 'click->product-form#showNotSelectedOptions',
46
+ ('click->modal#open' if variant_not_available)
47
+ ].compact.join(' '),
42
48
  product_form_target: 'submit'
43
49
  },
44
50
  disabled: product.price_in(current_currency).zero? do %>
@@ -6,6 +6,8 @@
6
6
  <div class="wished-item-<%= variant.id %> h-full"
7
7
  data-controller="wished-item"
8
8
  data-wished-item-variant-id-value="<%= variant.id %>"
9
+ data-wished-item-create-wishlist-path-value="<%= spree.account_wishlist_wished_items_path %>"
10
+ data-wished-item-destroy-wishlist-path-value="<%= spree.account_wishlist_wished_item_path(variant.id) %>"
9
11
  >
10
12
  <%= button_tag type: 'submit',
11
13
  class: "#{css_classes} disabled:animate-pulse",
@@ -5,7 +5,7 @@
5
5
  class="st-accordion"
6
6
  data-controller='accordion'
7
7
  data-accordion-close-others-value="false">
8
- <%= link_to "#taxonomy_filter_#{taxonomy.id}", class: "cursor-pointer uppercase flex items-center justify-between h-10 px-4 lg:px-10 text-sm tracking-widest focus:outline-none transition duration-150 ease-in-out #{'st-accordion__icon--opened' if params[:filter].nil? || current_taxon.present? || permitted_products_params.dig(:filter, :taxon_ids)&.present?}", data: { action: 'accordion#toggle:prevent' } do %>
8
+ <%= link_to "#taxonomy_filter_#{taxonomy.id}", class: "cursor-pointer uppercase flex items-center justify-between h-10 px-4 lg:px-10 text-sm tracking-widest focus:outline-none transition duration-150 ease-in-out #{'st-accordion__icon--opened' if params[:filter].nil? || current_taxon.present? || permitted_products_params.dig(:filter, :taxonomy_ids, taxonomy.id.to_s, :taxon_ids).present?}", data: { action: 'accordion#toggle:prevent' } do %>
9
9
  <%= taxonomy.name.singularize %>
10
10
  <%= render 'spree/shared/icons/chevron_down' %>
11
11
  <% end %>
@@ -27,10 +27,10 @@
27
27
  <% first_taxons.each do |taxon| %>
28
28
  <li>
29
29
  <%= f.label "filter_taxon_#{taxon.id}", class: "flex items-center gap-2 cursor-pointer group text-sm h-10", data: { searchable_list_target: "item", text: taxon.name } do %>
30
- <%= f.check_box "filter[taxon_ids][]",
30
+ <%= f.check_box "filter[taxonomy_ids][#{taxonomy.id}][taxon_ids][]",
31
31
  {
32
32
  id: "filter_taxon_#{taxon.id}",
33
- checked: permitted_products_params.dig(:filter, :taxon_ids)&.include?(taxon.id.to_s),
33
+ checked: permitted_products_params.dig(:filter, :taxonomy_ids, taxonomy.id.to_s, :taxon_ids)&.include?(taxon.id.to_s),
34
34
  class: "input-checkbox group-focus-within:outline"
35
35
  },
36
36
  taxon.id,
@@ -49,10 +49,10 @@
49
49
  <% rest_of_the_taxons.each do |taxon| %>
50
50
  <li class="px-4 lg:px-10">
51
51
  <%= f.label "filter_taxon_#{taxon.id}", class: "flex items-center gap-2 cursor-pointer group text-sm h-10", data: { searchable_list_target: "item", text: taxon.name } do %>
52
- <%= f.check_box "filter[taxon_ids][]",
52
+ <%= f.check_box "filter[taxonomy_ids][#{taxonomy.id}][taxon_ids][]",
53
53
  {
54
54
  id: "filter_taxon_#{taxon.id}",
55
- checked: permitted_products_params.dig(:filter, :taxon_ids)&.include?(taxon.id.to_s),
55
+ checked: permitted_products_params.dig(:filter, :taxonomy_ids, taxonomy.id.to_s, :taxon_ids)&.include?(taxon.id.to_s),
56
56
  class: "input-checkbox group-focus-within:outline"
57
57
  },
58
58
  taxon.id,
@@ -1,5 +1,5 @@
1
1
  <% if target && target.errors.any? %>
2
- <div id="errorExplanation" class="alert-error text-center mb-4 p-2">
2
+ <div id="errorExplanation" class="<%= local_assigns[:class] || 'alert-error text-center mb-4 p-2' %>">
3
3
  <ul>
4
4
  <% target.errors.full_messages.each do |msg| %>
5
5
  <li><%= msg %></li>
@@ -0,0 +1,47 @@
1
+ require 'rails/generators'
2
+
3
+ module Spree
4
+ module Storefront
5
+ module Generators
6
+ class DeviseGenerator < Rails::Generators::Base
7
+ desc 'Installs Spree Storefront Devise controllers'
8
+
9
+ def self.source_paths
10
+ [
11
+ File.expand_path('templates', __dir__),
12
+ File.expand_path('../templates', "../#{__FILE__}"),
13
+ File.expand_path('../templates', "../../#{__FILE__}")
14
+ ]
15
+ end
16
+
17
+ def install
18
+ template 'user_sessions_controller.rb', 'app/controllers/spree/user_sessions_controller.rb'
19
+ template 'user_registrations_controller.rb', 'app/controllers/spree/user_registrations_controller.rb'
20
+ template 'user_passwords_controller.rb', 'app/controllers/spree/user_passwords_controller.rb'
21
+
22
+ # add devise routes
23
+ insert_into_file 'config/routes.rb', after: "Rails.application.routes.draw do\n" do
24
+ <<-ROUTES.strip_heredoc.indent!(2)
25
+ Spree::Core::Engine.add_routes do
26
+ # Storefront routes
27
+ scope '(:locale)', locale: /\#{Spree.available_locales.join('|')\}/, defaults: { locale: nil } do
28
+ devise_for(
29
+ Spree.user_class.model_name.singular_route_key,
30
+ class_name: Spree.user_class.to_s,
31
+ path: :user,
32
+ controllers: {
33
+ sessions: 'spree/user_sessions',
34
+ passwords: 'spree/user_passwords',
35
+ registrations: 'spree/user_registrations'
36
+ },
37
+ router_name: :spree
38
+ )
39
+ end
40
+ end
41
+ ROUTES
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,17 @@
1
+ module Spree
2
+ class UserPasswordsController < ::Devise::PasswordsController
3
+ include Spree::Storefront::DeviseConcern
4
+
5
+ protected
6
+
7
+ def translation_scope
8
+ 'devise.user_passwords'
9
+ end
10
+
11
+ private
12
+
13
+ def title
14
+ Spree.t(:forgot_password)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Spree
2
+ class UserRegistrationsController < ::Devise::RegistrationsController
3
+ include Spree::Storefront::DeviseConcern
4
+
5
+ protected
6
+
7
+ def translation_scope
8
+ 'devise.user_registrations'
9
+ end
10
+
11
+ private
12
+
13
+ def title
14
+ Spree.t(:sign_up)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Spree
2
+ class UserSessionsController < ::Devise::SessionsController
3
+ include Spree::Storefront::DeviseConcern
4
+
5
+ protected
6
+
7
+ def translation_scope
8
+ 'devise.user_sessions'
9
+ end
10
+
11
+ private
12
+
13
+ def title
14
+ Spree.t(:login)
15
+ end
16
+ end
17
+ end
@@ -7,11 +7,14 @@ module Spree
7
7
  :head_partials,
8
8
  :body_start_partials,
9
9
  :body_end_partials,
10
+ :cart_partials,
10
11
  :add_to_cart_partials,
11
12
  :remove_from_cart_partials,
12
13
  :checkout_partials,
13
14
  :checkout_complete_partials,
14
- :quick_checkout_partials
15
+ :quick_checkout_partials,
16
+ :product_partials,
17
+ :add_to_wishlist_partials
15
18
  )
16
19
 
17
20
  # accessible via Rails.application.config.spree_storefront
@@ -44,11 +47,14 @@ module Spree
44
47
  Rails.application.config.spree_storefront.head_partials = []
45
48
  Rails.application.config.spree_storefront.body_start_partials = []
46
49
  Rails.application.config.spree_storefront.body_end_partials = []
50
+ Rails.application.config.spree_storefront.cart_partials = []
47
51
  Rails.application.config.spree_storefront.add_to_cart_partials = []
48
52
  Rails.application.config.spree_storefront.remove_from_cart_partials = []
49
53
  Rails.application.config.spree_storefront.checkout_partials = []
50
54
  Rails.application.config.spree_storefront.checkout_complete_partials = []
51
55
  Rails.application.config.spree_storefront.quick_checkout_partials = []
56
+ Rails.application.config.spree_storefront.product_partials = []
57
+ Rails.application.config.spree_storefront.add_to_wishlist_partials = []
52
58
  end
53
59
  end
54
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_storefront
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.3
4
+ version: 5.1.0.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vendo Connect Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-06 00:00:00.000000000 Z
11
+ date: 2025-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.0.3
19
+ version: 5.1.0.beta
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.0.3
26
+ version: 5.1.0.beta
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: active_link_to
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -205,6 +205,7 @@ files:
205
205
  - app/controllers/concerns/spree/cart_methods.rb
206
206
  - app/controllers/concerns/spree/locale_urls.rb
207
207
  - app/controllers/concerns/spree/password_protected.rb
208
+ - app/controllers/concerns/spree/storefront/devise_concern.rb
208
209
  - app/controllers/concerns/spree/theme_concern.rb
209
210
  - app/controllers/spree/account/addresses_controller.rb
210
211
  - app/controllers/spree/account/base_controller.rb
@@ -371,6 +372,8 @@ files:
371
372
  - app/views/themes/default/spree/account/_order.html.erb
372
373
  - app/views/themes/default/spree/account/_orders.html.erb
373
374
  - app/views/themes/default/spree/account/addresses/_address.html.erb
375
+ - app/views/themes/default/spree/account/addresses/_edit_address_modal.html.erb
376
+ - app/views/themes/default/spree/account/addresses/_new_address_modal.html.erb
374
377
  - app/views/themes/default/spree/account/addresses/index.html.erb
375
378
  - app/views/themes/default/spree/account/newsletter/_newsletter_settings.html.erb
376
379
  - app/views/themes/default/spree/account/newsletter/edit.html.erb
@@ -514,6 +517,10 @@ files:
514
517
  - config/initializers/heroicon.rb
515
518
  - config/locales/en.yml
516
519
  - config/routes.rb
520
+ - lib/generators/spree/storefront/devise/devise_generator.rb
521
+ - lib/generators/spree/storefront/devise/templates/user_passwords_controller.rb
522
+ - lib/generators/spree/storefront/devise/templates/user_registrations_controller.rb
523
+ - lib/generators/spree/storefront/devise/templates/user_sessions_controller.rb
517
524
  - lib/generators/spree/storefront/install/install_generator.rb
518
525
  - lib/generators/spree/storefront/install/templates/application.tailwind.css
519
526
  - lib/generators/spree/storefront/install/templates/dev
@@ -542,9 +549,9 @@ licenses:
542
549
  - AGPL-3.0-or-later
543
550
  metadata:
544
551
  bug_tracker_uri: https://github.com/spree/spree/issues
545
- changelog_uri: https://github.com/spree/spree/releases/tag/v5.0.3
552
+ changelog_uri: https://github.com/spree/spree/releases/tag/v5.1.0.beta
546
553
  documentation_uri: https://docs.spreecommerce.org/
547
- source_code_uri: https://github.com/spree/spree/tree/v5.0.3
554
+ source_code_uri: https://github.com/spree/spree/tree/v5.1.0.beta
548
555
  post_install_message:
549
556
  rdoc_options: []
550
557
  require_paths: