spree_frontend 4.1.5 → 4.1.10

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: 468861e8e9b5c9c2e97eccecd6214b66997de7c7db90be2ab74a19ecd1570686
4
+ data.tar.gz: c606b21f6b0a1fe5a9e4bb8e7a3d9b625b09c86b7f363bb491394e8c372d38bc
5
5
  SHA512:
6
- metadata.gz: 8d4a75f1b67383c700d25433b9e226845a689dacddca8adee7708427a1ad6b8e352848ea50ef554f24cb53eb0080c093aedd962c74454ef3ff361b461257fe97
7
- data.tar.gz: 6a69a8f0d055e450c851b34ef8f1a25faba37027200d8b0b659f18d817d767041cc0725bdaf8145e643d9e710c2e508c003bfac3aefdc6fed1b2879e379b3c78
6
+ metadata.gz: 814d074252ce0ab20f706115f7755e6168b1041cde16a50626909b51b818023920315564c6a10b702d98ce51282c1fe3cf80f0d1cf15969d566b75502878038d
7
+ data.tar.gz: 3f9b057303f1d5803fbcc08d1a9b4a0ad028a8239e6f24515e299f801d32ee195c4a3d6548d480d2432e53e7c451b71c77b7eb149ac236adf0a6b5b2d2f60277
@@ -1,56 +1,54 @@
1
- (function ($) {
2
- $(document).ready(function () {
3
- if ($('.select_address').length > 0) {
4
- $('input#order_use_billing').unbind('change')
1
+ Spree.ready(function ($) {
2
+ if ($('.select_address').length > 0) {
3
+ $('input#order_use_billing').unbind('change');
5
4
 
6
- hide_address_form('billing')
7
- hide_address_form('shipping')
5
+ hide_address_form('billing');
6
+ hide_address_form('shipping');
8
7
 
9
- if ($('input#order_use_billing').is(':checked')) {
10
- $('#shipping .select_address').hide()
11
- }
12
-
13
- $('input#order_use_billing').click(function () {
14
- if ($(this).is(':checked')) {
15
- $('#shipping .select_address').hide()
16
- hide_address_form('shipping')
17
- } else {
18
- $('#shipping .select_address').show()
19
- if ($("input[name='order[ship_address_id]']:checked").val() == '0') {
20
- show_address_form('shipping')
21
- } else {
22
- hide_address_form('shipping')
23
- }
24
- }
25
- })
26
-
27
- $("input[name='order[bill_address_id]']:radio").change(function () {
28
- if ($("input[name='order[bill_address_id]']:checked").val() == '0') {
29
- show_address_form('billing')
30
- } else {
31
- hide_address_form('billing')
32
- }
33
- })
8
+ if ($('input#order_use_billing').is(':checked')) {
9
+ $('#shipping .select_address').hide()
10
+ }
34
11
 
35
- $("input[name='order[ship_address_id]']:radio").change(function () {
12
+ $('input#order_use_billing').click(function () {
13
+ if ($(this).is(':checked')) {
14
+ $('#shipping .select_address').hide()
15
+ hide_address_form('shipping')
16
+ } else {
17
+ $('#shipping .select_address').show()
36
18
  if ($("input[name='order[ship_address_id]']:checked").val() == '0') {
37
19
  show_address_form('shipping')
38
20
  } else {
39
21
  hide_address_form('shipping')
40
22
  }
41
- })
42
- }
43
- })
23
+ }
24
+ });
25
+
26
+ $("input[name='order[bill_address_id]']:radio").change(function () {
27
+ if ($("input[name='order[bill_address_id]']:checked").val() == '0') {
28
+ show_address_form('billing')
29
+ } else {
30
+ hide_address_form('billing')
31
+ }
32
+ });
33
+
34
+ $("input[name='order[ship_address_id]']:radio").change(function () {
35
+ if ($("input[name='order[ship_address_id]']:checked").val() == '0') {
36
+ show_address_form('shipping')
37
+ } else {
38
+ hide_address_form('shipping')
39
+ }
40
+ })
41
+ }
44
42
 
45
- function hide_address_form (address_type) {
46
- $('#' + address_type + ' .inner').hide()
43
+ function hide_address_form(address_type) {
44
+ $('#' + address_type + ' .inner').hide();
47
45
  $('#' + address_type + ' .inner input').prop('disabled', true)
48
46
  $('#' + address_type + ' .inner select').prop('disabled', true)
49
47
  }
50
48
 
51
- function show_address_form (address_type) {
52
- $('#' + address_type + ' .inner').show()
49
+ function show_address_form(address_type) {
50
+ $('#' + address_type + ' .inner').show();
53
51
  $('#' + address_type + ' .inner input').prop('disabled', false)
54
52
  $('#' + address_type + ' .inner select').prop('disabled', false)
55
53
  }
56
- })(jQuery)
54
+ });
@@ -266,6 +266,12 @@ Spree.ready(function($) {
266
266
  Spree.showProductAddedModal(JSON.parse(
267
267
  $cartForm.attr('data-product-summary')
268
268
  ), Spree.variantById($cartForm, variantId))
269
+ $cartForm.trigger({
270
+ type: 'product_add_to_cart',
271
+ variant: Spree.variantById($cartForm, variantId),
272
+ quantity_increment: quantity,
273
+ cart: response.attributes
274
+ })
269
275
  },
270
276
  function(error) {
271
277
  if (typeof error === 'string' && error !== '') {
@@ -47,6 +47,7 @@
47
47
  @import "spree/frontend/views/spree/shared/product";
48
48
  @import "spree/frontend/views/spree/products/show";
49
49
  @import "spree/frontend/views/spree/products/cart_form";
50
+ @import "spree/frontend/views/spree/products/gallery_modal";
50
51
  @import "spree/frontend/views/spree/shared/product_added_modal";
51
52
  @import "spree/frontend/views/spree/shared/mobile_navigation";
52
53
  @import "spree/frontend/views/spree/shared/no_product_available";
@@ -149,7 +149,7 @@
149
149
  }
150
150
  hr {
151
151
  margin: 0;
152
- width: 33%;
152
+ flex: 1;
153
153
  border: 1px solid theme-color('info');
154
154
  }
155
155
  }
@@ -0,0 +1,6 @@
1
+ #picturesModal {
2
+ .close {
3
+ right: 0;
4
+ z-index: 3;
5
+ }
6
+ }
@@ -101,7 +101,8 @@ module Spree
101
101
  end
102
102
  end
103
103
  content = content_tag('ul', raw(items.join("\n")), class: 'nav justify-content-between checkout-progress-steps', id: "checkout-step-#{@order.state}")
104
- content << content_tag('div', raw('<hr /><hr /><hr />'), class: "checkout-progress-steps-line state-#{@order.state}")
104
+ hrs = '<hr />' * (states.length - 1)
105
+ content << content_tag('div', raw(hrs), class: "checkout-progress-steps-line state-#{@order.state}")
105
106
  end
106
107
 
107
108
  def flash_messages(opts = {})
@@ -230,14 +231,20 @@ module Spree
230
231
  ]
231
232
  end
232
233
 
233
- def filtering_params
234
- static_filters = %w(keywords price sort_by)
234
+ def static_filters
235
+ @static_filters ||= Spree::Frontend::Config[:products_filters]
236
+ end
235
237
 
236
- available_option_types.map(&:filter_param).concat(static_filters)
238
+ def additional_filters_partials
239
+ @additional_filters_partials ||= Spree::Frontend::Config[:additional_filters_partials]
240
+ end
241
+
242
+ def filtering_params
243
+ @filtering_params ||= available_option_types.map(&:filter_param).concat(static_filters)
237
244
  end
238
245
 
239
246
  def filtering_params_cache_key
240
- params.permit(*filtering_params)&.reject { |_, v| v.blank? }&.to_s
247
+ @filtering_params_cache_key ||= params.permit(*filtering_params)&.reject { |_, v| v.blank? }&.to_param
241
248
  end
242
249
 
243
250
  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,8 @@ 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)
