spree_frontend 4.1.0.rc2 → 4.1.0.rc3
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/cart.js +12 -0
- data/app/assets/javascripts/spree/frontend/checkout/address.js +2 -3
- data/app/assets/javascripts/spree/frontend/checkout/shipment.js +16 -4
- data/app/assets/javascripts/spree/frontend/views/spree/layouts/spree_application.js +30 -0
- data/app/assets/javascripts/spree/frontend/views/spree/products/modal_carousel.js +31 -12
- data/app/assets/javascripts/spree/frontend/views/spree/shared/carousel/thumbnails.js +77 -37
- data/app/assets/javascripts/spree/frontend/views/spree/shared/nav_bar.js +16 -7
- data/app/assets/javascripts/spree/frontend/views/spree/shared/product_added_modal.js +1 -1
- data/app/assets/stylesheets/spree/frontend/application.scss +1 -0
- data/app/assets/stylesheets/spree/frontend/components-bootstrap/modal.scss +4 -0
- data/app/assets/stylesheets/spree/frontend/components-custom/inputs.scss +14 -13
- data/app/assets/stylesheets/spree/frontend/views/spree/checkout/confirm.scss +5 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/checkout/edit.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/checkout/registration.scss +0 -1
- data/app/assets/stylesheets/spree/frontend/views/spree/orders/edit.scss +9 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/products/cart_form.scss +17 -15
- data/app/assets/stylesheets/spree/frontend/views/spree/products/show.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/carousel/thumbnails.scss +3 -12
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/delete_address_popup.scss +3 -26
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/dropdown.scss +3 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/main_nav_bar.scss +2 -1
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/quantity_select.scss +3 -1
- data/app/controllers/spree/products_controller.rb +13 -0
- data/app/controllers/spree/taxons_controller.rb +32 -7
- data/app/helpers/spree/addresses_helper.rb +3 -1
- data/app/helpers/spree/frontend_helper.rb +15 -6
- data/app/views/spree/checkout/_delivery.html.erb +2 -1
- data/app/views/spree/checkout/_summary.html.erb +29 -2
- data/app/views/spree/checkout/edit.html.erb +7 -5
- data/app/views/spree/checkout/registration.html.erb +1 -1
- data/app/views/spree/products/_cart_form.html.erb +2 -2
- data/app/views/spree/products/_filters_desktop.html.erb +3 -3
- data/app/views/spree/products/_filters_mobile.html.erb +7 -7
- data/app/views/spree/products/_gallery_modal.html.erb +2 -2
- data/app/views/spree/products/_sort_desktop.html.erb +2 -2
- data/app/views/spree/products/_sort_mobile.html.erb +2 -2
- data/app/views/spree/shared/_cart.html.erb +0 -2
- data/app/views/spree/shared/_checkout_header.html.erb +1 -1
- data/app/views/spree/shared/_copyright.html.erb +1 -1
- data/app/views/spree/shared/_header.html.erb +1 -1
- data/app/views/spree/shared/_link_to_cart.html.erb +5 -2
- data/app/views/spree/shared/_main_nav_bar.html.erb +3 -3
- data/app/views/spree/shared/_nav_bar.html.erb +1 -1
- data/app/views/spree/shared/_option_values.html.erb +1 -1
- data/app/views/spree/shared/_registration.html.erb +1 -1
- data/app/views/spree/shared/carousel/_thumbnails.html.erb +1 -1
- data/app/views/spree/taxons/_subcategories.html.erb +2 -3
- 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: 6300d485b7d4f5e1ceab8dc942affa9be2a7fcb0cca1e233837428e230d45742
|
4
|
+
data.tar.gz: b5c81d760faa402320a3f2298f9c4e22eef9ec08c63e938bae635b35c989e529
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbdb68dfcc5c7a71b48e2e3777428e40bbbc7f86307d3fcf55fb8d5e15070414445ea372f647b3b60819f68adc0dc37bdf6de3fc3db4c45c5e424b5f6b6edb27
|
7
|
+
data.tar.gz: 748be2c488b297951807df6038a97f99f48efbe2b188d19117276eeee8f260ece52dfcf2bfd38dc9bc0b6e14ecbb755c63fa3e4a721563f1fe5230070ded6585
|
@@ -4,8 +4,17 @@ Spree.ready(function ($) {
|
|
4
4
|
var formUpdateCart = $('form#update-cart')
|
5
5
|
|
6
6
|
if (formUpdateCart.length) {
|
7
|
+
var clearInvalidCouponField = function() {
|
8
|
+
var couponCodeField = $('#order_coupon_code');
|
9
|
+
var couponStatus = $('#coupon_status');
|
10
|
+
if (!!couponCodeField.val() && couponStatus.hasClass('alert-error')) {
|
11
|
+
couponCodeField.val('')
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
7
15
|
$('form#update-cart a.delete').show().one('click', function () {
|
8
16
|
$(this).parents('.shopping-cart-item').first().find('input.shopping-cart-item-quantity-input').val(0)
|
17
|
+
clearInvalidCouponField()
|
9
18
|
$(this).parents('form').first().submit()
|
10
19
|
return false
|
11
20
|
})
|
@@ -17,6 +26,7 @@ Spree.ready(function ($) {
|
|
17
26
|
$(targetInputs).val(newValue)
|
18
27
|
})
|
19
28
|
$('form#update-cart input.shopping-cart-item-quantity-input').on('change', function(e) {
|
29
|
+
clearInvalidCouponField()
|
20
30
|
formUpdateCart.submit()
|
21
31
|
})
|
22
32
|
$('form#update-cart button.shopping-cart-item-quantity-decrease-btn').off('click').on('click', function() {
|
@@ -26,6 +36,7 @@ Spree.ready(function ($) {
|
|
26
36
|
|
27
37
|
if (inputValue > 1) {
|
28
38
|
$(input).val(inputValue - 1)
|
39
|
+
clearInvalidCouponField()
|
29
40
|
formUpdateCart.submit()
|
30
41
|
}
|
31
42
|
})
|
@@ -35,6 +46,7 @@ Spree.ready(function ($) {
|
|
35
46
|
var inputValue = parseInt($(input).val(), 10)
|
36
47
|
|
37
48
|
$(input).val(inputValue + 1)
|
49
|
+
clearInvalidCouponField()
|
38
50
|
formUpdateCart.submit()
|
39
51
|
})
|
40
52
|
$('form#update-cart button#shopping-cart-coupon-code-button').off('click').on('click', function(event) {
|
@@ -48,7 +48,7 @@ Spree.ready(function ($) {
|
|
48
48
|
}
|
49
49
|
|
50
50
|
Spree.fillStates = function (data, region) {
|
51
|
-
var selected
|
51
|
+
var selected
|
52
52
|
var statesRequired = data.states_required
|
53
53
|
var states = data.states
|
54
54
|
var statePara = $('#' + region + 'state')
|
@@ -59,8 +59,7 @@ Spree.ready(function ($) {
|
|
59
59
|
if (states.length > 0) {
|
60
60
|
selected = parseInt(stateSelect.val())
|
61
61
|
stateSelect.html('')
|
62
|
-
|
63
|
-
$.each(statesWithBlank, function (idx, state) {
|
62
|
+
$.each(states, function (idx, state) {
|
64
63
|
var opt = $(document.createElement('option')).attr('value', state.id).html(state.name)
|
65
64
|
if (selected.toString(10) === state.id.toString(10)) {
|
66
65
|
opt.prop('selected', true)
|
@@ -3,6 +3,8 @@ function ShippingTotalManager (input1) {
|
|
3
3
|
this.input = input1
|
4
4
|
this.shippingMethods = this.input.shippingMethods
|
5
5
|
this.shipmentTotal = this.input.shipmentTotal
|
6
|
+
this.taxTotal = this.input.taxTotal
|
7
|
+
this.nonShipmentTax = $(this.taxTotal).data('non-shipment-tax')
|
6
8
|
this.orderTotal = this.input.orderTotal
|
7
9
|
this.formatOptions = {
|
8
10
|
symbol: this.shipmentTotal.data('currency'),
|
@@ -15,20 +17,29 @@ function ShippingTotalManager (input1) {
|
|
15
17
|
ShippingTotalManager.prototype.calculateShipmentTotal = function () {
|
16
18
|
var checked = $(this.shippingMethods).filter(':checked')
|
17
19
|
this.sum = 0
|
20
|
+
this.tax = this.parseCurrencyToFloat(this.nonShipmentTax)
|
18
21
|
$.each(checked, function (idx, shippingMethod) {
|
19
22
|
this.sum += this.parseCurrencyToFloat($(shippingMethod).data('cost'))
|
23
|
+
this.tax += this.parseCurrencyToFloat($(shippingMethod).data('tax'))
|
20
24
|
}.bind(this))
|
21
|
-
return this.readjustSummarySection(
|
25
|
+
return this.readjustSummarySection(
|
26
|
+
this.parseCurrencyToFloat(this.orderTotal.html()),
|
27
|
+
this.sum,
|
28
|
+
this.parseCurrencyToFloat(this.shipmentTotal.html()),
|
29
|
+
this.tax,
|
30
|
+
this.parseCurrencyToFloat(this.taxTotal.html())
|
31
|
+
)
|
22
32
|
}
|
23
33
|
|
24
34
|
ShippingTotalManager.prototype.parseCurrencyToFloat = function (input) {
|
25
35
|
return accounting.unformat(input, this.formatOptions.decimal)
|
26
36
|
}
|
27
37
|
|
28
|
-
ShippingTotalManager.prototype.readjustSummarySection = function (orderTotal, newShipmentTotal, oldShipmentTotal) {
|
29
|
-
var newOrderTotal = orderTotal + (newShipmentTotal - oldShipmentTotal)
|
38
|
+
ShippingTotalManager.prototype.readjustSummarySection = function (orderTotal, newShipmentTotal, oldShipmentTotal, newTaxTotal, oldTaxTotal) {
|
39
|
+
var newOrderTotal = orderTotal + (newShipmentTotal - oldShipmentTotal) + (newTaxTotal - oldTaxTotal)
|
40
|
+
this.taxTotal.html(accounting.formatMoney(newTaxTotal, this.formatOptions))
|
30
41
|
this.shipmentTotal.html(accounting.formatMoney(newShipmentTotal, this.formatOptions))
|
31
|
-
return this.orderTotal.html(accounting.formatMoney(newOrderTotal, this.formatOptions))
|
42
|
+
return this.orderTotal.html(accounting.formatMoney(accounting.toFixed(newOrderTotal, 10), this.formatOptions))
|
32
43
|
}
|
33
44
|
|
34
45
|
ShippingTotalManager.prototype.bindEvent = function () {
|
@@ -40,6 +51,7 @@ ShippingTotalManager.prototype.bindEvent = function () {
|
|
40
51
|
Spree.ready(function ($) {
|
41
52
|
var input = {
|
42
53
|
orderTotal: $('#summary-order-total'),
|
54
|
+
taxTotal: $('[data-hook="tax-total"]'),
|
43
55
|
shipmentTotal: $('[data-hook="shipping-total"]'),
|
44
56
|
shippingMethods: $('input[data-behavior="shipping-method-selector"]')
|
45
57
|
}
|
@@ -32,4 +32,34 @@ Spree.ready(function ($) {
|
|
32
32
|
}
|
33
33
|
}
|
34
34
|
};
|
35
|
+
|
36
|
+
var searchDropdown = document.getElementById('search-dropdown')
|
37
|
+
var navBarCategoryLinks = document.getElementsByClassName('main-nav-bar-category-links')
|
38
|
+
var navBarCategoryButtons = document.getElementsByClassName('main-nav-bar-category-button')
|
39
|
+
var navBarCategoryImages = document.getElementsByClassName('category-image')
|
40
|
+
var navBarAccountIcon = [document.getElementById('account-button')]
|
41
|
+
var navBarCartIcon = [document.getElementById('link-to-cart')]
|
42
|
+
var spreeLogoImage = document.getElementsByClassName('header-spree-fluid-logo')
|
43
|
+
var spreeMobileNavs = document.getElementsByClassName('mobile-navigation-list-item')
|
44
|
+
var navbarLinks = [
|
45
|
+
navBarCategoryLinks,
|
46
|
+
navBarCategoryButtons,
|
47
|
+
navBarCategoryImages,
|
48
|
+
navBarAccountIcon,
|
49
|
+
navBarCartIcon,
|
50
|
+
spreeLogoImage,
|
51
|
+
spreeMobileNavs
|
52
|
+
]
|
53
|
+
|
54
|
+
if (searchDropdown !== null) {
|
55
|
+
$.each(navbarLinks, function(index, navbarElements) {
|
56
|
+
$.each(navbarElements, function(index, navBarCategoryLink) {
|
57
|
+
navBarCategoryLink.addEventListener('click', function () {
|
58
|
+
document.getElementById('overlay').classList.remove('shown');
|
59
|
+
searchDropdown.classList.remove('shown');
|
60
|
+
document.querySelector('.header-spree').classList.remove('above-overlay')
|
61
|
+
});
|
62
|
+
});
|
63
|
+
});
|
64
|
+
};
|
35
65
|
});
|
@@ -1,26 +1,44 @@
|
|
1
1
|
Spree.ready(function($) {
|
2
|
-
var
|
3
|
-
if (
|
4
|
-
ThumbnailsCarousel($,
|
2
|
+
var modalCarousel = $('#productModalThumbnailsCarousel')
|
3
|
+
if (modalCarousel.length) {
|
4
|
+
ThumbnailsCarousel($, modalCarousel)
|
5
5
|
}
|
6
6
|
|
7
7
|
var activeSingleImageIndex = function(sourceWrappingClass) {
|
8
|
-
var
|
9
|
-
return
|
8
|
+
var activeSingleImage = $('.' + sourceWrappingClass + ' .product-details-single [data-variant-id].active')
|
9
|
+
return activeSingleImage.index()
|
10
10
|
}
|
11
11
|
|
12
|
-
var
|
13
|
-
var
|
14
|
-
var
|
15
|
-
|
16
|
-
|
12
|
+
var selectThumbnail = function(imgIndex, carousel) {
|
13
|
+
var carouselPerPage = carousel.data('product-carousel-per-page')
|
14
|
+
var carouselItems = carousel.find('> div > div.carousel-item.product-thumbnails-carousel-item')
|
15
|
+
var carouselItem = carouselItems[Math.floor(imgIndex / carouselPerPage)]
|
16
|
+
|
17
|
+
carouselItems.removeClass('active')
|
18
|
+
$(carouselItems).find('img').removeClass('selected')
|
19
|
+
$(carouselItem).addClass('active')
|
20
|
+
|
21
|
+
var thumbnailsChildren = $(carouselItem).find('> div > div')
|
22
|
+
.children('.product-thumbnails-carousel-item-single--visible[data-variant-id]')
|
23
|
+
if (thumbnailsChildren.length > 0) {
|
24
|
+
$(thumbnailsChildren.get(imgIndex % carouselPerPage).getElementsByTagName('img')[0]).addClass('selected')
|
17
25
|
}
|
18
26
|
}
|
19
27
|
|
28
|
+
var selectModalThumbnail = function(imgIndex) {
|
29
|
+
selectThumbnail(imgIndex, modalCarousel)
|
30
|
+
}
|
31
|
+
|
32
|
+
var selectProductCarouselThumbnail = function() {
|
33
|
+
var imgIndex = activeSingleImageIndex('modal') - 1
|
34
|
+
var productCarousel = $('#productThumbnailsCarousel')
|
35
|
+
selectThumbnail(imgIndex, productCarousel)
|
36
|
+
}
|
37
|
+
|
20
38
|
var activateModalSingleImg = function(imgIndex, targetWrappingClass) {
|
21
39
|
$('.' + targetWrappingClass + ' .product-details-single [data-variant-id].active').removeClass('active')
|
22
|
-
var
|
23
|
-
|
40
|
+
var modalActiveSingleImage = $($('.' + targetWrappingClass + ' .product-details-single [data-variant-id]').parent().children().get(imgIndex))
|
41
|
+
modalActiveSingleImage.addClass('active')
|
24
42
|
}
|
25
43
|
|
26
44
|
$('#picturesModal').on('show.bs.modal', function() {
|
@@ -31,5 +49,6 @@ Spree.ready(function($) {
|
|
31
49
|
|
32
50
|
$('#picturesModal').on('hide.bs.modal', function() {
|
33
51
|
activateModalSingleImg(activeSingleImageIndex('modal'), 'row')
|
52
|
+
selectProductCarouselThumbnail()
|
34
53
|
})
|
35
54
|
})
|
@@ -1,43 +1,83 @@
|
|
1
|
-
function ThumbnailsCarousel($,
|
1
|
+
function ThumbnailsCarousel($, carousel) {
|
2
2
|
var VISIBLE_IMAGE_SELECTOR = '.product-thumbnails-carousel-item-single--visible img'
|
3
3
|
var SELECTED_IMAGE_CLASS = 'selected'
|
4
4
|
var self = this
|
5
|
+
var modalCarouselId = 'productModalThumbnailsCarousel'
|
6
|
+
var modalCarousel = $('#' + modalCarouselId)
|
7
|
+
var zoomClickObject = $('.product-carousel-overlay-modal-opener')
|
5
8
|
|
6
9
|
this.constructor = function() {
|
7
10
|
this.bindEventHandlers()
|
8
11
|
}
|
9
12
|
|
10
13
|
this.bindEventHandlers = function() {
|
11
|
-
|
12
|
-
|
14
|
+
zoomClickObject.on('click', this.handleZoomClick)
|
15
|
+
carousel.on('click', 'img', this.handleImageClick)
|
16
|
+
carousel.on('thumbnails:ready', this.handleThumbnailsReady)
|
13
17
|
|
14
18
|
$('body').on('single_carousel:slide', this.handleSingleCarouselSlide)
|
15
19
|
}
|
16
20
|
|
17
21
|
this.handleImageClick = function(event) {
|
18
|
-
self.selectImage($(event.target))
|
22
|
+
self.selectImage(event, $(event.target))
|
19
23
|
}
|
20
24
|
|
21
|
-
this.handleThumbnailsReady = function(
|
22
|
-
var
|
25
|
+
this.handleThumbnailsReady = function(event) {
|
26
|
+
var image = carousel.find(VISIBLE_IMAGE_SELECTOR).eq(0)
|
23
27
|
|
24
|
-
self.selectImage(
|
28
|
+
self.selectImage(event, image)
|
25
29
|
}
|
26
30
|
|
27
|
-
this.handleSingleCarouselSlide = function(
|
28
|
-
var
|
31
|
+
this.handleSingleCarouselSlide = function(event, imageIndex) {
|
32
|
+
var image;
|
33
|
+
if (event.target.id === 'productModalCarousel') {
|
34
|
+
image = modalCarousel.find('[data-product-carousel-to-slide=' + imageIndex + '] img')
|
35
|
+
self.unselectModalImages()
|
36
|
+
} else {
|
37
|
+
image = carousel.find('[data-product-carousel-to-slide=' + imageIndex + '] img')
|
38
|
+
self.unselectThumbanilsImages()
|
39
|
+
}
|
40
|
+
|
41
|
+
image.addClass(SELECTED_IMAGE_CLASS)
|
42
|
+
}
|
43
|
+
|
44
|
+
this.selectImage = function(event, image) {
|
45
|
+
var clickedElement = event.target
|
46
|
+
var productModalThumbnailClicked = $(clickedElement).closest('.product-thumbnails-carousel').is('#' + modalCarouselId)
|
47
|
+
|
48
|
+
if (clickedElement.id === modalCarouselId || productModalThumbnailClicked) {
|
49
|
+
this.unselectModalImages()
|
50
|
+
} else {
|
51
|
+
this.unselectThumbanilsImages()
|
52
|
+
}
|
29
53
|
|
30
|
-
|
54
|
+
image.addClass(SELECTED_IMAGE_CLASS)
|
31
55
|
}
|
32
56
|
|
33
|
-
this.
|
34
|
-
|
57
|
+
this.unselectThumbanilsImages = function() {
|
58
|
+
carousel.find('img').removeClass(SELECTED_IMAGE_CLASS)
|
59
|
+
}
|
60
|
+
|
61
|
+
this.unselectModalImages = function() {
|
62
|
+
modalCarousel.find('img').removeClass(SELECTED_IMAGE_CLASS)
|
63
|
+
}
|
35
64
|
|
36
|
-
|
65
|
+
this.handleZoomClick = function(event) {
|
66
|
+
var selectedImageId = self.getSelectedImageId()
|
67
|
+
var image = modalCarousel.find(VISIBLE_IMAGE_SELECTOR).eq(selectedImageId)
|
68
|
+
self.unselectModalImages()
|
69
|
+
|
70
|
+
image.addClass(SELECTED_IMAGE_CLASS)
|
37
71
|
}
|
38
72
|
|
39
|
-
this.
|
40
|
-
$
|
73
|
+
this.getSelectedImageId = function() {
|
74
|
+
var selectedImages = $('#productThumbnailsCarousel').find('img.d-block.w-100.lazyloaded.selected')
|
75
|
+
|
76
|
+
if (selectedImages.length > 1) {
|
77
|
+
return $(selectedImages[1]).parent()[0].dataset.productCarouselToSlide
|
78
|
+
} else {
|
79
|
+
return '0'
|
80
|
+
}
|
41
81
|
}
|
42
82
|
|
43
83
|
this.constructor()
|
@@ -61,7 +101,7 @@ Spree.ready(function($) {
|
|
61
101
|
)
|
62
102
|
}
|
63
103
|
|
64
|
-
Spree.showThumbnailsCarouselVariantImages = function(
|
104
|
+
Spree.showThumbnailsCarouselVariantImages = function(carousel, variantId) {
|
65
105
|
var carouselSlideSelector = '.product-thumbnails-carousel-item'
|
66
106
|
var carouselSlideContainerSelector =
|
67
107
|
'.product-thumbnails-carousel-item-content'
|
@@ -71,52 +111,52 @@ Spree.ready(function($) {
|
|
71
111
|
var carouselPerPageAttributeName = 'data-product-carousel-per-page'
|
72
112
|
var carouselEmptyClass = 'product-thumbnails-carousel--empty'
|
73
113
|
|
74
|
-
|
114
|
+
carousel.carouselBootstrap4('dispose')
|
75
115
|
var qualifiedSlides = 0
|
76
|
-
var perPage = parseInt(
|
77
|
-
var
|
116
|
+
var perPage = parseInt(carousel.attr(carouselPerPageAttributeName)) || 1
|
117
|
+
var slides = carousel.find(carouselSlideSelector)
|
78
118
|
|
79
|
-
|
119
|
+
carousel
|
80
120
|
.find(carouselItemSelector)
|
81
121
|
.each(function(_itemIndex, slideElement) {
|
82
122
|
// Switch item visibility in the carousel based on picked variant.
|
83
123
|
|
84
124
|
var targetSlideIndex
|
85
|
-
var
|
125
|
+
var slide = $(slideElement)
|
86
126
|
var qualifies =
|
87
|
-
|
88
|
-
|
127
|
+
slide.attr(variantIdAttributeName) === variantId ||
|
128
|
+
slide.attr(isMasterVariantAttributeName) === 'true'
|
89
129
|
|
90
130
|
if (qualifies) {
|
91
131
|
qualifiedSlides += 1
|
92
|
-
|
132
|
+
slide.attr(carouselToSlideAttributeName, qualifiedSlides - 1)
|
93
133
|
}
|
94
134
|
|
95
135
|
targetSlideIndex = Math.max(0, Math.ceil(qualifiedSlides / perPage) - 1)
|
96
|
-
|
97
|
-
|
136
|
+
slide.detach()
|
137
|
+
slides
|
98
138
|
.eq(targetSlideIndex)
|
99
139
|
.find(carouselSlideContainerSelector)
|
100
|
-
.append(
|
101
|
-
|
140
|
+
.append(slide)
|
141
|
+
slide.toggleClass(enabledCarouselSingleClass, qualifies)
|
102
142
|
})
|
103
143
|
var enabledSlidesCount = Math.ceil(qualifiedSlides / perPage)
|
104
|
-
|
144
|
+
carousel
|
105
145
|
.find(carouselSlideSelector)
|
106
146
|
.each(function(slideIndex, slideElement) {
|
107
|
-
var
|
108
|
-
|
147
|
+
var slide = $(slideElement)
|
148
|
+
slide.toggleClass(
|
109
149
|
enabledCarouselItemClass,
|
110
150
|
slideIndex < enabledSlidesCount
|
111
151
|
)
|
112
|
-
|
152
|
+
slide.toggleClass(activeCarouselItemClass, slideIndex === 0)
|
113
153
|
})
|
114
154
|
|
115
155
|
// If there are no images to show after picking a variant, disable the carousel.
|
116
|
-
|
156
|
+
carousel.toggleClass(carouselEmptyClass, enabledSlidesCount === 0)
|
117
157
|
|
118
|
-
|
119
|
-
|
158
|
+
carousel.carouselBootstrap4()
|
159
|
+
carousel.trigger('thumbnails:ready')
|
120
160
|
}
|
121
161
|
|
122
162
|
$('#product-details').on('variant_id_change', function(options) {
|
@@ -130,8 +170,8 @@ Spree.ready(function($) {
|
|
130
170
|
})
|
131
171
|
})
|
132
172
|
|
133
|
-
var
|
173
|
+
var carousel = $('#productThumbnailsCarousel')
|
134
174
|
|
135
|
-
ThumbnailsCarousel($,
|
175
|
+
ThumbnailsCarousel($, carousel)
|
136
176
|
}
|
137
177
|
})
|
@@ -1,16 +1,25 @@
|
|
1
|
-
|
1
|
+
$(document).ready(function() {
|
2
2
|
var searchIcons = document.querySelectorAll('#nav-bar .search-icons')[0]
|
3
|
+
var searchDropdown = document.getElementById('search-dropdown')
|
3
4
|
|
4
5
|
if (searchIcons !== undefined) {
|
5
6
|
searchIcons.addEventListener(
|
6
7
|
'click',
|
7
|
-
|
8
|
-
document.querySelector('.header-spree').classList.add('above-overlay')
|
9
|
-
document.getElementById('overlay').classList.add('shown')
|
10
|
-
document.getElementById('search-dropdown').classList.add('shown')
|
11
|
-
document.querySelector('#search-dropdown input').focus()
|
12
|
-
},
|
8
|
+
toggleSearchBar,
|
13
9
|
false
|
14
10
|
)
|
15
11
|
}
|
12
|
+
|
13
|
+
function toggleSearchBar() {
|
14
|
+
if (searchDropdown.classList.contains('shown')) {
|
15
|
+
document.querySelector('.header-spree').classList.remove('above-overlay')
|
16
|
+
document.getElementById('overlay').classList.remove('shown')
|
17
|
+
searchDropdown.classList.remove('shown')
|
18
|
+
} else {
|
19
|
+
document.querySelector('.header-spree').classList.add('above-overlay')
|
20
|
+
document.getElementById('overlay').classList.add('shown')
|
21
|
+
searchDropdown.classList.add('shown')
|
22
|
+
document.querySelector('#search-dropdown input').focus()
|
23
|
+
}
|
24
|
+
}
|
16
25
|
})
|
@@ -12,7 +12,7 @@ Spree.showProductAddedModal = function(product, variant) {
|
|
12
12
|
var $modal = $(modalSelector)
|
13
13
|
|
14
14
|
$modal.find(nameSelector).text(name)
|
15
|
-
$modal.find(priceSelector).
|
15
|
+
$modal.find(priceSelector).html(price)
|
16
16
|
|
17
17
|
if (leadImage !== null) {
|
18
18
|
$modal
|