spree_storefront 5.1.0.beta3 → 5.1.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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -1
  3. data/app/controllers/spree/account/gift_cards_controller.rb +15 -0
  4. data/app/controllers/spree/checkout_controller.rb +12 -6
  5. data/app/controllers/spree/line_items_controller.rb +14 -7
  6. data/app/controllers/spree/products_controller.rb +1 -1
  7. data/app/controllers/spree/search_controller.rb +1 -1
  8. data/app/controllers/spree/store_controller.rb +19 -17
  9. data/app/helpers/spree/cart_helper.rb +1 -1
  10. data/app/helpers/spree/checkout_helper.rb +1 -2
  11. data/app/helpers/spree/filters_helper.rb +34 -22
  12. data/app/helpers/spree/products_helper.rb +5 -1
  13. data/app/helpers/spree/storefront_helper.rb +6 -3
  14. data/app/javascript/spree/storefront/controllers/card_validation_controller.js +2 -0
  15. data/app/javascript/spree/storefront/controllers/cart_controller.js +5 -0
  16. data/app/views/devise/passwords/edit.html.erb +1 -1
  17. data/app/views/devise/registrations/new.html.erb +1 -1
  18. data/app/views/devise/shared/_links.html.erb +3 -3
  19. data/app/views/spree/addresses/edit.html.erb +2 -2
  20. data/app/views/spree/checkout/_address.html.erb +25 -38
  21. data/app/views/spree/checkout/_address_list_item.html.erb +14 -0
  22. data/app/views/spree/checkout/_coupon_code.html.erb +3 -3
  23. data/app/views/spree/checkout/_delivery.html.erb +3 -36
  24. data/app/views/spree/checkout/_delivery_backorder_notice.html.erb +10 -0
  25. data/app/views/spree/checkout/_delivery_shipping_rate.html.erb +22 -0
  26. data/app/views/spree/checkout/_line_item.html.erb +1 -1
  27. data/app/views/spree/checkout/_missing_all_line_items.html.erb +2 -2
  28. data/app/views/spree/checkout/_order_lock_version.html.erb +3 -0
  29. data/app/views/spree/checkout/_payment.html.erb +11 -9
  30. data/app/views/spree/checkout/_payment_methods.html.erb +1 -1
  31. data/app/views/spree/checkout/_store_credit.html.erb +1 -1
  32. data/app/views/spree/checkout/_summary.html.erb +45 -44
  33. data/app/views/spree/checkout/payment/_gateway.html.erb +12 -12
  34. data/app/views/spree/checkout/payment/_store_credit.html.erb +2 -2
  35. data/app/views/spree/checkout/update.turbo_stream.erb +1 -3
  36. data/app/views/spree/line_items/destroy.turbo_stream.erb +14 -10
  37. data/app/views/spree/seo/sitemap.xml.erb +2 -2
  38. data/app/views/themes/default/spree/account/_order.html.erb +5 -5
  39. data/app/views/themes/default/spree/account/gift_cards/_gift_card.html.erb +26 -0
  40. data/app/views/themes/default/spree/account/gift_cards/index.html.erb +30 -0
  41. data/app/views/themes/default/spree/checkout/complete.html.erb +1 -1
  42. data/app/views/themes/default/spree/orders/_line_item.html.erb +3 -3
  43. data/app/views/themes/default/spree/page_sections/_featured_posts.html.erb +56 -0
  44. data/app/views/themes/default/spree/page_sections/_featured_product.html.erb +1 -1
  45. data/app/views/themes/default/spree/page_sections/_featured_taxon.html.erb +2 -2
  46. data/app/views/themes/default/spree/page_sections/_featured_taxons.html.erb +4 -5
  47. data/app/views/themes/default/spree/policies/show.html.erb +11 -7
  48. data/app/views/themes/default/spree/posts/_post.html.erb +20 -11
  49. data/app/views/themes/default/spree/products/_add_to_cart_button.html.erb +4 -4
  50. data/app/views/themes/default/spree/products/_details.html.erb +1 -1
  51. data/app/views/themes/default/spree/products/_json_ld.html.erb +1 -1
  52. data/app/views/themes/default/spree/products/_json_ld_variant.html.erb +1 -1
  53. data/app/views/themes/default/spree/products/_media_gallery.html.erb +1 -2
  54. data/app/views/themes/default/spree/products/filters/_availability.html.erb +1 -1
  55. data/app/views/themes/default/spree/products/filters/_price.html.erb +4 -4
  56. data/app/views/themes/default/spree/products/filters/_taxons.erb +1 -1
  57. data/app/views/themes/default/spree/shared/_cart_icon.html.erb +4 -2
  58. data/app/views/themes/default/spree/shared/_cart_pane.html.erb +5 -2
  59. data/app/views/themes/default/spree/shared/_meta_tags.html.erb +2 -2
  60. data/app/views/themes/default/spree/shared/_order_shipment.html.erb +11 -12
  61. data/app/views/themes/default/spree/shared/icons/_discord.html.erb +9 -0
  62. data/config/locales/en.yml +10 -1
  63. data/config/routes.rb +1 -0
  64. data/lib/generators/spree/storefront/theme/templates/model.rb.tt +91 -4
  65. data/lib/spree/storefront/testing_support/cart_utils.rb +30 -0
  66. metadata +16 -6
