spree_storefront 5.1.0.beta2 → 5.1.0.beta4
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.
- checksums.yaml +4 -4
- data/app/controllers/spree/addresses_controller.rb +13 -1
- data/app/controllers/spree/store_controller.rb +17 -15
- data/app/helpers/spree/filters_helper.rb +5 -1
- data/app/views/spree/checkout/_address.html.erb +5 -0
- data/app/views/spree/checkout/_special_instructions.html.erb +10 -0
- data/app/views/spree/checkout/_summary.html.erb +45 -44
- data/app/views/themes/default/spree/shared/_order_details.html.erb +11 -0
- data/config/locales/en.yml +1 -0
- data/lib/generators/spree/storefront/install/templates/application.tailwind.css +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d87e34a80b138eb9d350488cba63aa076eaa9785ef1b2f320f856f83952556da
|
4
|
+
data.tar.gz: fa988b56f95b9d1033e9b7f1aa6aefbaf08a09ef85c619fd96233e0a6b8053e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba8d95c132ce0621b686138c32be1ad4dd9bdcf6512346339d09ce4dd19aca08b08c69476e99727806cdc98d06ed628fe43ac708443f0c8fcbb1e951b6f59ef2
|
7
|
+
data.tar.gz: 19690a21ff891abbb175cf4a0a2d0bdf6012bc03211f1f2af1f0cf8e3654706d95f02af86292e494a07aed903f4b566e8496235d96bc625d36c8084a602c4f82
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Spree
|
2
2
|
class AddressesController < Spree::StoreController
|
3
3
|
helper Spree::AddressesHelper
|
4
|
-
|
4
|
+
before_action :load_and_authorize_address, except: [:index]
|
5
5
|
|
6
6
|
def create
|
7
7
|
order_token = params[:order_token]
|
@@ -98,6 +98,18 @@ module Spree
|
|
98
98
|
Spree::Dependencies.address_update_service.constantize
|
99
99
|
end
|
100
100
|
|
101
|
+
def load_and_authorize_address
|
102
|
+
action = params[:action].to_sym
|
103
|
+
|
104
|
+
@address ||= if [:new, :create].include?(action)
|
105
|
+
Spree::Address.new(country: current_store.default_country, user: try_spree_current_user)
|
106
|
+
else
|
107
|
+
Spree::Address.find(params[:id])
|
108
|
+
end
|
109
|
+
|
110
|
+
authorize! action, @address
|
111
|
+
end
|
112
|
+
|
101
113
|
def address_changes_except
|
102
114
|
[]
|
103
115
|
end
|
@@ -123,29 +123,31 @@ module Spree
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def storefront_products_scope
|
126
|
-
current_store.products.active(current_currency)
|
126
|
+
@storefront_products_scope ||= current_store.products.active(current_currency)
|
127
127
|
end
|
128
128
|
|
129
129
|
def default_products_finder_params
|
130
|
-
|
130
|
+
@default_products_finder_params ||= begin
|
131
|
+
taxon = @taxon || current_taxon
|
131
132
|
|
132
|
-
|
133
|
+
filter = permitted_products_params.fetch(:filter, {}).dup
|
133
134
|
|
134
|
-
|
135
|
-
|
135
|
+
filter[:taxon_ids] ||= [taxon&.id.to_s].compact
|
136
|
+
filter[:taxons] = filter[:taxon_ids].join(',')
|
136
137
|
|
137
|
-
|
138
|
-
|
139
|
-
|
138
|
+
if filter.key?(:min_price) || filter.key?(:max_price)
|
139
|
+
min_price = filter[:min_price].presence || 0
|
140
|
+
max_price = filter[:max_price].presence || 'Infinity'
|
140
141
|
|
141
|
-
|
142
|
-
|
142
|
+
filter[:price] = [min_price, max_price].compact.join(',')
|
143
|
+
end
|
143
144
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
145
|
+
permitted_products_params.merge(
|
146
|
+
store: current_store,
|
147
|
+
filter: filter,
|
148
|
+
currency: current_currency
|
149
|
+
)
|
150
|
+
end
|
149
151
|
end
|
150
152
|
|
151
153
|
def storefront_products
|
@@ -76,10 +76,14 @@ module Spree
|
|
76
76
|
if filter_selected
|
77
77
|
default_storefront_filter_values_scope
|
78
78
|
else
|
79
|
-
|
79
|
+
all_option_values_scope
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
+
def all_option_values_scope
|
84
|
+
@all_option_values_scope ||= Spree::OptionValue.for_products(storefront_products_scope).distinct
|
85
|
+
end
|
86
|
+
|
83
87
|
def filter_values_for_filter(filter)
|
84
88
|
selected = single_option_filter_selected?(filter.name)
|
85
89
|
if filter.option_values.loaded?
|
@@ -61,6 +61,9 @@
|
|
61
61
|
<%= form.hidden_field :state_lock_version %>
|
62
62
|
<%= form.hidden_field :ship_address_id, data: { 'checkout-address-book-target': 'addressId' } %>
|
63
63
|
</div>
|
64
|
+
|
65
|
+
<%= render 'spree/checkout/special_instructions', form: form %>
|
66
|
+
|
64
67
|
<div>
|
65
68
|
<%= button_tag Spree.t(:save_and_continue),
|
66
69
|
data: {
|
@@ -140,6 +143,8 @@
|
|
140
143
|
</div>
|
141
144
|
</div>
|
142
145
|
|
146
|
+
<%= render 'spree/checkout/special_instructions', form: form %>
|
147
|
+
|
143
148
|
<%= hidden_field_tag 'save_user_address', true, data: { hook: "save_user_address" } %>
|
144
149
|
</div>
|
145
150
|
<div class="flex justify-end w-full">
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if current_store.prefers_special_instructions_enabled? %>
|
2
|
+
<div class="mt-8 mb-4">
|
3
|
+
<h5 class="font-body mb-3">
|
4
|
+
<%= I18n.t('activerecord.attributes.spree/order.special_instructions') %>
|
5
|
+
</h5>
|
6
|
+
<div class="form-group">
|
7
|
+
<%= form.text_area :special_instructions, class: 'w-full text-input', rows: 2, placeholder: Spree.t('storefront.checkout.special_instructions_placeholder') %>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
@@ -47,70 +47,71 @@
|
|
47
47
|
<span>
|
48
48
|
<%= Spree::Money.new(adjustments.sum(&:amount), currency: order.currency).to_html %>
|
49
49
|
</span>
|
50
|
-
|
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
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
-
|
67
|
-
|
68
|
-
|
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
|
-
|
74
|
-
|
75
|
-
|
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
|
-
|
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
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
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>Store credit:</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
|
-
|
116
|
+
</div>
|
117
|
+
<% end %>
|
@@ -24,6 +24,17 @@
|
|
24
24
|
<%= render partial: 'spree/shared/order_shipment', collection: shipments, as: :shipment, cached: spree_base_cache_scope %>
|
25
25
|
</ul>
|
26
26
|
|
27
|
+
<% if order.special_instructions.present? %>
|
28
|
+
<div class="p-4 lg:p-6 text-sm border">
|
29
|
+
<div class="uppercase tracking-widest mb-1">
|
30
|
+
<%= I18n.t('activerecord.attributes.spree/order.special_instructions') %>
|
31
|
+
</div>
|
32
|
+
<div class="!leading-[1.375rem] text-neutral-800">
|
33
|
+
<%= simple_format(order.special_instructions) %>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
<% end %>
|
37
|
+
|
27
38
|
<div class="mt-6 bg-accent mb-24">
|
28
39
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 lg:gap-6 p-4 lg:p-6 text-sm bg-border bg-accent-100">
|
29
40
|
<!-- billing address -->
|
data/config/locales/en.yml
CHANGED
@@ -37,6 +37,7 @@ en:
|
|
37
37
|
payment_processing_message: You will receive an email confirmation when your payment is processed.
|
38
38
|
shipping_not_available: Shipping not available
|
39
39
|
signup_for_an_account: Create an account for faster future purchases, order tracking, and more.
|
40
|
+
special_instructions_placeholder: Here you can add any special instructions for your order
|
40
41
|
store_credits_amount_applied: You applied a %{amount} store credit to your order.
|
41
42
|
thanks_for_your_order: Thanks %{name} for your order!
|
42
43
|
you_will_need_to_pay_only: You will need to pay only %{amount} with your payment method of choosing.
|
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.1.0.
|
4
|
+
version: 5.1.0.beta4
|
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-
|
11
|
+
date: 2025-06-04 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.1.0.
|
19
|
+
version: 5.1.0.beta4
|
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.1.0.
|
26
|
+
version: 5.1.0.beta4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: active_link_to
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -319,6 +319,7 @@ files:
|
|
319
319
|
- app/views/spree/checkout/_payment_sources.html.erb
|
320
320
|
- app/views/spree/checkout/_quick_checkout.html.erb
|
321
321
|
- app/views/spree/checkout/_sidebar.html.erb
|
322
|
+
- app/views/spree/checkout/_special_instructions.html.erb
|
322
323
|
- app/views/spree/checkout/_store_credit.html.erb
|
323
324
|
- app/views/spree/checkout/_summary.html.erb
|
324
325
|
- app/views/spree/checkout/_user_account.html.erb
|
@@ -549,9 +550,9 @@ licenses:
|
|
549
550
|
- AGPL-3.0-or-later
|
550
551
|
metadata:
|
551
552
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
552
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v5.1.0.
|
553
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v5.1.0.beta4
|
553
554
|
documentation_uri: https://docs.spreecommerce.org/
|
554
|
-
source_code_uri: https://github.com/spree/spree/tree/v5.1.0.
|
555
|
+
source_code_uri: https://github.com/spree/spree/tree/v5.1.0.beta4
|
555
556
|
post_install_message:
|
556
557
|
rdoc_options: []
|
557
558
|
require_paths:
|