spree_frontend 4.2.0.rc1 → 4.2.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/frontend.js +1 -1
- data/app/assets/javascripts/spree/frontend/cart.js +23 -1
- data/app/assets/javascripts/spree/frontend/views/spree/product/related.js +2 -2
- data/app/assets/stylesheets/spree/frontend/views/spree/checkout/edit.scss +3 -0
- data/app/controllers/concerns/spree/checkout/address_book.rb +9 -7
- data/app/controllers/spree/addresses_controller.rb +1 -0
- data/app/controllers/spree/currency_controller.rb +1 -1
- data/app/helpers/spree/frontend_helper.rb +2 -2
- data/app/views/spree/orders/_line_item_data.html.erb +1 -1
- data/app/views/spree/products/show.html.erb +0 -3
- data/app/views/spree/shared/_change_store.html.erb +2 -2
- metadata +9 -10
- data/app/views/spree/products/_vendor_info.html.erb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38163d04925f22790f12bdbbeb77beac79cdbd366c6ea04e065009b2fd9b82d1
|
4
|
+
data.tar.gz: b53af71727410e46e99acbbf972e13580fb3c41977508e41125c6b5718c8bfc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8b342aa804b56453c2c7bc447cf52d664f097c16b04de44e5d0bd3c153314e9450806b167b3372b2483ebcd5ab312eac3c868ee6b852b03106aaa094e69794f
|
7
|
+
data.tar.gz: 2c2d42c10cbbd8e2dedd374693255c9c24044c84dcf2a3e641fe0aa57cadfe3552134139af193c35cd78b4f9ba2749072803d78bfc67775a8c6a4ecddccf1f58
|
@@ -45,5 +45,5 @@ Spree.routes.ensure_cart = Spree.pathFor('ensure_cart')
|
|
45
45
|
Spree.routes.api_v2_storefront_cart_apply_coupon_code = Spree.pathFor('api/v2/storefront/cart/apply_coupon_code')
|
46
46
|
Spree.routes.api_v2_storefront_cart_remove_coupon_code = Spree.pathFor('api/v2/storefront/cart/remove_coupon_code')
|
47
47
|
Spree.routes.product = function(id) { return Spree.pathFor('products/' + id) }
|
48
|
-
Spree.routes.product_related = function(id) { return Spree.
|
48
|
+
Spree.routes.product_related = function(id) { return Spree.pathFor('products/' + id + '/related') }
|
49
49
|
Spree.routes.product_carousel = function (taxonId) { return Spree.pathFor('product_carousel/' + taxonId) }
|
@@ -3,6 +3,21 @@
|
|
3
3
|
Spree.ready(function ($) {
|
4
4
|
var formUpdateCart = $('form#update-cart')
|
5
5
|
|
6
|
+
function buildEventTriggerObject(dataset, quantity) {
|
7
|
+
if (!dataset || !quantity) return false
|
8
|
+
|
9
|
+
var triggerObject = {
|
10
|
+
type: 'product_remove_from_cart',
|
11
|
+
variant_sku: dataset.variantSku,
|
12
|
+
variant_name: dataset.variantName,
|
13
|
+
variant_price: dataset.variantPrice,
|
14
|
+
variant_options: dataset.variantOptions,
|
15
|
+
variant_quantity: quantity
|
16
|
+
}
|
17
|
+
|
18
|
+
return triggerObject
|
19
|
+
}
|
20
|
+
|
6
21
|
if (formUpdateCart.length) {
|
7
22
|
var clearInvalidCouponField = function() {
|
8
23
|
var couponCodeField = $('#order_coupon_code');
|
@@ -12,9 +27,16 @@ Spree.ready(function ($) {
|
|
12
27
|
}
|
13
28
|
}
|
14
29
|
|
15
|
-
formUpdateCart.find('a.delete').show().one('click', function () {
|
30
|
+
formUpdateCart.find('a.delete').show().one('click', function (event) {
|
31
|
+
var itemId = $(this).attr('data-id')
|
32
|
+
var link = $(event.currentTarget);
|
33
|
+
var quantityInputs = $("form#update-cart input.shopping-cart-item-quantity-input[data-id='" + itemId + "']")
|
34
|
+
var quantity = $(quantityInputs).val()
|
16
35
|
$(this).parents('.shopping-cart-item').first().find('input.shopping-cart-item-quantity-input').val(0)
|
17
36
|
clearInvalidCouponField()
|
37
|
+
if (link[0] && link[0].dataset && quantity) {
|
38
|
+
link.trigger(buildEventTriggerObject(link[0].dataset, quantity))
|
39
|
+
}
|
18
40
|
formUpdateCart.submit()
|
19
41
|
return false
|
20
42
|
})
|
@@ -1,6 +1,6 @@
|
|
1
1
|
//= require spree/frontend/viewport
|
2
2
|
|
3
|
-
Spree.
|
3
|
+
Spree.fetchRelatedProducts = function (id, htmlContainer) {
|
4
4
|
return $.ajax({
|
5
5
|
url: Spree.routes.product_related(id)
|
6
6
|
}).done(function (data) {
|
@@ -21,7 +21,7 @@ document.addEventListener('turbolinks:load', function () {
|
|
21
21
|
if (!relatedProductsFetched && relatedProductsContainer.length && relatedProductsEnabled && relatedProductsEnabled === 'true' && productId !== '') {
|
22
22
|
$(window).on('resize scroll', function () {
|
23
23
|
if (!relatedProductsFetched && relatedProductsContainer.isInViewport()) {
|
24
|
-
Spree.
|
24
|
+
Spree.fetchRelatedProducts(productId, relatedProductsContainer)
|
25
25
|
relatedProductsFetched = true
|
26
26
|
}
|
27
27
|
})
|
@@ -32,21 +32,23 @@ module Spree
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def normalize_addresses
|
35
|
-
return unless params[:state] == 'address' && @order.bill_address_id
|
35
|
+
return unless params[:state] == 'address' && @order.bill_address_id
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
if @order.checkout_steps.include?('delivery')
|
38
|
+
return unless @order.ship_address_id
|
39
|
+
end
|
39
40
|
|
40
41
|
bill_address = @order.bill_address
|
41
42
|
ship_address = @order.ship_address
|
43
|
+
|
44
|
+
if params[:save_user_address].present? && try_spree_current_user.present?
|
45
|
+
[bill_address, ship_address].each { |address| address&.update_attribute(:user_id, try_spree_current_user&.id) }
|
46
|
+
end
|
47
|
+
|
42
48
|
if @order.bill_address_id != @order.ship_address_id && bill_address == ship_address
|
43
49
|
@order.update_column(:bill_address_id, ship_address.id)
|
44
50
|
bill_address.destroy
|
45
|
-
elsif params[:save_user_address]
|
46
|
-
bill_address.update_attribute(:user_id, try_spree_current_user&.id)
|
47
51
|
end
|
48
|
-
|
49
|
-
ship_address.update_attribute(:user_id, try_spree_current_user&.id) if params[:save_user_address]
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
@@ -37,6 +37,7 @@ module Spree
|
|
37
37
|
else
|
38
38
|
new_address = @address.clone
|
39
39
|
new_address.attributes = address_params
|
40
|
+
new_address.user_id = @address.user_id
|
40
41
|
@address.update_attribute(:deleted_at, Time.current)
|
41
42
|
if new_address.save
|
42
43
|
flash[:notice] = Spree.t(:successfully_updated, scope: :address_book)
|
@@ -4,7 +4,7 @@ module Spree
|
|
4
4
|
@currency = supported_currencies.find { |currency| currency.iso_code == params[:currency] }
|
5
5
|
# Make sure that we update the current order, so the currency change is reflected.
|
6
6
|
current_order&.update_attributes!(currency: @currency.iso_code)
|
7
|
-
session[:currency] = params[:currency] if Spree::Config[:
|
7
|
+
session[:currency] = params[:currency] if Spree::Config[:show_store_currency_selector]
|
8
8
|
respond_to do |format|
|
9
9
|
format.json { render json: !@currency.nil? }
|
10
10
|
format.html do
|
@@ -274,12 +274,12 @@ module Spree
|
|
274
274
|
end
|
275
275
|
|
276
276
|
def available_option_types_cache_key
|
277
|
-
@available_option_types_cache_key ||= Spree::OptionType.maximum(:updated_at)&.utc&.to_i
|
277
|
+
@available_option_types_cache_key ||= Spree::OptionType.filterable.maximum(:updated_at)&.utc&.to_i
|
278
278
|
end
|
279
279
|
|
280
280
|
def available_option_types
|
281
281
|
@available_option_types ||= Rails.cache.fetch("available-option-types/#{available_option_types_cache_key}") do
|
282
|
-
Spree::OptionType.includes(:option_values).to_a
|
282
|
+
Spree::OptionType.includes(:option_values).filterable.to_a
|
283
283
|
end
|
284
284
|
@available_option_types
|
285
285
|
end
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<% end %>
|
23
23
|
|
24
24
|
<div class="shopping-cart-item-delete <%= additional_classes %>" data-hook="cart_item_delete">
|
25
|
-
<%= link_to '#', class: 'delete', id: "delete_#{dom_id(line_item)}", data: { turbolinks: false }, aria: { label: Spree.t('cart_page.remove_from_cart') } do %>
|
25
|
+
<%= link_to '#', class: 'delete', id: "delete_#{dom_id(line_item)}", data: { turbolinks: false, id: dom_id(line_item), variant_sku: line_item.sku, variant_name: line_item.name, variant_price: line_item.price, variant_options: line_item.options_text }, aria: { label: Spree.t('cart_page.remove_from_cart') } do %>
|
26
26
|
<%= icon(name: 'garbage',
|
27
27
|
classes: 'shopping-cart-item-delete-icon',
|
28
28
|
width: 18.9,
|
@@ -9,9 +9,6 @@
|
|
9
9
|
<div class="row" data-hook="product_show">
|
10
10
|
<%= render partial: 'gallery' %>
|
11
11
|
<div class="col-12 col-md-5" data-hook="product_right_part">
|
12
|
-
<% if @product.respond_to?(:vendor) %>
|
13
|
-
<%= render partial: 'vendor_info' %>
|
14
|
-
<% end %>
|
15
12
|
<div id="product-description" data-hook="product_right_part_wrap">
|
16
13
|
<h1 class="mt-3 mt-md-0 text-center text-md-left product-details-title">
|
17
14
|
<%= @product.name %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% if stores.size > 1 %>
|
1
|
+
<% if Spree::Config.show_store_currency_selector && stores.size > 1 %>
|
2
2
|
<li class="change-store">
|
3
3
|
<div class="dropdown navbar-right-dropdown">
|
4
4
|
<button id="stores-button" type="button" data-toggle="dropdown" class="navbar-right-dropdown-toggle" aria-label="<%= Spree.t('nav_bar.change_country')%>">
|
@@ -12,7 +12,7 @@
|
|
12
12
|
height: 15) %>
|
13
13
|
</button>
|
14
14
|
|
15
|
-
<div class="dropdown-menu dropdown-menu-right text-right">
|
15
|
+
<div id="stores_list" class="dropdown-menu dropdown-menu-right text-right">
|
16
16
|
<% stores.each do |store| %>
|
17
17
|
<div class="pl-3 d-flex justify-content-between align-items-center <%= 'active' if store.id == current_store.id %>">
|
18
18
|
<span class="flag-icon flag-icon-<%= store_country_iso(store) %>"></span>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_frontend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.0.
|
4
|
+
version: 4.2.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-10
|
12
|
+
date: 2020-11-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spree_api
|
@@ -17,28 +17,28 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 4.2.0.
|
20
|
+
version: 4.2.0.rc2
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 4.2.0.
|
27
|
+
version: 4.2.0.rc2
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: spree_core
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - '='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 4.2.0.
|
34
|
+
version: 4.2.0.rc2
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - '='
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 4.2.0.
|
41
|
+
version: 4.2.0.rc2
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: bootstrap
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -712,7 +712,6 @@ files:
|
|
712
712
|
- app/views/spree/products/_sort_mobile.html.erb
|
713
713
|
- app/views/spree/products/_taxons.html.erb
|
714
714
|
- app/views/spree/products/_thumbnails.html.erb
|
715
|
-
- app/views/spree/products/_vendor_info.html.erb
|
716
715
|
- app/views/spree/products/index.html.erb
|
717
716
|
- app/views/spree/products/related.html.erb
|
718
717
|
- app/views/spree/products/show.html.erb
|
@@ -784,9 +783,9 @@ licenses:
|
|
784
783
|
- BSD-3-Clause
|
785
784
|
metadata:
|
786
785
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
787
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v4.2.0.
|
786
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v4.2.0.rc2
|
788
787
|
documentation_uri: https://guides.spreecommerce.org/
|
789
|
-
source_code_uri: https://github.com/spree/spree/tree/v4.2.0.
|
788
|
+
source_code_uri: https://github.com/spree/spree/tree/v4.2.0.rc2
|
790
789
|
post_install_message:
|
791
790
|
rdoc_options: []
|
792
791
|
require_paths:
|
@@ -803,7 +802,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
803
802
|
version: 1.3.1
|
804
803
|
requirements:
|
805
804
|
- none
|
806
|
-
rubygems_version: 3.1.
|
805
|
+
rubygems_version: 3.1.2
|
807
806
|
signing_key:
|
808
807
|
specification_version: 4
|
809
808
|
summary: Frontend e-commerce functionality for the Spree project.
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<% if @product.vendor %>
|
2
|
-
<div id="product-vendor-info">
|
3
|
-
<%= link_to vendor_path(@product.vendor), class: "vendor-link d-inline-block" do %>
|
4
|
-
<% if @product.vendor.image %>
|
5
|
-
<%= image_tag main_app.url_for(@product.vendor.image.url(:small)), class: 'product-details-vendor-img d-block' %>
|
6
|
-
<% end %>
|
7
|
-
<h4 class="product-details-vendor-name d-flex align-items-center mt-3 mb-4">
|
8
|
-
<%= @product.vendor.name %>
|
9
|
-
<%= icon(name: 'arrow-right', classes: "vendor-icon ml-2", width: 18, height: 20) %>
|
10
|
-
</h4>
|
11
|
-
<% end %>
|
12
|
-
</div>
|
13
|
-
<% end %>
|