@@ -1,19 +1,8 @@
1
1
  <%= form_for @order, url: spree.update_checkout_path(@order.token, @order.state), data: { controller: 'checkout-delivery' } do |form| %>
2
2
  <div class="mb-5">
3
- <%= turbo_frame_tag :checkout_lock_version do %>
4
- <%= hidden_field_tag 'order[state_lock_version]', @order.state_lock_version %>
5
- <% end %>
3
+ <%= render 'spree/checkout/order_lock_version', order: @order %>
6
4
  <div id="shipping-method">
7
- <% if @order.backordered_variants.any? %>
8
- <div class="alert rounded border border-default text-sm p-5 mb-6">
9
- Some products in your cart will be dispatched a bit later than the rest of your order:
10
- <ul class="list-disc list-inside flex-col flex space-y-1 mt-2">
11
- <% @order.backordered_variants.each do |variant| %>
12
- <li><%= variant.name %></li>
13
- <% end %>
14
- </ul>
15
- </div>
16
- <% end %>
5
+ <%= render 'spree/checkout/delivery_backorder_notice', order: @order %>
17
6
 
18
7
  <div id="methods">
19
8
  <%= form.fields_for :shipments do |ship_form| %>
@@ -27,28 +16,7 @@
27
16
  </h5>
28
17
  <ul class="rounded-md list-group mb-4 border border-default border-b-0 text-sm border-default" data-checkout-delivery-target="shippingList">
29
18
  <% ship_form.object.shipping_rates.includes(:shipping_method, :tax_rate).each do |rate| %>
30
- <li class="list-group-item p-0 m-0 border-b delivery-list-item border-default" data-checkout-delivery-target="shippingRate">
31
- <div class="custom-control custom-radio flex items-center px-5 py-4">
32
- <%= ship_form.radio_button :selected_shipping_rate_id,
33
- rate.id,
34
- class: 'custom-control-input radio-input',
35
- id: "shipping-rate-#{rate.id}",
36
- data: {
37
- action: 'click->checkout-delivery#update',
38
- cost: rate.display_cost,
39
- tax: rate.display_tax_amount
40
- } %>
41
- <label class="select-none cursor-pointer px-2 word-break w-full" for="<%= "shipping-rate-#{rate.id}" %>">
42
- <%= rate.name %>
43
- <% if rate.delivery_range %>
44
- <span class="text-gray-600 text-xs ml-3"><%= rate.display_delivery_range %></span>
45
- <% end %>
46
- </label>
47
- <span class="text-right">
48
- <%= rate.cost <= 0 ? Spree.t(:free) : rate.display_cost %>
49
- </span>
50
- </div>
51
- </li>
19
+ <%= render 'spree/checkout/delivery_shipping_rate', ship_form: ship_form, rate: rate %>
52
20
  <% end %>
53
21
  </ul>
54
22
  </div>
@@ -67,4 +35,3 @@
67
35
  </div>
68
36
  </div>
69
37
  <% end %>
70
-
@@ -0,0 +1,10 @@
1
+ <% if order.backordered_variants.any? %>
2
+ <div class="alert rounded border border-default text-sm p-5 mb-6">
3
+ <%= Spree.t("storefront.checkout.backorder_notice") %>
4
+ <ul class="list-disc list-inside flex-col flex space-y-1 mt-2">
5
+ <% order.backordered_variants.each do |variant| %>
6
+ <li><%= variant.name %></li>
7
+ <% end %>
8
+ </ul>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <li class="list-group-item p-0 m-0 border-b delivery-list-item border-default" data-checkout-delivery-target="shippingRate" id="<%= spree_dom_id(rate) %>">
2
+ <div class="custom-control custom-radio flex items-center px-5 py-4">
3
+ <%= ship_form.radio_button :selected_shipping_rate_id,
4
+ rate.id,
5
+ class: 'custom-control-input radio-input',
6
+ id: "shipping-rate-#{rate.id}",
7
+ data: {
8
+ action: 'click->checkout-delivery#update',
9
+ cost: rate.display_cost,
10
+ tax: rate.display_tax_amount
11
+ } %>
12
+ <label class="select-none cursor-pointer px-2 word-break w-full" for="<%= "shipping-rate-#{rate.id}" %>">
13
+ <%= rate.name %>
14
+ <% if rate.delivery_range %>
15
+ <span class="text-gray-600 text-xs ml-3"><%= rate.display_delivery_range %></span>
16
+ <% end %>
17
+ </label>
18
+ <span class="text-right">
19
+ <%= rate.cost <= 0 ? Spree.t(:free) : rate.display_cost %>
20
+ </span>
21
+ </div>
22
+ </li>
@@ -15,7 +15,7 @@
15
15
  <div class="font-semibold text-sm text-right shrink-0">
