spree_frontend 4.1.4 → 4.1.9

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: 2c953a108231a986a2298e2a51cfaea5520ba18100b1ad6a2f9b90f3e9019ff0
4
- data.tar.gz: d4dfe20a874982c13793bc35e3a3718812b223b97e0955906fa5e07d96db3c95
3
+ metadata.gz: fc9ae077f860cfee19b527c0d75cd1573fef9020a4c01c22f9fb0ea64a269942
4
+ data.tar.gz: 77813cd0667511c0761ba05ba0d3f21dff25df6d42edaa2f3923f06e0929e8f4
5
5
  SHA512:
6
- metadata.gz: 9fb7d2a689d7ffc0ba283542eeb62af36d79501b9d3db36d01315bad1ecc842a40e0e10724ac3f3669ee6bab70f300ac4f9e95f373716199347308ccaa3b1eb0
7
- data.tar.gz: 1f12786620901d2bc41ed6d368c9e69db5e5afa1690275d891963e79b1207c442fc46dca9b8223abc2a87168af40ce3eae71c87111be183531f9462ff8154013
6
+ metadata.gz: 53a5b1f5bb22505755fe8351a52aff8492bf0ce83e420e0ff7199993fbc5774d70ceb07440e18a8ab1120c4bab4599914bbb460e903c41626de175f1763be75d
7
+ data.tar.gz: 9c8a55d2b12d064099b5c994433498f0ae8bd1efb803d6d149b96eb9df95dc5720010354a4f752cc039ddba125ba7c59a9892e02e75fe3ec46a62a77b5c75b8b
@@ -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.4
4
+ version: 4.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-07 00:00:00.000000000 Z
11
+ date: 2020-08-28 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.4
19
+ version: 4.1.9
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.4
26
+ version: 4.1.9
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.4
33
+ version: 4.1.9
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.4
40
+ version: 4.1.9
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,8 +499,12 @@ files:
498
499
  homepage: http://spreecommerce.org
499
500
  licenses:
500
501
  - BSD-3-Clause
501
- metadata: {}
502
- post_install_message:
502
+ metadata:
503
+ bug_tracker_uri: https://github.com/spree/spree/issues
504
+ changelog_uri: https://github.com/spree/spree/releases/tag/v4.1.9
505
+ documentation_uri: https://guides.spreecommerce.org/
506
+ source_code_uri: https://github.com/spree/spree/tree/v4.1.9
507
+ post_install_message:
503
508
  rdoc_options: []
504
509
  require_paths:
505
510
  - lib
@@ -515,8 +520,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
515
520
  version: '0'
516
521
  requirements:
517
522
  - none
518
- rubygems_version: 3.0.6
519
- signing_key:
523
+ rubygems_version: 3.1.2
524
+ signing_key:
520
525
  specification_version: 4
521
526
  summary: Frontend e-commerce functionality for the Spree project.
522
527
  test_files: []