spree_frontend 4.2.0.rc1 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/frontend.js +11 -1
- data/app/assets/javascripts/spree/frontend/account.js +1 -1
- data/app/assets/javascripts/spree/frontend/cart.js +24 -2
- data/app/assets/javascripts/spree/frontend/checkout/address.js +60 -43
- data/app/assets/javascripts/spree/frontend/checkout/shipment.js +15 -2
- data/app/assets/javascripts/spree/frontend/coupon_manager.js +2 -2
- data/app/assets/javascripts/spree/frontend/currency.js +11 -0
- data/app/assets/javascripts/spree/frontend/locale.js +11 -0
- data/app/assets/javascripts/spree/frontend/views/spree/product/related.js +2 -2
- data/app/assets/javascripts/spree/frontend/views/spree/products/cart_form.js +1 -1
- data/app/assets/stylesheets/spree/frontend/application.scss +0 -3
- data/app/assets/stylesheets/spree/frontend/functions.scss +1 -0
- data/app/assets/stylesheets/spree/frontend/variables/bootstrap-overrides.scss +2 -2
- data/app/assets/stylesheets/spree/frontend/variables/helper-variables.scss +1 -0
- data/app/assets/stylesheets/spree/frontend/variables/variables.scss +54 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/checkout/confirm.scss +27 -22
- data/app/assets/stylesheets/spree/frontend/views/spree/checkout/edit.scss +3 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/orders/show.scss +3 -0
- data/app/controllers/concerns/spree/checkout/address_book.rb +9 -7
- data/app/controllers/concerns/spree/locale_urls.rb +23 -0
- data/app/controllers/spree/addresses_controller.rb +1 -0
- data/app/controllers/spree/checkout_controller.rb +8 -8
- data/app/controllers/spree/currency_controller.rb +6 -10
- data/app/controllers/spree/home_controller.rb +5 -1
- data/app/controllers/spree/locale_controller.rb +23 -6
- data/app/controllers/spree/orders_controller.rb +2 -2
- data/app/controllers/spree/products_controller.rb +6 -5
- data/app/controllers/spree/store_controller.rb +7 -13
- data/app/controllers/spree/taxons_controller.rb +4 -3
- data/app/helpers/spree/addresses_helper.rb +19 -8
- data/app/helpers/spree/cache_helper.rb +7 -0
- data/app/helpers/spree/frontend_helper.rb +17 -25
- data/app/helpers/spree/navigation_helper.rb +6 -1
- data/app/helpers/spree/store_helper.rb +39 -0
- data/app/helpers/spree/taxons_helper.rb +1 -1
- data/app/models/spree/frontend_configuration.rb +2 -1
- data/app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb +2 -2
- data/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb +2 -2
- data/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb +2 -2
- data/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb +2 -2
- data/app/views/kaminari/twitter-bootstrap-4/_page.html.erb +2 -2
- data/app/views/kaminari/twitter-bootstrap-4/_paginator.html.erb +2 -2
- data/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb +2 -2
- data/app/views/spree/address/_form.html.erb +15 -16
- data/app/views/spree/addresses/_form.html.erb +1 -1
- data/app/views/spree/addresses/edit.html.erb +2 -2
- data/app/views/spree/addresses/new.html.erb +2 -2
- data/app/views/spree/checkout/_address.html.erb +4 -6
- data/app/views/spree/checkout/_confirm.html.erb +1 -33
- data/app/views/spree/checkout/_credit_card.html.erb +2 -2
- data/app/views/spree/checkout/_delivery_informations.html.erb +43 -36
- data/app/views/spree/checkout/_summary.html.erb +3 -5
- data/app/views/spree/checkout/payment/_gateway.html.erb +1 -1
- data/app/views/spree/home/index.html.erb +21 -22
- data/app/views/spree/locale/index.html.erb +1 -0
- data/app/views/spree/orders/_coupon_code.html.erb +2 -3
- data/app/views/spree/orders/_line_item.html.erb +2 -2
- data/app/views/spree/orders/_line_item_data.html.erb +2 -2
- data/app/views/spree/orders/edit.html.erb +2 -3
- data/app/views/spree/orders/show.html.erb +1 -71
- data/app/views/spree/products/_cart_form.html.erb +4 -7
- data/app/views/spree/products/_color_option_type.html.erb +2 -3
- data/app/views/spree/products/_filters_desktop.html.erb +1 -2
- data/app/views/spree/products/_gallery.html.erb +4 -6
- data/app/views/spree/products/_gallery_modal.html.erb +3 -5
- data/app/views/spree/products/_option_type.html.erb +1 -2
- data/app/views/spree/products/_sort_mobile.html.erb +4 -4
- data/app/views/spree/products/related.html.erb +11 -5
- data/app/views/spree/products/show.html.erb +1 -5
- data/app/views/spree/shared/_carousel_4_products.html.erb +6 -12
- data/app/views/spree/shared/_color_select.html.erb +3 -3
- data/app/views/spree/shared/_currency_dropdown.html.erb +13 -0
- data/app/views/spree/shared/_delete_address_popup.html.erb +1 -2
- data/app/views/spree/shared/_error_messages.html.erb +2 -2
- data/app/views/spree/shared/_footer.html.erb +4 -4
- data/app/views/spree/shared/_head.html.erb +5 -1
- data/app/views/spree/shared/_header.html.erb +1 -1
- data/app/views/spree/shared/_internationalization_options.html.erb +31 -0
- data/app/views/spree/shared/_line_item.html.erb +2 -2
- data/app/views/spree/shared/_link_to_account.html.erb +5 -5
- data/app/views/spree/shared/_locale_dropdown.html.erb +13 -0
- data/app/views/spree/shared/_login.html.erb +1 -1
- data/app/views/spree/shared/_main_nav_bar.html.erb +1 -1
- data/app/views/spree/shared/_mobile_internationalization_options.html.erb +37 -0
- data/app/views/spree/shared/_mobile_navigation.html.erb +3 -6
- data/app/views/spree/shared/_nav_bar.html.erb +5 -5
- data/app/views/spree/shared/_no_product_available.html.erb +1 -1
- data/app/views/spree/shared/_option_values.html.erb +1 -1
- data/app/views/spree/shared/_order_details.html.erb +117 -174
- data/app/views/spree/shared/_payment.html.erb +2 -2
- data/app/views/spree/shared/_payment_sources.html.erb +2 -2
- data/app/views/spree/shared/_product_added_modal.html.erb +1 -1
- data/app/views/spree/shared/_search.html.erb +1 -2
- data/app/views/spree/shared/_translations.html.erb +6 -6
- data/app/views/spree/shared/carousel/_single.html.erb +6 -11
- data/app/views/spree/shared/carousel/_thumbnails.html.erb +5 -11
- data/app/views/spree/users/_address.html.erb +1 -1
- data/app/views/spree/users/_address_controls.html.erb +1 -2
- data/app/views/spree/users/show.html.erb +4 -4
- data/config/initializers/canonical_rails.rb +1 -1
- data/config/routes.rb +26 -30
- data/lib/generators/spree/frontend/copy_storefront/copy_storefront_generator.rb +1 -7
- data/lib/generators/spree/frontend/install/install_generator.rb +34 -0
- data/lib/generators/spree/frontend/install/templates/config/initializers/spree_storefront.rb +1 -0
- data/lib/generators/spree/frontend/install/templates/config/spree_storefront.yml +99 -0
- data/spree_frontend.gemspec +2 -2
- metadata +27 -19
- data/app/views/spree/products/_vendor_info.html.erb +0 -13
- data/app/views/spree/shared/_change_store.html.erb +0 -25
- data/app/views/spree/shared/_mobile_change_store.html.erb +0 -30
- data/app/views/spree/shared/forbidden.html.erb +0 -0
- data/app/views/spree/shared/unauthorized.html.erb +0 -0
@@ -2,11 +2,6 @@
|
|
2
2
|
display: flex;
|
3
3
|
flex-direction: column;
|
4
4
|
|
5
|
-
div:first-child {
|
6
|
-
-webkit-flex: 0;
|
7
|
-
flex-shrink: 0;
|
8
|
-
}
|
9
|
-
|
10
5
|
&-order-details {
|
11
6
|
padding-bottom: 40px;
|
12
7
|
font-weight: 500;
|
@@ -36,6 +31,9 @@
|
|
36
31
|
}
|
37
32
|
|
38
33
|
&-line-items {
|
34
|
+
@include media-breakpoint-down(sm) {
|
35
|
+
flex-basis: 100%;
|
36
|
+
}
|
39
37
|
@include media-breakpoint-up(lg) {
|
40
38
|
border: none;
|
41
39
|
flex: 1 1 0;
|
@@ -48,15 +46,6 @@
|
|
48
46
|
&-line-item {
|
49
47
|
$self: &;
|
50
48
|
|
51
|
-
a {
|
52
|
-
max-width: 50%;
|
53
|
-
margin-right: 20px;
|
54
|
-
|
55
|
-
@include media-breakpoint-up(lg) {
|
56
|
-
margin-right: 40px;
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
49
|
img {
|
61
50
|
width: 90px;
|
62
51
|
height: auto;
|
@@ -73,14 +62,28 @@
|
|
73
62
|
&-name {
|
74
63
|
font-size: font-px-to-rem(14px);
|
75
64
|
border-top: 1px solid $global-border-style;
|
65
|
+
margin-right: 20px;
|
76
66
|
|
77
|
-
|
78
|
-
|
67
|
+
&-image {
|
68
|
+
padding-right: 16px;
|
79
69
|
}
|
80
70
|
|
81
|
-
|
82
|
-
|
83
|
-
|
71
|
+
&-link {
|
72
|
+
max-width: 50%;
|
73
|
+
|
74
|
+
@include media-breakpoint-up(lg) {
|
75
|
+
margin-right: 40px;
|
76
|
+
}
|
77
|
+
|
78
|
+
|
79
|
+
@include media-breakpoint-up(sm) {
|
80
|
+
font-size: font-px-to-rem(27px);
|
81
|
+
}
|
82
|
+
|
83
|
+
@include media-breakpoint-up(lg) {
|
84
|
+
font-size: font-px-to-rem(22px);
|
85
|
+
width: 55%;
|
86
|
+
}
|
84
87
|
}
|
85
88
|
|
86
89
|
&-options {
|
@@ -185,6 +188,8 @@
|
|
185
188
|
}
|
186
189
|
|
187
190
|
&-delivery-informations {
|
191
|
+
flex-basis: 100%;
|
192
|
+
|
188
193
|
div:first-child {
|
189
194
|
flex-shrink: unset;
|
190
195
|
-webkit-flex: unset;
|
@@ -253,9 +258,9 @@
|
|
253
258
|
}
|
254
259
|
|
255
260
|
#checkout-summary {
|
256
|
-
|
257
|
-
@include media-breakpoint-
|
258
|
-
margin-top:
|
261
|
+
flex: 1 1 0;
|
262
|
+
@include media-breakpoint-down(sm) {
|
263
|
+
margin-top: 20px;
|
259
264
|
}
|
260
265
|
}
|
261
266
|
}
|
@@ -32,21 +32,23 @@ module Spree
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def normalize_addresses
|
35
|
-
return unless params[:state] == 'address' && @order.bill_address_id
|
35
|
+
return unless params[:state] == 'address' && @order.bill_address_id
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
if @order.checkout_steps.include?('delivery')
|
38
|
+
return unless @order.ship_address_id
|
39
|
+
end
|
39
40
|
|
40
41
|
bill_address = @order.bill_address
|
41
42
|
ship_address = @order.ship_address
|
43
|
+
|
44
|
+
if params[:save_user_address].present? && try_spree_current_user.present?
|
45
|
+
[bill_address, ship_address].each { |address| address&.update_attribute(:user_id, try_spree_current_user&.id) }
|
46
|
+
end
|
47
|
+
|
42
48
|
if @order.bill_address_id != @order.ship_address_id && bill_address == ship_address
|
43
49
|
@order.update_column(:bill_address_id, ship_address.id)
|
44
50
|
bill_address.destroy
|
45
|
-
elsif params[:save_user_address]
|
46
|
-
bill_address.update_attribute(:user_id, try_spree_current_user&.id)
|
47
51
|
end
|
48
|
-
|
49
|
-
ship_address.update_attribute(:user_id, try_spree_current_user&.id) if params[:save_user_address]
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Spree
|
2
|
+
module LocaleUrls
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
before_action :redirect_to_default_locale
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def default_url_options
|
12
|
+
return super if locale_param.nil?
|
13
|
+
|
14
|
+
super.merge(locale: locale_param)
|
15
|
+
end
|
16
|
+
|
17
|
+
def redirect_to_default_locale
|
18
|
+
return if params[:locale].blank? || supported_locale?(params[:locale])
|
19
|
+
|
20
|
+
redirect_to url_for(request.parameters.merge(locale: nil))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -37,6 +37,7 @@ module Spree
|
|
37
37
|
else
|
38
38
|
new_address = @address.clone
|
39
39
|
new_address.attributes = address_params
|
40
|
+
new_address.user_id = @address.user_id
|
40
41
|
@address.update_attribute(:deleted_at, Time.current)
|
41
42
|
if new_address.save
|
42
43
|
flash[:notice] = Spree.t(:successfully_updated, scope: :address_book)
|
@@ -35,7 +35,7 @@ module Spree
|
|
35
35
|
@order.temporary_address = !params[:save_user_address]
|
36
36
|
unless @order.next
|
37
37
|
flash[:error] = @order.errors.full_messages.join("\n")
|
38
|
-
redirect_to(checkout_state_path(@order.state)) && return
|
38
|
+
redirect_to(spree.checkout_state_path(@order.state)) && return
|
39
39
|
end
|
40
40
|
|
41
41
|
if @order.completed?
|
@@ -43,7 +43,7 @@ module Spree
|
|
43
43
|
flash['order_completed'] = true
|
44
44
|
redirect_to completion_route
|
45
45
|
else
|
46
|
-
redirect_to checkout_state_path(@order.state)
|
46
|
+
redirect_to spree.checkout_state_path(@order.state)
|
47
47
|
end
|
48
48
|
else
|
49
49
|
render :edit
|
@@ -77,7 +77,7 @@ module Spree
|
|
77
77
|
if @order.state != correct_state && !skip_state_validation?
|
78
78
|
flash.keep
|
79
79
|
@order.update_column(:state, correct_state)
|
80
|
-
redirect_to checkout_state_path(@order.state)
|
80
|
+
redirect_to spree.checkout_state_path(@order.state)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -108,7 +108,7 @@ module Spree
|
|
108
108
|
|
109
109
|
def set_state_if_present
|
110
110
|
if params[:state]
|
111
|
-
redirect_to checkout_state_path(@order.state) if @order.can_go_to_state?(params[:state]) && !skip_state_validation?
|
111
|
+
redirect_to spree.checkout_state_path(@order.state) if @order.can_go_to_state?(params[:state]) && !skip_state_validation?
|
112
112
|
@order.state = params[:state]
|
113
113
|
end
|
114
114
|
end
|
@@ -129,8 +129,8 @@ module Spree
|
|
129
129
|
end
|
130
130
|
|
131
131
|
# Provides a route to redirect after order completion
|
132
|
-
def completion_route(custom_params =
|
133
|
-
spree.order_path(@order, custom_params)
|
132
|
+
def completion_route(custom_params = {})
|
133
|
+
spree.order_path(@order, custom_params.merge(locale: locale_param))
|
134
134
|
end
|
135
135
|
|
136
136
|
def setup_for_current_state
|
@@ -174,14 +174,14 @@ module Spree
|
|
174
174
|
params.delete(:payment_source)
|
175
175
|
|
176
176
|
# Return to the Payments page if additional payment is needed.
|
177
|
-
redirect_to checkout_state_path(@order.state) and return if @order.payments.valid.sum(:amount) < @order.total
|
177
|
+
redirect_to spree.checkout_state_path(@order.state) and return if @order.payments.valid.sum(:amount) < @order.total
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
181
181
|
def remove_store_credit_payments
|
182
182
|
if params.key?(:remove_store_credit)
|
183
183
|
remove_store_credit_service.call(order: @order)
|
184
|
-
redirect_to checkout_state_path(@order.state) and return
|
184
|
+
redirect_to spree.checkout_state_path(@order.state) and return
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
@@ -1,17 +1,13 @@
|
|
1
1
|
module Spree
|
2
2
|
class CurrencyController < StoreController
|
3
3
|
def set
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
format.json { render json: !@currency.nil? }
|
10
|
-
format.html do
|
11
|
-
# We want to go back to where we came from!
|
12
|
-
redirect_back_or_default(root_path)
|
13
|
-
end
|
4
|
+
new_currency = params[:switch_to_currency]&.upcase
|
5
|
+
|
6
|
+
if new_currency.present? && supported_currency?(new_currency)
|
7
|
+
current_order&.update(currency: new_currency)
|
8
|
+
session[:currency] = new_currency
|
14
9
|
end
|
10
|
+
redirect_back_or_default(root_path(currency: new_currency))
|
15
11
|
end
|
16
12
|
end
|
17
13
|
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
module Spree
|
2
2
|
class HomeController < Spree::StoreController
|
3
|
+
include Spree::CacheHelper
|
4
|
+
|
3
5
|
respond_to :html
|
4
6
|
|
5
7
|
def index
|
6
|
-
|
8
|
+
if http_cache_enabled?
|
9
|
+
fresh_when etag: store_etag, last_modified: store_last_modified, public: true
|
10
|
+
end
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
@@ -1,14 +1,31 @@
|
|
1
1
|
module Spree
|
2
2
|
class LocaleController < Spree::StoreController
|
3
|
+
def index
|
4
|
+
render :index, layout: false
|
5
|
+
end
|
6
|
+
|
3
7
|
def set
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
new_locale = (params[:switch_to_locale] || params[:locale]).to_s
|
9
|
+
|
10
|
+
if new_locale.present? && supported_locale?(new_locale)
|
11
|
+
if should_build_new_url?
|
12
|
+
redirect_to BuildLocalizedRedirectUrl.call(
|
13
|
+
url: request.env['HTTP_REFERER'],
|
14
|
+
locale: new_locale,
|
15
|
+
default_locale: current_store.default_locale
|
16
|
+
).value
|
17
|
+
else
|
18
|
+
redirect_to root_path(locale: new_locale)
|
19
|
+
end
|
8
20
|
else
|
9
|
-
|
21
|
+
redirect_to root_path
|
10
22
|
end
|
11
|
-
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def should_build_new_url?
|
28
|
+
request.env['HTTP_REFERER'].present? && request.env['HTTP_REFERER'] != request.env['REQUEST_URI']
|
12
29
|
end
|
13
30
|
end
|
14
31
|
end
|
@@ -20,9 +20,9 @@ module Spree
|
|
20
20
|
format.html do
|
21
21
|
if params.key?(:checkout)
|
22
22
|
@order.next if @order.cart?
|
23
|
-
redirect_to checkout_state_path(@order.checkout_steps.first)
|
23
|
+
redirect_to spree.checkout_state_path(@order.checkout_steps.first)
|
24
24
|
else
|
25
|
-
redirect_to cart_path
|
25
|
+
redirect_to spree.cart_path
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -2,6 +2,7 @@ module Spree
|
|
2
2
|
class ProductsController < Spree::StoreController
|
3
3
|
include Spree::ProductsHelper
|
4
4
|
include Spree::FrontendHelper
|
5
|
+
include Spree::CacheHelper
|
5
6
|
|
6
7
|
before_action :load_product, only: [:show, :related]
|
7
8
|
before_action :load_taxon, only: :index
|
@@ -12,7 +13,9 @@ module Spree
|
|
12
13
|
@searcher = build_searcher(params.merge(include_images: true, current_store_id: current_store.id))
|
13
14
|
@products = @searcher.retrieve_products
|
14
15
|
|
15
|
-
|
16
|
+
if http_cache_enabled?
|
17
|
+
fresh_when etag: etag_index, last_modified: last_modified_index, public: true
|
18
|
+
end
|
16
19
|
end
|
17
20
|
|
18
21
|
def show
|
@@ -20,7 +23,7 @@ module Spree
|
|
20
23
|
|
21
24
|
@taxon = params[:taxon_id].present? ? Spree::Taxon.find(params[:taxon_id]) : @product.taxons.first
|
22
25
|
|
23
|
-
if stale?(etag: etag_show, last_modified: last_modified_show, public: true)
|
26
|
+
if !http_cache_enabled? || stale?(etag: etag_show, last_modified: last_modified_show, public: true)
|
24
27
|
@product_summary = Spree::ProductSummaryPresenter.new(@product).call
|
25
28
|
@product_properties = @product.product_properties.includes(:property)
|
26
29
|
@product_price = @product.price_in(current_currency).amount
|
@@ -30,9 +33,7 @@ module Spree
|
|
30
33
|
end
|
31
34
|
|
32
35
|
def related
|
33
|
-
|
34
|
-
|
35
|
-
if @related_products.any?
|
36
|
+
if product_relation_types.any?
|
36
37
|
render template: 'spree/products/related', layout: false
|
37
38
|
else
|
38
39
|
head :no_content
|
@@ -1,25 +1,23 @@
|
|
1
1
|
module Spree
|
2
2
|
class StoreController < Spree::BaseController
|
3
3
|
include Spree::Core::ControllerHelpers::Order
|
4
|
+
include Spree::LocaleUrls
|
4
5
|
|
5
|
-
|
6
|
+
helper 'spree/locale'
|
7
|
+
helper 'spree/currency'
|
6
8
|
|
7
|
-
|
8
|
-
render 'spree/shared/forbidden', layout: Spree::Config[:layout], status: 403
|
9
|
-
end
|
9
|
+
skip_before_action :verify_authenticity_token, only: :ensure_cart, raise: false
|
10
10
|
|
11
|
-
|
12
|
-
render 'spree/shared/unauthorized', layout: Spree::Config[:layout], status: 401
|
13
|
-
end
|
11
|
+
before_action :redirect_to_default_locale
|
14
12
|
|
15
13
|
def account_link
|
16
14
|
render partial: 'spree/shared/link_to_account'
|
17
|
-
fresh_when(try_spree_current_user)
|
15
|
+
fresh_when(etag: [try_spree_current_user, I18n.locale])
|
18
16
|
end
|
19
17
|
|
20
18
|
def cart_link
|
21
19
|
render partial: 'spree/shared/link_to_cart'
|
22
|
-
fresh_when(simple_current_order)
|
20
|
+
fresh_when(etag: [simple_current_order, I18n.locale])
|
23
21
|
end
|
24
22
|
|
25
23
|
def api_tokens
|
@@ -39,10 +37,6 @@ module Spree
|
|
39
37
|
Spree::Frontend::Config[:locale]
|
40
38
|
end
|
41
39
|
|
42
|
-
def store_locale
|
43
|
-
current_store.default_locale
|
44
|
-
end
|
45
|
-
|
46
40
|
def store_etag
|
47
41
|
[
|
48
42
|
current_store,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Spree
|
2
2
|
class TaxonsController < Spree::StoreController
|
3
3
|
include Spree::FrontendHelper
|
4
|
+
include Spree::CacheHelper
|
4
5
|
helper 'spree/products'
|
5
6
|
|
6
7
|
before_action :load_taxon
|
@@ -8,15 +9,15 @@ module Spree
|
|
8
9
|
respond_to :html
|
9
10
|
|
10
11
|
def show
|
11
|
-
if stale?(etag: etag, last_modified: last_modified, public: true)
|
12
|
+
if !http_cache_enabled? || stale?(etag: etag, last_modified: last_modified, public: true)
|
12
13
|
load_products
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
17
|
def product_carousel
|
17
|
-
if stale?(etag: carousel_etag, last_modified: last_modified, public: true)
|
18
|
+
if !http_cache_enabled? || stale?(etag: carousel_etag, last_modified: last_modified, public: true)
|
18
19
|
load_products
|
19
|
-
if @products.any?
|
20
|
+
if @products.reload.any?
|
20
21
|
render template: 'spree/taxons/product_carousel', layout: false
|
21
22
|
else
|
22
23
|
head :no_content
|