16
16
  <% if should_display_compare_at_price?(line_item.variant) %>
17
17
  <span class="line-through text-red-500">
18
- <%= Spree::Money.new(line_item.variant.compare_at_amount_in(line_item.currency) * line_item.quantity, currency: line_item.currency) %>
18
+ <%= line_item.display_compare_at_amount %>
19
19
  </span>
20
20
  <br />
21
21
  <% end %>
@@ -7,8 +7,8 @@
7
7
  <p class="mb-4"><%= Spree.t('errors.messages.no_shipping_methods_available') %> </p>
8
8
 
9
9
  <div class="flex justify-end items-center flex-wrap mt-6">
10
- <%= link_to 'Return to cart', spree.cart_path, class: 'mx-4 py-4', target: :_top %>
11
- <%= link_to 'Close', checkout_state_path(@order.token, @order.state), class: 'btn-primary font-semibold checkout-content-save-continue-button my-5 ml-4 !py-4', target: :_top %>
10
+ <%= link_to Spree.t("storefront.checkout.return_to_cart"), spree.cart_path, class: 'mx-4 py-4', target: :_top %>
11
+ <%= link_to Spree.t(:close), checkout_state_path(@order.token, @order.state), class: 'btn-primary font-semibold checkout-content-save-continue-button my-5 ml-4 !py-4', target: :_top %>
12
12
  </div>
13
13
  </div>
14
14
  </div>
@@ -0,0 +1,3 @@
1
+ <%= turbo_frame_tag :checkout_lock_version do %>
2
+ <%= hidden_field_tag 'order[state_lock_version]', order.state_lock_version %>
3
+ <% end %>
@@ -1,23 +1,25 @@
1
1
  <%= form_for @order, url: spree.update_checkout_path(@order.token, @order.state), html: { id: "checkout_form_#{@order.state}" } do |form| %>
2
- <%= form.hidden_field :state_lock_version %>
3
-
2
+ <%= render 'spree/checkout/order_lock_version', order: @order %>
3
+
4
4
  <% if @order.respond_to?(:gift_card) %>
5
5
  <%= turbo_frame_tag :gift_card_code_field do %>
6
6
  <%= hidden_field_tag 'order[gift_card_code]', @order.gift_card&.code %>
7
7
  <%= hidden_field_tag 'order[gift_card_amount]', @order.gift_card_total %>
8
8
  <% end %>
9
9
  <% end %>
10
-
11
- <% use_shipping = @order.shipping_eq_billing_address? || @order.bill_address.nil? || @order.bill_address.new_record? %>
12
-
10
+
11
+ <% use_shipping = (@order.shipping_eq_billing_address? || @order.bill_address.nil? || @order.bill_address.new_record?) && @order.requires_ship_address? %>
12
+
13
13
  <div id="billing-address" class="mb-8 max-w-full" data-controller="toggle">
14
14
  <h5 class="mb-3 font-body font-semibold">
15
15
  <%= Spree.t(:billing_address) %>
16
16
  </h5>
17
- <div class="flex items-center">
18
- <%= form.check_box :use_shipping, { checked: use_shipping, class: 'checkbox-input', data: { action: 'change->toggle#toggle' } } %>
19
- <%= form.label :use_shipping, Spree.t(:use_shipping_address), class: 'ml-1 cursor-pointer select-none' %>
20
- </div>
17
+ <% if @order.requires_ship_address? %>
18
+ <div class="flex items-center">
19
+ <%= form.check_box :use_shipping, { checked: use_shipping, class: 'checkbox-input', data: { action: 'change->toggle#toggle' } } %>
20
+ <%= form.label :use_shipping, Spree.t(:use_shipping_address), class: 'ml-1 cursor-pointer select-none' %>
21
+ </div>
22
+ <% end %>
21
23
  <%= form.fields_for :bill_address do |address_form| %>
22
24
  <div class="mt-4 <%= 'hidden' if use_shipping %>" data-toggle-target='toggleable'>