6
+ preference :additional_filters_partials, :array, default: %w()
5
7
  preference :remember_me_enabled, :boolean, default: true
6
8
  end
7
9
  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">
@@ -53,6 +53,10 @@
53
53
  <% end %>
54
54
  </div>
55
55
  </div>
56
+
57
+ <% additional_filters_partials.each do |partial| %>
58
+ <%= render "spree/products/filters/#{partial}", permitted_params: permitted_params %>
59
+ <% end %>
56
60
  </div>
57
61
  </div>
58
62
  <% end %>
@@ -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">
@@ -51,6 +51,10 @@
51
51
  </div>
52
52
  </div>
53
53
  </div>
54
+
55
+ <% additional_filters_partials.each do |partial| %>
56
+ <%= render "spree/products/filters/mobile/#{partial}", permitted_params: permitted_params %>
57
+ <% end %>
54
58
  </div>
55
59
  </div>
56
60
  <% end %>
@@ -3,7 +3,7 @@
3
3
  <div class="modal-dialog--zoom modal-dialog mw-100 vh-100 mt-0 mb-0" role="document">
4
4
  <div class="modal-content h-100">
5
5
  <div class="modal-body h-100">
6
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
6
+ <button type="button" class="close position-absolute" data-dismiss="modal" aria-label="Close">
7
7
  <span aria-hidden="true">
