spree_frontend 4.0.0.rc3 → 4.0.4

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: 1a7266f41e2fa6d573a0f4794494010db8a3ca8c63a7aa1b1c2e630bf9cb69d4
4
- data.tar.gz: 8a66adc0c24cf0e480b87263b5b2708d922fc2d6cc092792bde6757d6e585994
3
+ metadata.gz: 21f26b2d75ab4c8bea651c2d63925ba6b2d72f2ef82859f64c38a6c2fa5591a5
4
+ data.tar.gz: 391eb0cf437f177fd5506ca5c2f88721f43af8ff22a1c44fa4cfe0d230aacd87
5
5
  SHA512:
6
- metadata.gz: 279b4c93d0070a054c15815c95b1734f18dbcf2ede6067dd1058a2e759f2c86b9e91b6b231f7eb443c1820f6ad60de6e6c6df91993158a546fe8cca519b07aa3
7
- data.tar.gz: c087a9e63763783145f05f7adc5d9dc67cda2d50b43da34659e2bb94f273ccec3416bf0ae27eca2f36df1118948981b5e9bdad029dd66a062f9c72c814e5aeec
6
+ metadata.gz: 1cd2cc28ce9d3730e0e63bbbb69240f6f06f5c5bd21b023d73214ab3382e2ab38d024dd4ed183778ba5fb9ecf9cf0709f4066abd6191eb229d263d0419f780c9
7
+ data.tar.gz: b524228cafa28433f71df0ea018c133c464d5e117bd63433d67a2cb17a9de1ddf9deb9c7514fdea870946b157a9ba19880496979763837635d59b4f99f2fcbd7
@@ -42,11 +42,11 @@ module Spree
42
42
  if @order.bill_address_id != @order.ship_address_id && bill_address == ship_address
43
43
  @order.update_column(:bill_address_id, ship_address.id)
44
44
  bill_address.destroy
45
- else
45
+ elsif params[:save_user_address]
46
46
  bill_address.update_attribute(:user_id, try_spree_current_user&.id)
47
47
  end
48
48
 
49
- ship_address.update_attribute(:user_id, try_spree_current_user&.id)
49
+ ship_address.update_attribute(:user_id, try_spree_current_user&.id) if params[:save_user_address]
50
50
  end
51
51
  end
52
52
  end
@@ -13,32 +13,34 @@ module Spree
13
13
  private
14
14
 
15
15
  def structured_product_hash(product)
16
- {
17
- '@context': 'https://schema.org/',
18
- '@type': 'Product',
19
- '@id': "#{spree.root_url}product_#{product.id}",
20
- url: spree.product_url(product),
21
- name: product.name,
22
- image: structured_images(product),
23
- description: product.description,
24
- sku: product.sku,
25
- offers: {
26
- '@type': 'Offer',
27
- price: product.price,
28
- priceCurrency: current_currency,
29
- availability: product.in_stock? ? 'InStock' : 'OutOfStock',
16
+ Rails.cache.fetch("spree/structured-data/#{product.cache_key}") do
17
+ {
18
+ '@context': 'https://schema.org/',
19
+ '@type': 'Product',
20
+ '@id': "#{spree.root_url}product_#{product.id}",
30
21
  url: spree.product_url(product),
31
- availabilityEnds: product.discontinue_on ? product.discontinue_on.strftime('%F') : ''
22
+ name: product.name,
23
+ image: structured_images(product),
24
+ description: product.description,
25
+ sku: product.sku,
26
+ offers: {
27
+ '@type': 'Offer',
28
+ price: product.price,
29
+ priceCurrency: current_currency,
30
+ availability: product.in_stock? ? 'InStock' : 'OutOfStock',
31
+ url: spree.product_url(product),
32
+ availabilityEnds: product.discontinue_on ? product.discontinue_on.strftime('%F') : ''
33
+ }
32
34
  }
33
- }
35
+ end
34
36
  end
35
37
 
36
38
  def structured_images(product)
37
- images = product.has_variants? ? product.variant_images : product.images
39
+ image = product.variant_images.first
38
40
 
39
- return '' unless images.any?
41
+ return '' unless image
40
42
 
41
- main_app.rails_blob_url(images.first.attachment)
43
+ main_app.rails_blob_url(image.attachment)
42
44
  end
43
45
  end
44
46
  end
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.0.0.rc3
4
+ version: 4.0.4
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: 2019-09-27 00:00:00.000000000 Z
11
+ date: 2020-10-15 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.0.0.rc3
19
+ version: 4.0.4
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.0.0.rc3
26
+ version: 4.0.4
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.0.0.rc3
33
+ version: 4.0.4
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.0.0.rc3
40
+ version: 4.0.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bootstrap
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -251,7 +251,7 @@ homepage: http://spreecommerce.org
251
251
  licenses:
252
252
  - BSD-3-Clause
253
253
  metadata: {}
254
- post_install_message:
254
+ post_install_message:
255
255
  rdoc_options: []
256
256
  require_paths:
257
257
  - lib
@@ -262,13 +262,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
262
262
  version: 2.5.0
263
263
  required_rubygems_version: !ruby/object:Gem::Requirement
264
264
  requirements:
265
- - - ">"
265
+ - - ">="
266
266
  - !ruby/object:Gem::Version
267
- version: 1.3.1
267
+ version: '0'
268
268
  requirements:
269
269
  - none
270
- rubygems_version: 3.0.2
271
- signing_key:
270
+ rubygems_version: 3.1.4
271
+ signing_key:
272
272
  specification_version: 4
273
273
  summary: Frontend e-commerce functionality for the Spree project.
274
274
  test_files: []