23
25
  <%= render partial: 'spree/addresses/form', locals: {
@@ -66,7 +66,7 @@
66
66
  class="btn-primary w-full lg:w-2/5 font-semibold checkout-content-save-continue-button my-5 !py-4"
67
67
  >
68
68
  <%= render 'button_processing', is_hidden: true %>
69
- <%= Spree.t(:pay).titleize %>
69
+ <%= Spree.t(:pay) %>
70
70
  </button>
71
71
  </div>
72
72
  <% end %>
@@ -11,7 +11,7 @@
11
11
  <%= check_box_tag :store_credit, '1', @order.using_store_credit?,
12
12
  class: 'input-checkbox !border-neutral-200 rounded-md',
13
13
  data: { action: 'auto-submit#submit' } %>
14
- <%= Spree.t("store_credit.apply") %>
14
+ <%= Spree.t(:apply_store_credit) %>
15
15
  <% end %>
16
16
 
17
17
  <div><%= @order.display_total_available_store_credit %></div>
@@ -47,70 +47,71 @@
47
47
  <span>
48
48
  <%= Spree::Money.new(adjustments.sum(&:amount), currency: order.currency).to_html %>
49
49
  </span>
50
- <% end %>
50
+ </div>
51
51
  <% end %>
52
52
  <% end %>
53
- <% elsif order.state == 'address' %>
54
- <div class="flex justify-between items-center mb-2">
55
- <span><%= Spree.t(:shipping) %>:</span>
56
- <span class="text-xs text-gray-500"><%= Spree.t('storefront.checkout.calculated_at_next_step') %></span>
57
- </div>
58
53
  <% end %>
54
+ <% elsif order.state == 'address' %>
55
+ <div class="flex justify-between items-center mb-2">
56
+ <span><%= Spree.t(:shipping) %>:</span>
57
+ <span class="text-xs text-gray-500"><%= Spree.t('storefront.checkout.calculated_at_next_step') %></span>
58
+ </div>
59
+ <% end %>
59
60
 
60
- <% if order.payment? || order.completed? %>
61
- <% cache spree_base_cache_scope.call(order.all_adjustments.nonzero.tax.eligible.cache_key_with_version) do %>
62
- <% order.all_adjustments.nonzero.tax.eligible.group_by(&:label).each do |label, adjustments| %>
63
- <div class="flex justify-between items-center mb-2">
64
- <span><%= label %></span>
61
+ <% if order.payment? || order.completed? %>
62
+ <% cache spree_base_cache_scope.call(order.all_adjustments.nonzero.tax.eligible.cache_key_with_version) do %>
63
+ <% order.all_adjustments.nonzero.tax.eligible.group_by(&:label).each do |label, adjustments| %>
64
+ <div class="flex justify-between items-center mb-2">
65
+ <span><%= label %></span>
65
66
 
66
- <% tax_total = Spree::Money.new(adjustments.sum(&:amount), currency: order.currency) %>
67
- <span><%= tax_total.to_html %></span>
68
- </div>
69
- <% end %>
67
+ <% tax_total = Spree::Money.new(adjustments.sum(&:amount), currency: order.currency) %>
68
+ <span><%= tax_total.to_html %></span>
69
+ </div>
70
70
  <% end %>
71
71
  <% end %>
72
+ <% end %>
72
73
 
73
- <% if order.adjustments.nonzero.non_tax.eligible.exists? %>
74
- <% order.adjustments.nonzero.non_tax.eligible.each do |adjustment| %>
75
- <div class="flex justify-between items-center mb-2">
74
+ <% if order.adjustments.nonzero.non_tax.eligible.exists? %>
75
+ <% order.adjustments.nonzero.non_tax.eligible.each do |adjustment| %>
76
+ <div class="flex justify-between items-center mb-2">
76
77
  <span>
77
78
  <%= adjustment.label %>:
78
79
  </span>
79
- <span>
80
+ <span>
80
81
  <%= adjustment.display_amount.to_html %>
81
82
  </span>
82
- </div>
83
- <% end %>
84
- <% end %>
85
-
86
- <% if order.respond_to?(:gift_card) && order.gift_card.present? %>
87
- <div class="flex justify-between items-center mb-2">
88
- <span><%= Spree.t(:gift_card) %>:</span>
89
- <span>-<%= order.display_gift_card_total %></span>
90
- </div>
91
- <% elsif order.using_store_credit? %>
92
- <div class="flex justify-between items-center mb-2">
93
- <span>Store credit:</span>
94
- <span><%= order.display_total_applied_store_credit %></span>
95
83
  </div>
96
84
  <% end %>
85
+ <% end %>
97
86
 
98
- <div>
99
- <div class="flex justify-between items-center">
100
- <span class="font-bold text-lg"><%= Spree.t(:total) %></span>
101
- <div class="">
102
- <span class="text-xs mr-1"><%= order.currency.upcase %></span>
103
- <span class="font-semibold text-lg inline" id='summary-order-total' data-currency="<%= Money::Currency.find(order.currency).symbol %>">
87
+ <% if order.respond_to?(:gift_card) && order.gift_card.present? %>
88
+ <div class="flex justify-between items-center mb-2">
89
+ <span><%= Spree.t(:gift_card) %>:</span>
90
+ <span>-<%= order.display_gift_card_total %></span>
91
+ </div>
92
+ <% elsif order.using_store_credit? %>
93
+ <div class="flex justify-between items-center mb-2">
94
+ <span><%= Spree.t(:store_credit_name) %>:</span>
95
+ <span><%= order.display_total_applied_store_credit %></span>
96
+ </div>
97
+ <% end %>
98
+
99
+ <div>
100
+ <div class="flex justify-between items-center">
101
+ <span class="font-bold text-lg"><%= Spree.t(:total) %></span>
102
+ <div class="">
103
+ <span class="text-xs mr-1"><%= order.currency.upcase %></span>
104
+ <span class="font-semibold text-lg inline" id='summary-order-total' data-currency="<%= Money::Currency.find(order.currency).symbol %>">
104
105
  <%= order.display_total_minus_store_credits.to_html %>
105
106
  </span>
106
- </div>
107
107
  </div>
108
108
  </div>
109
109
  </div>
110
- <% end %>
111
-
112
- <div id="checkout-message" class="mt-8">
113
- <%= current_store.checkout_message if current_store.checkout_message.present? %>
114
110
  </div>
111
+ <% end %>
112
+
113
+ <div id="checkout-message" class="mt-8">
114
+ <%= current_store.checkout_message if current_store.checkout_message.present? %>
115
115
  </div>
116
- <% end %>
116
+ </div>
117
+ <% end %>
@@ -11,7 +11,7 @@
11
11
  <div class="form-group mb-3 relative">
12
12
  <% options_hash = Rails.env.production? ? {autocomplete: 'off'} : {} %>
13
13
  <label for="card_number" class="block text-xs text-neutral-600 mb-1"><%= Spree.t(:card_number) %></label>
14
- <%= text_field_tag "#{param_prefix}[number]", '',
14
+ <%= text_field_tag "#{param_prefix}[number]", '',
15
15
  options_hash.merge(
16
16
  id: 'card_number',
17
17
  data: { card_validation_target: "number" },
@@ -23,7 +23,7 @@
23
23
  required: true
24
24
  )
25
25
  %>
26
- <div class="absolute right-2 top-7"
26
+ <div class="absolute right-2 top-7"
27
27
  data-card-validation-target="typeContainer"
28
28
  id="credit-card-type-container">
29
29
  </div>
@@ -32,37 +32,37 @@
32
32
  <div class="flex gap-3">
33
33
  <div class="form-group">
34
34
  <label for="card_expiry" class="block text-xs text-neutral-600 mb-1"><%= Spree.t(:expiration_date) %></label>
35
- <%= text_field_tag "#{param_prefix}[expiry]", '',
36
- id: 'card_expiry',
35
+ <%= text_field_tag "#{param_prefix}[expiry]", '',
36
+ id: 'card_expiry',
37
37
  class: 'text-input',
38
38
  data: {
39
39
  card_validation_target: "expiry"
40
40
  },
41
- placeholder: "MM/YYYY",
41
+ placeholder: Spree.t(:card_expiration_placeholder),
42
42
  required: true
43
43
  %>
44
44
  </div>
45
45
  <div class="form-group">
46
46
  <label for="card_code" class="block text-xs text-neutral-600 mb-1"><%= Spree.t(:cvv) %></label>
47
- <%= text_field_tag "#{param_prefix}[verification_value]", '',
47
+ <%= text_field_tag "#{param_prefix}[verification_value]", '',
48
48
  options_hash.merge(
49
- id: 'card_code',
50
- class: 'text-input',
49
+ id: 'card_code',
50
+ class: 'text-input',
51
51
  data: { card_validation_target: "cvv" },
52
52
  size: 4,
53
53
  maxlength: 4,
54
54
  pattern: '[0-9]*',
55
55
  inputmode: 'numeric',
56
- placeholder: Spree.t(:cvv),
56
+ placeholder: Spree.t(:cvv),
57
57
  required: true
58
- )
58
+ )
59
59
  %>