8
8
  <%= icon(name: 'close',
9
9
  classes: 'd-block d-lg-none',
@@ -10,7 +10,7 @@
10
10
  <% end %>
11
11
  </div>
12
12
  <div class="card-footer text-center">
13
- <span class="price selling lead" content="<%= price.nil? 0 : price.to_d %>">
13
+ <span class="price selling lead" content="<%= price.nil? ? 0 : price.to_d %>">
14
14
  <%= display_price(product) %>
15
15
  </span>
16
16
  <span content="<%= current_currency %>"></span>
@@ -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 %>
@@ -38,7 +38,7 @@
38
38
 
39
39
  <%= render partial: 'gallery_modal' %>
40
40
  </div>
41
- <div id="related-products" />
41
+ <div id="related-products"></div>
42
42
 
43
43
  <%= products_structured_data([@product]) %>
44
44
 
@@ -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 %>
@@ -5,16 +5,22 @@ Gem::Specification.new do |s|
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.name = 'spree_frontend'
7
7
  s.version = Spree.version
8
- s.summary = 'Frontend e-commerce functionality for the Spree project.'
9
- s.description = s.summary
10
-
11
- s.required_ruby_version = '>= 2.5.0'
12
-
13
8
  s.author = 'Sean Schofield'
14
9
  s.email = 'sean@spreecommerce.com'
10
+ s.summary = 'Frontend e-commerce functionality for the Spree project.'
11
+ s.description = s.summary
15
12
  s.homepage = 'http://spreecommerce.org'
16
13
  s.license = 'BSD-3-Clause'
17
14
 
15
+ s.metadata = {
16
+ "bug_tracker_uri" => "https://github.com/spree/spree/issues",
17
+ "changelog_uri" => "https://github.com/spree/spree/releases/tag/v#{s.version}",
18
+ "documentation_uri" => "https://guides.spreecommerce.org/",
19
+ "source_code_uri" => "https://github.com/spree/spree/tree/v#{s.version}",
20
+ }
21
+
22
+ s.required_ruby_version = '>= 2.5.0'
23
+
18
24
  s.files = `git ls-files`.split("\n").reject { |f| f.match(/^spec/) && !f.match(/^spec\/fixtures/) }
19
25
  s.require_path = 'lib'
20
26
  s.requirements << 'none'
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.10
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-09-23 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.10
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.10
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.10
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.10
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bootstrap
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -333,6 +333,7 @@ files:
333
333
  - app/assets/stylesheets/spree/frontend/views/spree/orders/edit.scss
334
334
  - app/assets/stylesheets/spree/frontend/views/spree/orders/show.scss
335
335
  - app/assets/stylesheets/spree/frontend/views/spree/products/cart_form.scss
336
+ - app/assets/stylesheets/spree/frontend/views/spree/products/gallery_modal.scss
336
337
  - app/assets/stylesheets/spree/frontend/views/spree/products/index.scss
337
338
  - app/assets/stylesheets/spree/frontend/views/spree/products/show.scss
338
339
  - app/assets/stylesheets/spree/frontend/views/spree/shared/_color_select.scss
@@ -498,7 +499,11 @@ files:
498
499
  homepage: http://spreecommerce.org
499
500
  licenses:
500
501
  - BSD-3-Clause
501
- metadata: {}
502
+ metadata:
503
+ bug_tracker_uri: https://github.com/spree/spree/issues
504
+ changelog_uri: https://github.com/spree/spree/releases/tag/v4.1.10
505
+ documentation_uri: https://guides.spreecommerce.org/
506
+ source_code_uri: https://github.com/spree/spree/tree/v4.1.10
502
507
  post_install_message:
503
508
  rdoc_options: []
504
509
  require_paths: