spree_frontend 4.1.5 → 4.1.6

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: 37be830d545f0048e569177412b10f6ef9368a46b8ca1a3f8da13f188c8df5bf
4
- data.tar.gz: 886b84914f5b401fb0cd594bf3ea784570849e222e3e70d205407b4e7f8d8f03
3
+ metadata.gz: 970239d531b6d929609cf3c4d28f2c448840c5471293c6c26c1d50510a77f325
4
+ data.tar.gz: 323efddb286a2fcff39fe461a0b531afb9aed27b2e7b8f0ddc3a7424005f3c93
5
5
  SHA512:
6
- metadata.gz: 8d4a75f1b67383c700d25433b9e226845a689dacddca8adee7708427a1ad6b8e352848ea50ef554f24cb53eb0080c093aedd962c74454ef3ff361b461257fe97
7
- data.tar.gz: 6a69a8f0d055e450c851b34ef8f1a25faba37027200d8b0b659f18d817d767041cc0725bdaf8145e643d9e710c2e508c003bfac3aefdc6fed1b2879e379b3c78
6
+ metadata.gz: 599d44e41a5158490b33e78023191a0b50ba8c32701c7a189b718b65755ed4acc5953599dd5e9d87c84c6f19a04119cf2e7cac5542291d227601470b07eeb189
7
+ data.tar.gz: 63186815000d404797933b19cba9f4b80ed37c1ca43f65446a05e99f74e6ecca4b6a53c454160dfaa268eae88c3d6ac805d17c8e4bc5b73ff03eb5d3f2285e9e
@@ -230,14 +230,16 @@ module Spree
230
230
  ]
231
231
  end
232
232
 
233
- def filtering_params
234
- static_filters = %w(keywords price sort_by)
233
+ def static_filters
234
+ @static_filters ||= Spree::Frontend::Config[:products_filters]
235
+ end
235
236
 
236
- available_option_types.map(&:filter_param).concat(static_filters)
237
+ def filtering_params
238
+ @filtering_params ||= available_option_types.map(&:filter_param).concat(static_filters)
237
239
  end
238
240
 
239
241
  def filtering_params_cache_key
240
- params.permit(*filtering_params)&.reject { |_, v| v.blank? }&.to_s
242
+ @filtering_params_cache_key ||= params.permit(*filtering_params)&.reject { |_, v| v.blank? }&.to_param
241
243
  end
242
244
 
243
245
  def available_option_types_cache_key
@@ -22,10 +22,10 @@ module Spree
22
22
  name: product.name,
23
23
  image: structured_images(product),
24
24
  description: product.description,
25
- sku: product.sku,
25
+ sku: structured_sku(product),
26
26
  offers: {
27
27
  '@type': 'Offer',
28
- price: product.price_in(current_currency).amount,
28
+ price: product.default_variant.price_in(current_currency).amount,
29
29
  priceCurrency: current_currency,
30
30
  availability: product.in_stock? ? 'InStock' : 'OutOfStock',
31
31
  url: spree.product_url(product),
@@ -35,6 +35,10 @@ module Spree
35
35
  end
36
36
  end
37
37
 
38
+ def structured_sku(product)
39
+ product.default_variant.sku? ? product.default_variant.sku : product.sku
40
+ end
41
+
38
42
  def structured_images(product)
39
43
  image = default_image_for_product_or_variant(product)
40
44
 
@@ -2,6 +2,7 @@ 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
4
  preference :locale, :string, default: Rails.application.config.i18n.default_locale
5
+ preference :products_filters, :array, default: %w(keywords price sort_by)
5
6
  preference :remember_me_enabled, :boolean, default: true
6
7
  end
7
8
  end
@@ -1,5 +1,25 @@
1
1
  <% @body_id = 'checkout-page' %>
2
2
 
3
+ <%
4
+ content_for :head do
5
+ agent = request.env['HTTP_USER_AGENT']
6
+ if agent =~ /Safari/ && !(agent =~ /Chrome/)
7
+ %>
8
+ <script>
9
+ if (!!window.performance && window.performance.navigation.type === 2) {
10
+ window.location.reload();
11
+ }
12
+ window.onpageshow = function(event) {
13
+ if (event.persisted) {
14
+ window.location.reload()
15
+ }
16
+ }
17
+ </script>
18
+ <%
19
+ end
20
+ end
21
+ %>
22
+
3
23
  <div id="checkout" class="container checkout" data-hook>
4
24
  <%= render partial: 'spree/shared/error_messages', locals: { target: @order } %>
5
25
 
@@ -1,4 +1,4 @@
1
- <% cache base_cache_key + [available_option_types, permitted_params, @taxon&.id] do %>
1
+ <% cache base_cache_key + [available_option_types_cache_key, filtering_params_cache_key, @taxon&.id] do %>
2
2
  <div id="plp-filters-accordion" class="d-none d-lg-block col-lg-3 pr-5 position-sticky h-100 plp-filters" data-hook="taxon_sidebar_navigation">
3
3
  <% @available_option_types.each do |option_type| %>
4
4
  <div class="w-100 card plp-filters-card">
@@ -1,7 +1,7 @@
1
1
  <% is_visible = params[:menu_open] ? 'block' : 'none' %>
2
2
 
3
3
  <div id="filter-by-overlay" class="d-lg-none plp-overlay" style="display: <%= is_visible %>;">
4
- <% cache base_cache_key + [available_option_types, permitted_params, @taxon&.id] do %>
4
+ <% cache base_cache_key + [available_option_types_cache_key, filtering_params_cache_key, @taxon&.id] do %>
5
5
  <div class="plp-scroll">
6
6
  <div class="container">
7
7
  <div class="plp-overlay-header">
@@ -1,7 +1,8 @@
1
1
  <% permitted_params = params.permit(*filtering_params) %>
2
+ <% products_empty = @products.empty? %>
2
3
 
3
4
  <div data-hook="search_results">
4
- <% if @products.empty? %>
5
+ <% if products_empty %>
5
6
  <% if permitted_params[:keywords].present? && permitted_params.to_h.one? %>
6
7
  <%= render 'spree/products/no_results' %>
7
8
  <% else %>
@@ -40,6 +41,8 @@
40
41
  <%= render 'spree/products/filters_mobile', permitted_params: permitted_params %>
41
42
  <%= render 'spree/products/sort_mobile', permitted_params: permitted_params %>
42
43
 
43
- <% cache cache_key_for_products(@products, 'json-ld') do %>
44
- <%= products_structured_data(@products) %>
44
+ <% unless products_empty %>
45
+ <% cache cache_key_for_products(@products, 'json-ld') do %>
46
+ <%= products_structured_data(@products) %>
47
+ <% end %>
45
48
  <% end %>
@@ -1,4 +1,4 @@
1
- <% cache base_cache_key + [ot_downcase_name, params_ot_downcase_name, permitted_params, @taxon&.id] do %>
1
+ <% cache base_cache_key + [ot_downcase_name, params_ot_downcase_name, filtering_params_cache_key, @taxon&.id] do %>
2
2
  <% selected_option_values = params_ot_downcase_name&.split(',')&.map(&:to_i) || [] %>
3
3
  <% option_type.option_values.each do |option_value| %>
4
4
  <% id = option_value.id %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.5
4
+ version: 4.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-14 00:00:00.000000000 Z
11
+ date: 2020-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.1.5
19
+ version: 4.1.6
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: 4.1.5
26
+ version: 4.1.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 4.1.5
33
+ version: 4.1.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 4.1.5
40
+ version: 4.1.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bootstrap
43
43
  requirement: !ruby/object:Gem::Requirement