60
60
  </div>
61
61
  </div>
62
62
 
63
- <%= hidden_field_tag "#{param_prefix}[cc_type]", '',
63
+ <%= hidden_field_tag "#{param_prefix}[cc_type]", '',
64
64
  id: "cc_type",
65
- data: { card_validation_target: "ccType" }
65
+ data: { card_validation_target: "ccType" }
66
66
  %>
67
67
 
68
68
  <% PaymentIcon.credit_cards.each do |card| %>
@@ -2,12 +2,12 @@
2
2
  <div class="d-flex flex-column mb-5" data-hook="checkout_payment_store_credit_success">
3
3
  <p class="store-credit-title font-body">
4
4
  <% if @order.respond_to?(:gift_card) && @order.gift_card.present? %>
5
- <%= Spree.t('storefront.checkout.gift_card_amount_applied', amount: @order.display_gift_card_total, code: @order.gift_card.code) %>
5
+ <%= Spree.t('storefront.checkout.gift_card_amount_applied', amount: @order.display_gift_card_total, code: @order.gift_card.code.upcase) %>
6
6
  <% else %>
7
7
  <%= Spree.t('storefront.checkout.store_credits_amount_applied', amount: @order.display_total_applicable_store_credit.abs) %>
8
8
  <% end %>
9
9
 
