spree_frontend 4.2.0.rc3 → 4.2.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f81a05d74462180d47969190cd9b0ba32eeb896e776706f89f288b1e52167d0
4
- data.tar.gz: f0d37b65f1b4a1bef39162049cc07f7201a9ba5b7417114867530c2f86a61c23
3
+ metadata.gz: 1477557578e6d8ef0fe52f5d0d8e96d45ede1291ef6d5e635d397ab3ba2b1d64
4
+ data.tar.gz: 4bf49f127a3c63fbf42d02e628157297029568a11eed608a2da64a6b7c6151cc
5
5
  SHA512:
6
- metadata.gz: caa243750a89dcb5ee49b389c30b1dda7594e2ce46cbb98d3c83c558c6af5af4e3dfc07f33b4fcca9f21bbb21af8dfef2a8a8b61264f1939a4ce262273045ae0
7
- data.tar.gz: 5853f04c6518d154deaffa26eff36966fe4a8486076cbf1143c03974cabc3502a9134239a439d8537a5254bf9cb934743a5692ba4b8486fb19f900429d95a028
6
+ metadata.gz: b6c9a6e1456772e5a1a189e759e1503eb4a43c93c55546dc7acee0cfc24e0781dac0882220df9ce0b1a6d123e3817822838325e9da9873a9c168aa4a8cdba9bb
7
+ data.tar.gz: 9c9fe56b7f1a9c33241eecca1367d279a2a2f4207290a4922244b0eeaf9b04ee734a1b76f92625314d62ec63d52f0406e77dd4a12ac6a67e5864ee43de3a0ec6
@@ -4,7 +4,7 @@ module Spree
4
4
  @currency = supported_currencies.find { |currency| currency.iso_code == params[:currency] }
5
5
  # Make sure that we update the current order, so the currency change is reflected.
6
6
  current_order&.update(currency: @currency.iso_code)
7
- session[:currency] = params[:currency] if Spree::Config[:show_store_currency_selector]
7
+ session[:currency] = params[:currency] if Spree::Config[:show_store_selector]
8
8
  respond_to do |format|
9
9
  format.json { render json: !@currency.nil? }
10
10
  format.html do
@@ -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
- fresh_when etag: store_etag, last_modified: store_last_modified, public: true
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
@@ -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
- fresh_when etag: etag_index, last_modified: last_modified_index, public: true
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
@@ -39,10 +39,6 @@ module Spree
39
39
  Spree::Frontend::Config[:locale]
40
40
  end
41
41
 
42
- def store_locale
43
- current_store.default_locale
44
- end
45
-
46
42
  def store_etag
47
43
  [
48
44
  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,13 +9,13 @@ 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
20
  if @products.reload.any?
20
21
  render template: 'spree/taxons/product_carousel', layout: false
@@ -0,0 +1,7 @@
1
+ module Spree
2
+ module CacheHelper
3
+ def http_cache_enabled?
4
+ @http_cache_enabled ||= Spree::Frontend::Config[:http_cache_enabled]
5
+ end
6
+ end
7
+ end
@@ -1,6 +1,7 @@
1
1
  module Spree
2
2
  class FrontendConfiguration < Preferences::Configuration
3
3
  preference :coupon_codes_enabled, :boolean, default: true # Determines if we show coupon code form at cart and checkout
4
+ preference :http_cache_enabled, :boolean, default: true
4
5
  preference :locale, :string, default: Rails.application.config.i18n.default_locale
5
6
  preference :products_filters, :array, default: %w(keywords price sort_by)
6
7
  preference :additional_filters_partials, :array, default: %w()
@@ -1,4 +1,4 @@
1
- <% if Spree::Config.show_store_currency_selector && stores.size > 1 %>
1
+ <% if Spree::Config.show_store_selector && stores.size > 1 %>
2
2
  <li class="d-none d-xl-block change-store">
3
3
  <div class="dropdown navbar-right-dropdown">
4
4
  <button id="stores-button" type="button" data-toggle="dropdown" class="navbar-right-dropdown-toggle" aria-label="<%= Spree.t('nav_bar.change_country')%>">
@@ -16,7 +16,7 @@
16
16
  <% stores.each do |store| %>
17
17
  <div class="pl-3 d-flex justify-content-between align-items-center <%= 'active' if store.id == current_store.id %>">
18
18
  <span class="flag-icon flag-icon-<%= store_country_iso(store) %>"></span>
19
- <%= link_to "#{store.default_country&.name} (#{store_currency_symbol(store)})", "//#{store.url}", class: 'dropdown-item text-uppercase' %>
19
+ <%= link_to "#{store.name} (#{store_currency_symbol(store)})", store.formatted_url, class: 'dropdown-item text-uppercase' %>
20
20
  </div>
21
21
  <% end %>
22
22
  </div>
@@ -57,7 +57,7 @@
57
57
  width: zoomed ? 650 : 475,
58
58
  height: zoomed ? 870 : 594
59
59
  } %>
60
- <%= imageIndex.zero? ? image_tag(image_attrs.delete(:src), image_attrs) : lazy_image(image_attrs) %>
60
+ <%= imageIndex.zero? ? image_tag(image_attrs.delete(:src), image_attrs) : lazy_image(**image_attrs) %>
61
61
  </div>
62
62
  </div>
63
63
  <% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0.rc3
4
+ version: 4.2.0.rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-01-18 00:00:00.000000000 Z
12
+ date: 2021-01-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_api
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 4.2.0.rc3
20
+ version: 4.2.0.rc4
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 4.2.0.rc3
27
+ version: 4.2.0.rc4
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: spree_core
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 4.2.0.rc3
34
+ version: 4.2.0.rc4
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 4.2.0.rc3
41
+ version: 4.2.0.rc4
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: bootstrap
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -648,6 +648,7 @@ files:
648
648
  - app/controllers/spree/store_controller.rb
649
649
  - app/controllers/spree/taxons_controller.rb
650
650
  - app/helpers/spree/addresses_helper.rb
651
+ - app/helpers/spree/cache_helper.rb
651
652
  - app/helpers/spree/frontend_helper.rb
652
653
  - app/helpers/spree/navigation_helper.rb
653
654
  - app/helpers/spree/orders_helper.rb
@@ -783,9 +784,9 @@ licenses:
783
784
  - BSD-3-Clause
784
785
  metadata:
785
786
  bug_tracker_uri: https://github.com/spree/spree/issues
786
- changelog_uri: https://github.com/spree/spree/releases/tag/v4.2.0.rc3
787
+ changelog_uri: https://github.com/spree/spree/releases/tag/v4.2.0.rc4
787
788
  documentation_uri: https://guides.spreecommerce.org/
788
- source_code_uri: https://github.com/spree/spree/tree/v4.2.0.rc3
789
+ source_code_uri: https://github.com/spree/spree/tree/v4.2.0.rc4
789
790
  post_install_message:
790
791
  rdoc_options: []
791
792
  require_paths: