spree_frontend 4.0.0.rc2 → 4.0.0.rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/frontend/checkout/address.js +2 -2
- data/app/controllers/spree/store_controller.rb +1 -1
- data/app/helpers/spree/structured_data_helper.rb +44 -0
- data/app/views/spree/home/index.html.erb +1 -0
- data/app/views/spree/products/_product.html.erb +6 -7
- data/app/views/spree/products/index.html.erb +2 -0
- data/app/views/spree/products/show.html.erb +6 -4
- data/app/views/spree/taxons/show.html.erb +2 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a7266f41e2fa6d573a0f4794494010db8a3ca8c63a7aa1b1c2e630bf9cb69d4
|
4
|
+
data.tar.gz: 8a66adc0c24cf0e480b87263b5b2708d922fc2d6cc092792bde6757d6e585994
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 279b4c93d0070a054c15815c95b1734f18dbcf2ede6067dd1058a2e759f2c86b9e91b6b231f7eb443c1820f6ad60de6e6c6df91993158a546fe8cca519b07aa3
|
7
|
+
data.tar.gz: c087a9e63763783145f05f7adc5d9dc67cda2d50b43da34659e2bb94f273ccec3416bf0ae27eca2f36df1118948981b5e9bdad029dd66a062f9c72c814e5aeec
|
@@ -6,7 +6,7 @@ Spree.ready(function ($) {
|
|
6
6
|
if (countryId != null) {
|
7
7
|
if (Spree.Checkout[countryId] == null) {
|
8
8
|
$.ajax({
|
9
|
-
async: false, method: 'GET', url: '/api/v2/storefront/countries/' + countryId + '?include=states', dataType: 'json'
|
9
|
+
async: false, method: 'GET', url: Spree.pathFor('/api/v2/storefront/countries/' + countryId + '?include=states'), dataType: 'json'
|
10
10
|
}).done(function (data) {
|
11
11
|
var json = data.included; var xStates = []
|
12
12
|
for (var i = 0; i < json.length; i++) {
|
@@ -62,7 +62,7 @@ Spree.ready(function ($) {
|
|
62
62
|
statesWithBlank = [{name: '', id: ''}].concat(states)
|
63
63
|
$.each(statesWithBlank, function (idx, state) {
|
64
64
|
var opt = $(document.createElement('option')).attr('value', state.id).html(state.name)
|
65
|
-
if (selected === state.id) {
|
65
|
+
if (selected.toString(10) === state.id.toString(10)) {
|
66
66
|
opt.prop('selected', true)
|
67
67
|
}
|
68
68
|
stateSelect.append(opt)
|
@@ -3,7 +3,7 @@ module Spree
|
|
3
3
|
include Spree::Core::ControllerHelpers::Order
|
4
4
|
|
5
5
|
skip_before_action :set_current_order, only: :cart_link
|
6
|
-
skip_before_action :verify_authenticity_token, only: :ensure_cart
|
6
|
+
skip_before_action :verify_authenticity_token, only: :ensure_cart, raise: false
|
7
7
|
|
8
8
|
def forbidden
|
9
9
|
render 'spree/shared/forbidden', layout: Spree::Config[:layout], status: 403
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Spree
|
2
|
+
module StructuredDataHelper
|
3
|
+
def products_structured_data(products)
|
4
|
+
content_tag :script, type: 'application/ld+json' do
|
5
|
+
raw(
|
6
|
+
products.map do |product|
|
7
|
+
structured_product_hash(product)
|
8
|
+
end.to_json
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
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',
|
30
|
+
url: spree.product_url(product),
|
31
|
+
availabilityEnds: product.discontinue_on ? product.discontinue_on.strftime('%F') : ''
|
32
|
+
}
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def structured_images(product)
|
37
|
+
images = product.has_variants? ? product.variant_images : product.images
|
38
|
+
|
39
|
+
return '' unless images.any?
|
40
|
+
|
41
|
+
main_app.rails_blob_url(images.first.attachment)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -1,19 +1,18 @@
|
|
1
1
|
<% url = spree.product_path(product, taxon_id: taxon.try(:id)) %>
|
2
|
-
<div id="product_<%= product.id %>" class="d-flex w-100 col-12 col-sm-6 col-lg-4 col-xl-3 product-list-item mb-4" data-hook="products_list_item"
|
2
|
+
<div id="product_<%= product.id %>" class="d-flex w-100 col-12 col-sm-6 col-lg-4 col-xl-3 product-list-item mb-4" data-hook="products_list_item">
|
3
3
|
<div class="card w-100">
|
4
4
|
<% cache(taxon.present? ? [I18n.locale, current_currency, taxon, product] : cache_key_for_product(product)) do %>
|
5
5
|
<div class="card-body text-center product-body">
|
6
|
-
<%= link_to url,
|
7
|
-
<%= small_image(product,
|
8
|
-
<%= content_tag(:span, truncate(product.name, length: 50), class: 'info mt-3 d-block',
|
6
|
+
<%= link_to url, class: 'd-block text-center' do %>
|
7
|
+
<%= small_image(product, class: "d-block mx-auto") %>
|
8
|
+
<%= content_tag(:span, truncate(product.name, length: 50), class: 'info mt-3 d-block', title: product.name) %>
|
9
9
|
<% end %>
|
10
10
|
</div>
|
11
11
|
<div class="card-footer text-center">
|
12
|
-
<span
|
13
|
-
<span class="price selling lead"
|
12
|
+
<span>
|
13
|
+
<span class="price selling lead">
|
14
14
|
<%= display_price(product) %>
|
15
15
|
</span>
|
16
|
-
<span itemprop="priceCurrency" content="<%= current_currency %>"></span>
|
17
16
|
</span>
|
18
17
|
</div>
|
19
18
|
<% end %>
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<% @body_id = 'product-details' %>
|
2
2
|
|
3
3
|
<% cache cache_key_for_product do %>
|
4
|
-
<div data-hook="product_show" class="row"
|
4
|
+
<div data-hook="product_show" class="row">
|
5
5
|
<div class="col-lg-4 col-md-5" data-hook="product_left_part">
|
6
6
|
<div data-hook="product_left_part_wrap">
|
7
7
|
<div id="product-images" data-hook="product_images">
|
8
8
|
<div id="main-image" class="card " data-hook>
|
9
9
|
<div class="card-body text-center">
|
10
|
-
<%= product_image(@product
|
10
|
+
<%= product_image(@product) %>
|
11
11
|
</div>
|
12
12
|
</div>
|
13
13
|
<div id="thumbnails" data-hook>
|
@@ -28,9 +28,9 @@
|
|
28
28
|
<div class="col-lg-8 col-md-7" data-hook="product_right_part">
|
29
29
|
<div data-hook="product_right_part_wrap">
|
30
30
|
<div id="product-description" data-hook="product_description">
|
31
|
-
<h1 class="product-title mt-2"
|
31
|
+
<h1 class="product-title mt-2"><%= @product.name %></h1>
|
32
32
|
|
33
|
-
<div
|
33
|
+
<div data-hook="description">
|
34
34
|
<%= sanitize product_description(@product) %>
|
35
35
|
</div>
|
36
36
|
|
@@ -46,3 +46,5 @@
|
|
46
46
|
</div>
|
47
47
|
</div>
|
48
48
|
<% end %>
|
49
|
+
|
50
|
+
<%= products_structured_data([@product]) %>
|
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.
|
4
|
+
version: 4.0.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-27 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.
|
19
|
+
version: 4.0.0.rc3
|
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.
|
26
|
+
version: 4.0.0.rc3
|
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.
|
33
|
+
version: 4.0.0.rc3
|
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.
|
40
|
+
version: 4.0.0.rc3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bootstrap
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- app/helpers/spree/addresses_helper.rb
|
172
172
|
- app/helpers/spree/frontend_helper.rb
|
173
173
|
- app/helpers/spree/orders_helper.rb
|
174
|
+
- app/helpers/spree/structured_data_helper.rb
|
174
175
|
- app/helpers/spree/taxons_helper.rb
|
175
176
|
- app/models/spree/frontend_configuration.rb
|
176
177
|
- app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb
|