10
- <%= Spree.t('storefront.checkout.you_will_need_to_pay_only', amount: @order.display_total_minus_store_credits) %>
10
+ <%= Spree.t('storefront.checkout.you_will_need_to_pay_only', amount: @order.display_total_minus_store_credits) if @order.total_minus_store_credits.positive? %>
11
11
  </p>
12
12
  </div>
13
13
  <% end %>
@@ -2,9 +2,7 @@
2
2
  <%= render 'summary', order: @order %>
3
3
  <% end %>
4
4
  <%= turbo_stream.replace :checkout_lock_version do %>
5
- <%= turbo_frame_tag :checkout_lock_version do %>
6
- <%= hidden_field_tag 'order[state_lock_version]', @order.state_lock_version %>
7
- <% end %>
5
+ <%= render 'spree/checkout/order_lock_version', order: @order %>
8
6
  <% end %>
9
7
  <%= turbo_stream.update 'summary-order-total' do %>
10
8
  <%= @order.display_total.to_html %>
@@ -1,13 +1,17 @@
1
- <%= turbo_stream.replace_all '.cart-contents' do %>
2
- <%= turbo_frame_tag cart_id(@order), class: 'cart-contents' do %>
3
- <% if @order.line_items.empty? %>
4
- <%= render 'spree/orders/empty' %>
5
- <% else %>
6
- <%= render 'spree/orders/cart' %>
7
- <% end %>
1
+ <% if flash[:error] %>
2
+ <%= spree_turbo_update_flashes %>
3
+ <% else %>
4
+ <%= turbo_stream.replace_all '.cart-contents' do %>
5
+ <%= turbo_frame_tag cart_id(@order), class: 'cart-contents' do %>
6
+ <% if @order.line_items.empty? %>
7
+ <%= render 'spree/orders/empty' %>
8
+ <% else %>
9
+ <%= render 'spree/orders/cart' %>
10
+ <% end %>
8
11
 
9
- <%= render_storefront_partials(:remove_from_cart_partials) %>
12
+ <%= render_storefront_partials(:remove_from_cart_partials) %>
13
+ <% end %>
10
14
  <% end %>
11
- <% end %>
12
15
 
13
- <%= spree_turbo_update_cart(@order) %>
16
+ <%= spree_turbo_update_cart(@order) %>
17
+ <% end %>
@@ -12,8 +12,8 @@
12
12
  <% end %>
13
13
  <% end %>
14
14
 
15
- <% cache [current_store.products, current_currency] do %>
16
- <% current_store.products.active(current_currency).find_each do |product| %>
15
+ <% cache [storefront_products_scope, current_currency] do %>
16
+ <% storefront_products_scope.find_each do |product| %>
17
17
  <url>
18
18
  <loc><%= spree_storefront_resource_url(product) %></loc>
19
19
  <lastmod><%= product.updated_at.strftime('%Y-%m-%d') %></lastmod>
@@ -8,16 +8,16 @@
8
8
  <% if order.payment_state == 'void' %>
9
9
  <% if order.order_refunded? %>
10
10
  <span class="badge-refunded">
11
- <%= Spree.t("payment_states.refunded").titleize %>
11
+ <%= Spree.t("payment_states.refunded") %>
12
12
  </span>
13
13
  <% else %>
14
14
  <span class="badge-void">
15
- <%= Spree.t("payment_states.#{order.payment_state}").titleize %>
15
+ <%= Spree.t("payment_states.#{order.payment_state}") %>
16
16
  </span>
17
17
  <% end %>
18
18
  <% else %>
19
19
  <span class="badge-success">
20
- <%= Spree.t("payment_states.#{order.payment_state}").titleize %>
20
+ <%= Spree.t("payment_states.#{order.payment_state}") %>
21
21
  </span>
22
22
  <% end %>
23
23
  <% end %>
@@ -26,11 +26,11 @@
26
26
  <% if order.shipment_state %>
27
27
  <% if order.shipment_state == 'shipped' %>
28
28
  <span class="badge-success">
29
- <%= Spree.t("shipment_states.#{order.shipment_state}").titleize %>
29
+ <%= Spree.t("shipment_states.#{order.shipment_state}") %>
30
30
  </span>
31
31
  <% else %>
32
32
  <span class="badge-<%= order.shipment_state %>">
33
- <%= Spree.t("shipment_states.#{order.shipment_state}").titleize %>
33
+ <%= Spree.t("shipment_states.#{order.shipment_state}") %>
34
34
  </span>
35
35
  <% end %>
36
36
  <% end %>
@@ -0,0 +1,26 @@
1
+ <tr class="flex flex-wrap w-full md:table-row md:h-[72px] border border-accent md:border-none mb-4 p-4 md:p-0 hover:bg-accent-100" id="<%= dom_id(gift_card) %>">
2
+ <td class="mb-4 w-full md:w-auto md:px-4 md:border-y border-accent md:border-l font-medium">
3
+ <%= gift_card.code.upcase %>
4
+ </td>
5
+
6
+ <td class="mb-4 w-full md:w-auto md:px-4 md:border-y border-accent">
7
+ <span class="<%= gift_card.active? ? 'badge-active' : 'badge-inactive'%>">
8
+ <%= gift_card.display_state.titleize %>
9
+ </span>
10
+ </td>
11
+
12
+ <td class="w-full md:w-auto md:px-4 md:border-y border-accent">
13
+ <span class="md:hidden font-medium mr-1"><%= Spree.t(:amount) %>:</span>
14
+ <%= gift_card.display_amount %>
15
+ </td>
16
+
17
+ <td class="w-full md:w-auto md:px-4 md:border-y border-accent">
18
+ <span class="md:hidden font-medium mr-1"><%= Spree.t(:used) %>:</span>
19
+ <%= gift_card.display_amount_used %>
20
+ </td>
21
+
22
+ <td class="w-full md:w-auto md:px-4 md:border-y md:border-r border-accent">
23
+ <span class="md:hidden font-medium mr-1"><%= Spree.t(:expires_at) %>:</span>
24
+ <%= gift_card.expires_at.present? ? local_date(gift_card.expires_at) : '-' %>
25
+ </td>
26
+ </tr>
@@ -0,0 +1,30 @@
1
+ <div class="page-container grid grid-cols-1 lg:grid-cols-12 lg:gap-6 lg:mt-6">
2
+ <div class="lg:col-span-3">
3
+ <%= render 'spree/account/account_nav', current: 'gift_cards' %>
4
+ </div>
5
+ <div class="lg:col-span-8 lg:col-start-5">
6
+ <h1 class="font-medium mb-4">
7
+ <%= Spree.t(:gift_cards) %>
8
+ </h1>
9
+ <% if @gift_cards.any? %>
10
+ <table class="inline-table md:table table-auto overflow-scroll w-full text-sm border-separate border-spacing-y-4 mb-24 mt-4">
11
+ <thead class="hidden md:table-row-group">
12
+ <tr class="text-left text-neutral text-xs">
13
+ <th class="font-normal px-4"><%= Spree.t(:code) %></th>
14
+ <th class="font-normal px-4"><%= Spree.t(:status) %></th>
15
+ <th class="font-normal px-4"><%= Spree.t(:amount) %></th>
16
+ <th class="font-normal px-4"><%= Spree.t(:used) %></th>
17
+ <th class="font-normal px-4"><%= Spree.t(:expires_at) %></th>
18
+ </tr>
19
+ </thead>
20
+ <tbody class="block md:table-row-group">
21
+ <%= render collection: @gift_cards, partial: 'spree/account/gift_cards/gift_card', cached: spree_base_cache_scope %>
22
+ </tbody>
23
+ </table>
24
+ <% else %>
25
+ <div class="text-center my-16 lg:my14">
26
+ <p class="mb-2 font-medium uppercase"><%= Spree.t('storefront.account.no_gift_cards') %></p>
27
+ </div>
28
+ <% end %>
29
+ </div>
30
+ </div>
@@ -24,7 +24,7 @@
24
24
  <div class="mt-3 border-t pt-3">
25
25
  <span class="text-sm"><%= Spree.t(:status) %></span>
26
26
  <% if @order.payment_state.present? %>
27
- <span class="badge-<%= @order.payment_state %>"><%= Spree.t("payment_states.#{@order.payment_state}").titleize %></span>
27
+ <span class="badge-<%= @order.payment_state %>"><%= Spree.t("payment_states.#{@order.payment_state}") %></span>
28
28
  <% else %>
29
29
  <span class="badge-pending"><%= Spree.t(:pending) %></span>
30
30
  <% end %>
@@ -1,5 +1,5 @@
1
- <%= turbo_frame_tag dom_id(line_item), data: { controller: 'reveal' } do %>
2
- <li class="cart-line-item flex items-top py-6 px-4 w-full" data-reveal-target="item">
1
+ <%= turbo_frame_tag dom_id(line_item) do %>
2
+ <li class="cart-line-item flex items-top py-6 px-4 w-full">
3
3
  <div class="line-item-overlay"></div>
4
4
  <div class="cart-product-image flex-shrink-0" id="<%= dom_id(line_item) %>-image" data-turbo-permanent>
5
5
  <% image = line_item.variant.default_image %>
@@ -14,7 +14,7 @@
14
14
  <%= link_to line_item.name, spree_storefront_resource_url(line_item.product), class: 'font-semibold text-text', data: { 'turbo-frame': '_top' } %>
15
15
 
16
16
  <%= 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| %>
17
- <%= button_tag type: :submit, class: 'remove-line-item-button h-100', data: { action: "click->reveal#hide click->cart#disableCart" } do %>
17
+ <%= button_tag type: :submit, class: 'remove-line-item-button h-100', data: { action: "click->cart#disableCart turbo-stream-form:submit-end->cart#enableCart" } do %>
18
18
  <%= render 'spree/shared/icons/cross', size: 16 %>
19
19
  <% end %>
20
20
  <% end %>
@@ -0,0 +1,56 @@
1
+ <div style='<%= section_styles(section) %>' class='animate-fadeIn'>
2
+ <div class='page-container'>
3
+ <% heading_size =
4
+ case section.preferred_heading_size
5
+ when "small"
6
+ "text-base font-medium"
7
+ when "medium"
8
+ "text-lg lg:text-xl font-medium"
9
+ when "large"
10
+ "text-xl lg:text-2xl font-medium"
11
+ end %>
12
+ <% if section.preferred_heading.present? %>
13
+ <div class='mb-8 flex flex-col'>
14
+ <h3
15
+ class='
16
+ <%= heading_size %> featured-taxon--title font-medium
17
+ text-<%= section.preferred_heading_alignment %>
18
+ '
19
+ data-title="<%= section.preferred_heading.downcase %>"
20
+ style='<%= section_heading_styles(section) %>'
21
+ >
22
+ <%= section.preferred_heading %>
23
+ </h3>
24
+
25
+ <% if section.description.present? %>
26
+ <div class='pt-4 text-<%= section.preferred_description_alignment %>'>
27
+ <%= section.description %>
28
+ </div>
29
+ <% end %>
30
+ </div>
31
+ <% end %>
32
+ <div class='flex h-full relative'>
33
+ <div
34
+ class='
35
+ swiper-container overflow-hidden flex-1 pr-8 lg:pr-0 -mx-4 lg:mx-0 flex flex-col
36
+ lg:flex-col-reverse
37
+ '
38
+ data-controller='carousel'
39
+ data-carousel-options-value='{ "slidesPerView": 1, "centeredSlides": false, "spaceBetween": 16, "grabCursor": true, "breakpoints": { "768": { "slidesPerView": 3, "spaceBetween": 24 } }, "navigation": { "nextEl": ".swiper-custom-button-next-<%= section.id %>", "prevEl": ".swiper-custom-button-prev-<%= section.id %>" } }'
40
+ >
41
+ <div class='swiper-wrapper px-4 lg:px-0 h-auto'>
42
+ <%= render partial: "spree/posts/post",
43
+ collection: section.posts,
44
+ cached: spree_base_cache_scope,
45
+ as: :post %>
46
+ </div>
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 %>
48
+ <%= render "spree/shared/icons/chevron" %>
49
+ <% end %>
50
+ <%= button_tag class: "absolute p-2 bg-white rounded-full z-10 border border-accent right-0 disabled:hidden hover:border-primary mr-2 lg:mr-0 swiper-custom-button-next-#{section.id} block top-[100px]", aria: { label: "Next posts" }, style: "transform: translate(50%, -50%);" do %>
51
+ <%= render "spree/shared/icons/chevron_right" %>
52
+ <% end %>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </div>
@@ -89,7 +89,7 @@
89
89
  <% if presenter.product %>
90
90
  <div class="absolute flex" data-controller="copy-input">
91
91
  <div class="has-float-label flex flex-col max-w-[200px]">
92
- <%= text_field_tag "product-#{presenter.product.id}-share-link", spree.product_url(presenter.product, host: current_store.url), class: 'text-ellipsis text-input border-r-0 !rounded-r-none !rounded-l-md', readonly: true, type: 'text', onclick: 'this.select()', data: { copy_input_target: 'input' } %>
92
+ <%= text_field_tag "product-#{presenter.product.id}-share-link", spree.product_url(presenter.product, host: current_store.url_or_custom_domain), class: 'text-ellipsis text-input border-r-0 !rounded-r-none !rounded-l-md', readonly: true, type: 'text', onclick: 'this.select()', data: { copy_input_target: 'input' } %>
93
93
  <%= label_tag "product-#{presenter.product.id}-share-link", Spree.t(:link) %>
94
94
  </div>
95
95
  <button