spree_frontend 4.0.8 → 4.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/app/assets/images/arrow-right.svg +1 -0
- data/app/assets/images/arrow.svg +1 -0
- data/app/assets/images/bag.svg +1 -0
- data/app/assets/images/burger.svg +1 -0
- data/app/assets/images/check-mark-circle.png +0 -0
- data/app/assets/images/check-mark-circle.svg +1 -0
- data/app/assets/images/check-mark.svg +1 -0
- data/app/assets/images/circle-radio.svg +1 -0
- data/app/assets/images/circle.svg +1 -0
- data/app/assets/images/close.svg +1 -0
- data/app/assets/images/credit_cards/icons/american_express.svg +1 -0
- data/app/assets/images/credit_cards/icons/diners_club.svg +1 -0
- data/app/assets/images/credit_cards/icons/discover.svg +1 -0
- data/app/assets/images/credit_cards/icons/generic.svg +1 -0
- data/app/assets/images/credit_cards/icons/jcb.svg +1 -0
- data/app/assets/images/credit_cards/icons/maestro.svg +1 -0
- data/app/assets/images/credit_cards/icons/master.svg +1 -0
- data/app/assets/images/credit_cards/icons/visa.svg +1 -0
- data/app/assets/images/edit.svg +1 -0
- data/app/assets/images/empty-cart.svg +1 -0
- data/app/assets/images/error.svg +1 -0
- data/app/assets/images/facebook.svg +1 -0
- data/app/assets/images/full_circle-radio.svg +1 -0
- data/app/assets/images/full_circle.svg +1 -0
- data/app/assets/images/garbage.svg +1 -0
- data/app/assets/images/garbage_2.svg +1 -0
- data/app/assets/images/homepage/big_category_banner.jpg +0 -0
- data/app/assets/images/homepage/big_category_banner_mobile.jpg +0 -0
- data/app/assets/images/homepage/big_category_banner_tablet_landscape.jpg +0 -0
- data/app/assets/images/homepage/big_category_banner_tablet_portrait.jpg +0 -0
- data/app/assets/images/homepage/category_banner_lower.jpg +0 -0
- data/app/assets/images/homepage/category_banner_lower_mobile.jpg +0 -0
- data/app/assets/images/homepage/category_banner_lower_tablet_landscape.jpg +0 -0
- data/app/assets/images/homepage/category_banner_lower_tablet_portrait.jpg +0 -0
- data/app/assets/images/homepage/category_banner_upper.jpg +0 -0
- data/app/assets/images/homepage/category_banner_upper_mobile.jpg +0 -0
- data/app/assets/images/homepage/category_banner_upper_tablet_landscape.jpg +0 -0
- data/app/assets/images/homepage/category_banner_upper_tablet_portrait.jpg +0 -0
- data/app/assets/images/homepage/main_banner.jpg +0 -0
- data/app/assets/images/homepage/main_banner_mobile.jpg +0 -0
- data/app/assets/images/homepage/main_banner_tablet_landscape.jpg +0 -0
- data/app/assets/images/homepage/main_banner_tablet_portrait.jpg +0 -0
- data/app/assets/images/homepage/products.jpg +0 -0
- data/app/assets/images/homepage/promo_banner_left.jpg +0 -0
- data/app/assets/images/homepage/promo_banner_left_mobile.jpg +0 -0
- data/app/assets/images/homepage/promo_banner_left_tablet_landscape.jpg +0 -0
- data/app/assets/images/homepage/promo_banner_left_tablet_portrait.jpg +0 -0
- data/app/assets/images/homepage/promo_banner_right.jpg +0 -0
- data/app/assets/images/homepage/promo_banner_right_mobile.jpg +0 -0
- data/app/assets/images/homepage/promo_banner_right_tablet_landscape.jpg +0 -0
- data/app/assets/images/homepage/promo_banner_right_tablet_portrait.jpg +0 -0
- data/app/assets/images/instagram.svg +1 -0
- data/app/assets/images/logo-spree.png +0 -0
- data/app/assets/images/logo.png +0 -0
- data/app/assets/images/logo.svg +1 -0
- data/app/assets/images/logo@2x.png +0 -0
- data/app/assets/images/logo@3x.png +0 -0
- data/app/assets/images/magnifying-glass.svg +1 -0
- data/app/assets/images/meganav/promo_banner_left-first-category.jpg +0 -0
- data/app/assets/images/meganav/promo_banner_left-second-category.jpg +0 -0
- data/app/assets/images/meganav/promo_banner_left-third-category.jpg +0 -0
- data/app/assets/images/meganav/promo_banner_right-first-category.jpg +0 -0
- data/app/assets/images/meganav/promo_banner_right-second-category.jpg +0 -0
- data/app/assets/images/meganav/promo_banner_right-third-category.jpg +0 -0
- data/app/assets/images/minus.svg +1 -0
- data/app/assets/images/noimage/big_category_banner.jpg +0 -0
- data/app/assets/images/noimage/big_category_banner_mobile.jpg +0 -0
- data/app/assets/images/noimage/big_category_banner_tablet_landscape.jpg +0 -0
- data/app/assets/images/noimage/big_category_banner_tablet_portrait.jpg +0 -0
- data/app/assets/images/noimage/category_banner.jpg +0 -0
- data/app/assets/images/noimage/category_banner_mobile.jpg +0 -0
- data/app/assets/images/noimage/category_banner_plp.jpg +0 -0
- data/app/assets/images/noimage/category_banner_tablet_landscape.jpg +0 -0
- data/app/assets/images/noimage/category_banner_tablet_portrait.jpg +0 -0
- data/app/assets/images/noimage/main_banner.jpg +0 -0
- data/app/assets/images/noimage/main_banner_mobile.jpg +0 -0
- data/app/assets/images/noimage/main_banner_tablet_landscape.jpg +0 -0
- data/app/assets/images/noimage/main_banner_tablet_portrait.jpg +0 -0
- data/app/assets/images/noimage/plp.png +0 -0
- data/app/assets/images/noimage/product_photo.jpg +0 -0
- data/app/assets/images/noimage/promo_banner.jpg +0 -0
- data/app/assets/images/noimage/promo_banner_megamenu.jpg +0 -0
- data/app/assets/images/noimage/promo_banner_mobile.jpg +0 -0
- data/app/assets/images/noimage/promo_banner_tablet_landscape.jpg +0 -0
- data/app/assets/images/noimage/promo_banner_tablet_portrait.jpg +0 -0
- data/app/assets/images/pagination-arrow-right.svg +12 -0
- data/app/assets/images/pagination-double-arrow-right.svg +15 -0
- data/app/assets/images/person.svg +1 -0
- data/app/assets/images/picture-zoom.svg +31 -0
- data/app/assets/images/plus.svg +1 -0
- data/app/assets/images/radio-button.svg +1 -0
- data/app/assets/images/search-no-results.svg +1 -0
- data/app/assets/images/search.svg +1 -0
- data/app/assets/images/spark-logo@3x.png +0 -0
- data/app/assets/images/twitter.svg +1 -0
- data/app/assets/images/vimeo.svg +1 -0
- data/app/assets/javascripts/spree/frontend/account.js +12 -0
- data/app/assets/javascripts/spree/frontend/api_tokens.js +4 -1
- data/app/assets/javascripts/spree/frontend/carousel-noconflict.js +3 -0
- data/app/assets/javascripts/spree/frontend/cart.js +61 -3
- data/app/assets/javascripts/spree/frontend/checkout/payment.js +24 -6
- data/app/assets/javascripts/spree/frontend/checkout/shipment.js +1 -1
- data/app/assets/javascripts/spree/frontend/checkout.js +42 -0
- data/app/assets/javascripts/spree/frontend/components-bootstrap/.gitkeep +0 -0
- data/app/assets/javascripts/spree/frontend/components-custom/.gitkeep +0 -0
- data/app/assets/javascripts/spree/frontend/coupon_manager.js +49 -1
- data/app/assets/javascripts/spree/frontend/viewport.js +7 -0
- data/app/assets/javascripts/spree/frontend/views/spree/home/product_carousels.js +31 -0
- data/app/assets/javascripts/spree/frontend/views/spree/layouts/spree_application.js +35 -0
- data/app/assets/javascripts/spree/frontend/views/spree/product/related.js +30 -0
- data/app/assets/javascripts/spree/frontend/views/spree/products/cart_form.js +280 -0
- data/app/assets/javascripts/spree/frontend/views/spree/products/description.js +8 -0
- data/app/assets/javascripts/spree/frontend/views/spree/products/index.js +37 -0
- data/app/assets/javascripts/spree/frontend/views/spree/products/modal_carousel.js +35 -0
- data/app/assets/javascripts/spree/frontend/views/spree/shared/carousel/single.js +139 -0
- data/app/assets/javascripts/spree/frontend/views/spree/shared/carousel/swipes.js +53 -0
- data/app/assets/javascripts/spree/frontend/views/spree/shared/carousel/thumbnails.js +137 -0
- data/app/assets/javascripts/spree/frontend/views/spree/shared/carousel.js +129 -0
- data/app/assets/javascripts/spree/frontend/views/spree/shared/delete_address_popup.js +27 -0
- data/app/assets/javascripts/spree/frontend/views/spree/shared/mobile_navigation.js +123 -0
- data/app/assets/javascripts/spree/frontend/views/spree/shared/nav_bar.js +16 -0
- data/app/assets/javascripts/spree/frontend/views/spree/shared/product_added_modal.js +28 -0
- data/app/assets/javascripts/spree/frontend/views/spree/shared/quantity_select.js +58 -0
- data/app/assets/javascripts/spree/frontend.js +9 -7
- data/app/assets/javascripts/spree/lazysizes.config.js +8 -0
- data/app/assets/stylesheets/spree/frontend/application.scss +54 -0
- data/app/assets/stylesheets/spree/frontend/bootstrap-patches.scss +11 -0
- data/app/assets/stylesheets/spree/frontend/components-bootstrap/.gitkeep +0 -0
- data/app/assets/stylesheets/spree/frontend/components-bootstrap/alert.scss +3 -0
- data/app/assets/stylesheets/spree/frontend/components-bootstrap/button.scss +8 -0
- data/app/assets/stylesheets/spree/frontend/components-bootstrap/carousel.scss +85 -0
- data/app/assets/stylesheets/spree/frontend/components-bootstrap/modal.scss +3 -0
- data/app/assets/stylesheets/spree/frontend/components-custom/.gitkeep +0 -0
- data/app/assets/stylesheets/spree/frontend/components-custom/headers.scss +28 -0
- data/app/assets/stylesheets/spree/frontend/components-custom/inputs.scss +265 -0
- data/app/assets/stylesheets/spree/frontend/fonts.scss +137 -0
- data/app/assets/stylesheets/spree/frontend/functions.scss +104 -0
- data/app/assets/stylesheets/spree/frontend/helpers/spree/frontend_helper.scss +23 -0
- data/app/assets/stylesheets/spree/frontend/margins.scss +53 -0
- data/app/assets/stylesheets/spree/frontend/mixins.scss +20 -0
- data/app/assets/stylesheets/spree/frontend/variables/.gitkeep +0 -0
- data/app/assets/stylesheets/spree/frontend/variables/bootstrap-overrides.scss +40 -0
- data/app/assets/stylesheets/spree/frontend/variables/helper-variables.scss +10 -0
- data/app/assets/stylesheets/spree/frontend/variables/variables.scss +20 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/.gitkeep +0 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/checkout/confirm.scss +255 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/checkout/edit.scss +505 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/checkout/payment.scss +98 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/checkout/registration.scss +26 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/errors/not_found.scss +3 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/home/index.scss +293 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/icon.scss +13 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/layouts/spree_application.scss +44 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/orders/edit.scss +467 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/orders/show.scss +273 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/products/cart_form.scss +250 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/products/index.scss +317 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/products/show.scss +165 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/_color_select.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/_images.scss +9 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/carousel/single.scss +142 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/carousel/thumbnails.scss +97 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/cart.scss +57 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/category_nav_bar.scss +86 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/delete_address_popup.scss +141 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/footer.scss +56 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/header.scss +82 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/login.scss +30 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/main_nav_bar.scss +103 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/mobile_navigation.scss +87 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/nav_bar.scss +78 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/no_product_available.scss +135 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/order_details.scss +37 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/product.scss +45 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/product_added_modal.scss +61 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/quantity_select.scss +55 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/shared/registration.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/taxons/show.scss +47 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/user_passwords/user_passwords.scss +12 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/user_sessions/new.scss +3 -0
- data/app/assets/stylesheets/spree/frontend/views/spree/users/show.scss +325 -0
- data/app/assets/stylesheets/spree/frontend.css +1 -1
- data/app/controllers/concerns/spree/checkout/address_book.rb +7 -9
- data/app/controllers/spree/addresses_controller.rb +5 -6
- data/app/controllers/spree/checkout_controller.rb +3 -1
- data/app/controllers/spree/home_controller.rb +1 -5
- data/app/controllers/spree/orders_controller.rb +3 -1
- data/app/controllers/spree/products_controller.rb +45 -15
- data/app/controllers/spree/store_controller.rb +14 -2
- data/app/controllers/spree/taxons_controller.rb +20 -5
- data/app/helpers/spree/addresses_helper.rb +11 -12
- data/app/helpers/spree/frontend_helper.rb +168 -14
- data/app/helpers/spree/navigation_helper.rb +34 -0
- data/app/helpers/spree/structured_data_helper.rb +3 -3
- data/app/helpers/spree/taxons_helper.rb +4 -0
- data/app/models/spree/frontend_configuration.rb +1 -0
- data/app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb +1 -1
- data/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb +1 -1
- data/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb +1 -1
- data/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb +1 -1
- data/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb +1 -1
- data/app/views/spree/address/_form.html.erb +24 -27
- data/app/views/spree/addresses/_form.html.erb +13 -8
- data/app/views/spree/addresses/edit.html.erb +11 -21
- data/app/views/spree/addresses/new.html.erb +11 -21
- data/app/views/spree/checkout/_address.html.erb +61 -54
- data/app/views/spree/checkout/_confirm.html.erb +112 -16
- data/app/views/spree/checkout/_credit_card.html.erb +9 -0
- data/app/views/spree/checkout/_delivery.html.erb +10 -86
- data/app/views/spree/checkout/_payment.html.erb +39 -64
- data/app/views/spree/checkout/_summary.html.erb +46 -73
- data/app/views/spree/checkout/edit.html.erb +22 -25
- data/app/views/spree/checkout/payment/_gateway.html.erb +14 -34
- data/app/views/spree/checkout/payment/_storecredit.html.erb +8 -8
- data/app/views/spree/checkout/registration.html.erb +30 -0
- data/app/views/spree/errors/not_found.html.erb +7 -0
- data/app/views/spree/home/index.html.erb +124 -10
- data/app/views/spree/layouts/checkout.html.erb +26 -0
- data/app/views/spree/layouts/spree_application.html.erb +10 -15
- data/app/views/spree/orders/_coupon_code.html.erb +24 -0
- data/app/views/spree/orders/_form.html.erb +25 -39
- data/app/views/spree/orders/_line_item.html.erb +19 -25
- data/app/views/spree/orders/_line_item_data.html.erb +31 -0
- data/app/views/spree/orders/edit.html.erb +50 -40
- data/app/views/spree/orders/show.html.erb +83 -17
- data/app/views/spree/products/_cart_form.html.erb +69 -73
- data/app/views/spree/products/_cart_form_availability_templates.html.erb +10 -0
- data/app/views/spree/products/_color_option_type.html.erb +36 -0
- data/app/views/spree/products/_description.html.erb +17 -0
- data/app/views/spree/products/_filter_and_sort_mobile_buttons.html.erb +16 -0
- data/app/views/spree/products/_filters_desktop.html.erb +58 -0
- data/app/views/spree/products/_filters_mobile.html.erb +62 -0
- data/app/views/spree/products/_gallery.html.erb +31 -0
- data/app/views/spree/products/_gallery_modal.html.erb +33 -0
- data/app/views/spree/products/_no_results.html.erb +14 -0
- data/app/views/spree/products/_no_results_with_filters.html.erb +13 -0
- data/app/views/spree/products/_option_type.html.erb +32 -0
- data/app/views/spree/products/_product.html.erb +5 -5
- data/app/views/spree/products/_promotions.html.erb +19 -12
- data/app/views/spree/products/_properties.html.erb +9 -20
- data/app/views/spree/products/_sort_desktop.html.erb +30 -0
- data/app/views/spree/products/_sort_mobile.html.erb +43 -0
- data/app/views/spree/products/_taxons.html.erb +1 -0
- data/app/views/spree/products/index.html.erb +40 -24
- data/app/views/spree/products/related.html.erb +8 -0
- data/app/views/spree/products/show.html.erb +39 -37
- data/app/views/spree/shared/_address.html.erb +0 -12
- data/app/views/spree/shared/_breadcrumbs.html.erb +23 -0
- data/app/views/spree/shared/_carousel_4_products.html.erb +99 -0
- data/app/views/spree/shared/_cart.html.erb +11 -0
- data/app/views/spree/shared/_checkout_header.html.erb +19 -0
- data/app/views/spree/shared/_color_select.html.erb +9 -0
- data/app/views/spree/shared/_copyright.html.erb +18 -0
- data/app/views/spree/shared/_delete_address_popup.html.erb +26 -0
- data/app/views/spree/shared/_error_messages.html.erb +2 -4
- data/app/views/spree/shared/_flashes.html.erb +9 -0
- data/app/views/spree/shared/_footer.html.erb +73 -0
- data/app/views/spree/shared/_head.html.erb +4 -9
- data/app/views/spree/shared/_header.html.erb +26 -13
- data/app/views/spree/shared/_link_to_account.html.erb +7 -0
- data/app/views/spree/shared/_link_to_cart.html.erb +2 -1
- data/app/views/spree/shared/_login.html.erb +34 -17
- data/app/views/spree/shared/_main_nav_bar.html.erb +41 -15
- data/app/views/spree/shared/_mobile_navigation.html.erb +68 -0
- data/app/views/spree/shared/_nav_bar.html.erb +52 -6
- data/app/views/spree/shared/_no_product_available.html.erb +23 -0
- data/app/views/spree/shared/_option_values.html.erb +24 -0
- data/app/views/spree/shared/_order_details.html.erb +5 -4
- data/app/views/spree/shared/_payment.html.erb +0 -3
- data/app/views/spree/shared/_payment_sources.html.erb +8 -0
- data/app/views/spree/shared/_product.html.erb +12 -0
- data/app/views/spree/shared/_product_added_modal.html.erb +66 -0
- data/app/views/spree/shared/_products.html.erb +22 -18
- data/app/views/spree/shared/_quantity_select.html.erb +6 -0
- data/app/views/spree/shared/_registration.html.erb +4 -0
- data/app/views/spree/shared/_search.html.erb +17 -20
- data/app/views/spree/shared/_translations.html.erb +9 -5
- data/app/views/spree/shared/_user_form.html.erb +12 -0
- data/app/views/spree/shared/carousel/_single.html.erb +83 -0
- data/app/views/spree/shared/carousel/_thumbnails.html.erb +68 -0
- data/app/views/spree/taxons/_header.html.erb +19 -0
- data/app/views/spree/taxons/_subcategories.html.erb +26 -0
- data/app/views/spree/taxons/product_carousel.html.erb +5 -0
- data/app/views/spree/taxons/show.html.erb +8 -20
- data/app/views/spree/users/_address.html.erb +25 -0
- data/app/views/spree/users/edit.html.erb +11 -0
- data/app/views/spree/users/show.html.erb +79 -0
- data/config/initializers/assets.rb +13 -1
- data/config/routes.rb +3 -0
- data/lib/generators/spree/frontend/copy_storefront/copy_storefront_generator.rb +24 -0
- data/lib/spree/frontend.rb +2 -0
- data/spree_frontend.gemspec +7 -11
- data/vendor/assets/javascripts/lazysizes.min.js +2 -0
- metadata +265 -25
- data/README.md +0 -50
- data/app/assets/javascripts/spree/frontend/product.js +0 -143
- data/app/assets/stylesheets/spree/frontend/_variables.scss +0 -4
- data/app/assets/stylesheets/spree/frontend/frontend_bootstrap.css.scss +0 -94
- data/app/views/spree/shared/_filters.html.erb +0 -48
- data/app/views/spree/shared/_login_bar.html.erb +0 -12
- data/app/views/spree/taxons/_taxon.html.erb +0 -4
- data/lib/generators/spree/frontend/copy_views/copy_views_generator.rb +0 -15
@@ -0,0 +1,37 @@
|
|
1
|
+
Spree.ready(function($) {
|
2
|
+
$('#sort-by-overlay-show-button').click(function() { $('#sort-by-overlay').show() })
|
3
|
+
$('#sort-by-overlay-hide-button').click(function() { $('#sort-by-overlay').hide() })
|
4
|
+
|
5
|
+
$('#filter-by-overlay-show-button').click(function() { $('#filter-by-overlay').show() })
|
6
|
+
$('#filter-by-overlay-hide-button').click(function() { $('#filter-by-overlay').hide() })
|
7
|
+
|
8
|
+
function closeNoProductModal() {
|
9
|
+
$('#no-product-available').removeClass('shown')
|
10
|
+
$('#overlay').removeClass('shown')
|
11
|
+
}
|
12
|
+
|
13
|
+
$('#no-product-available-close-button').click(closeNoProductModal)
|
14
|
+
$('#no-product-available-hide-button').click(closeNoProductModal)
|
15
|
+
|
16
|
+
$('.plp-overlay-card-item').click(function() {
|
17
|
+
$(this).toggleClass('plp-overlay-card-item--selected')
|
18
|
+
})
|
19
|
+
|
20
|
+
$('.color-select').click(function() {
|
21
|
+
var allOptionsBorders = $('.color-select-border')
|
22
|
+
var borderElement = $(this).find('.color-select-border')
|
23
|
+
|
24
|
+
allOptionsBorders.each(function() {
|
25
|
+
$(this).removeClass('color-select-border--selected')
|
26
|
+
})
|
27
|
+
borderElement.addClass('color-select-border--selected')
|
28
|
+
})
|
29
|
+
|
30
|
+
$('.plp-overlay-ul-li').click(function() {
|
31
|
+
$('.plp-overlay-ul-li--active').removeClass('plp-overlay-ul-li--active')
|
32
|
+
.addClass('plp-overlay-ul-li')
|
33
|
+
|
34
|
+
$(this).removeClass('plp-overlay-ul-li')
|
35
|
+
.addClass('plp-overlay-ul-li--active')
|
36
|
+
})
|
37
|
+
})
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Spree.ready(function($) {
|
2
|
+
var $modalCarousel = $('#productModalThumbnailsCarousel')
|
3
|
+
if ($modalCarousel.length) {
|
4
|
+
ThumbnailsCarousel($, $modalCarousel)
|
5
|
+
}
|
6
|
+
|
7
|
+
var activeSingleImageIndex = function(sourceWrappingClass) {
|
8
|
+
var $activeSingleImage = $('.' + sourceWrappingClass + ' .product-details-single [data-variant-id].active')
|
9
|
+
return $activeSingleImage.index()
|
10
|
+
}
|
11
|
+
|
12
|
+
var selectModalThumbnail = function(imgIndex) {
|
13
|
+
var $modalThumbnails = $('#productModalThumbnailsCarousel > div > div.carousel-item.product-thumbnails-carousel-item.active > div > div')
|
14
|
+
var $modalThumbnailsChildren = $modalThumbnails.children('[data-variant-id]')
|
15
|
+
if ($modalThumbnailsChildren.length > 0) {
|
16
|
+
$($modalThumbnailsChildren.get(imgIndex).getElementsByTagName('img')[0]).addClass('selected')
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
var activateModalSingleImg = function(imgIndex, targetWrappingClass) {
|
21
|
+
$('.' + targetWrappingClass + ' .product-details-single [data-variant-id].active').removeClass('active')
|
22
|
+
var $modalActiveSingleImage = $($('.' + targetWrappingClass + ' .product-details-single [data-variant-id]').parent().children().get(imgIndex))
|
23
|
+
$modalActiveSingleImage.addClass('active')
|
24
|
+
}
|
25
|
+
|
26
|
+
$('#picturesModal').on('show.bs.modal', function() {
|
27
|
+
var rowActiveSingleImageIndex = activeSingleImageIndex('row')
|
28
|
+
selectModalThumbnail(rowActiveSingleImageIndex - 1)
|
29
|
+
activateModalSingleImg(rowActiveSingleImageIndex, 'modal')
|
30
|
+
})
|
31
|
+
|
32
|
+
$('#picturesModal').on('hide.bs.modal', function() {
|
33
|
+
activateModalSingleImg(activeSingleImageIndex('modal'), 'row')
|
34
|
+
})
|
35
|
+
})
|
@@ -0,0 +1,139 @@
|
|
1
|
+
Spree.ready(function($) {
|
2
|
+
// Adjust single carousel based on picked variant.
|
3
|
+
|
4
|
+
var productDetailsPage = $('#product-details')
|
5
|
+
|
6
|
+
if (productDetailsPage.length) {
|
7
|
+
var variantIdAttributeName = 'data-variant-id'
|
8
|
+
var carouselItemsContainerSelector = '.carousel-inner'
|
9
|
+
var carouselItemSelector = '[data-variant-id]'
|
10
|
+
var isMasterVariantAttributeName = 'data-variant-is-master'
|
11
|
+
var enabledCarouselItemClass = 'carousel-item'
|
12
|
+
var activeCarouselItemClass = 'active'
|
13
|
+
var getCarouselsWithVariantChangeTriggerSelector = function(triggerId) {
|
14
|
+
return (
|
15
|
+
'.product-carousel[data-variant-change-trigger-identifier=' +
|
16
|
+
triggerId +
|
17
|
+
']'
|
18
|
+
)
|
19
|
+
}
|
20
|
+
var carouselEmptyClass = 'product-carousel--empty'
|
21
|
+
var carouselIndicatorsContainerSelector = '.product-carousel-indicators'
|
22
|
+
var carouselIndicatorSelector = '.product-carousel-indicators-indicator'
|
23
|
+
var enabledCarouselIndicatorClass =
|
24
|
+
'product-carousel-indicators-indicator--visible'
|
25
|
+
var activeCarouselIndicatorClass = 'active'
|
26
|
+
var carouselIndicatorSlidetoAttributeName = 'data-slide-to'
|
27
|
+
|
28
|
+
Spree.showSingleCarouselVariantImages = function($carousel, variantId) {
|
29
|
+
$carousel.carouselBootstrap4('dispose')
|
30
|
+
var oldActiveQualifiedIndex = null
|
31
|
+
var $firstQualifyingSlide = null
|
32
|
+
var qualifiedSlides = 0
|
33
|
+
var $carouselIndicatorsContainer = $carousel.find(
|
34
|
+
carouselIndicatorsContainerSelector
|
35
|
+
)
|
36
|
+
var $carouselItemsContainer = $carousel.find(carouselItemsContainerSelector)
|
37
|
+
var $carouselIndicators = $carousel.find(carouselIndicatorSelector)
|
38
|
+
$carousel
|
39
|
+
.find(carouselItemSelector)
|
40
|
+
.each(function(itemIndex, slideElement) {
|
41
|
+
var $slide = $(slideElement)
|
42
|
+
var qualifies =
|
43
|
+
$slide.attr(variantIdAttributeName) === variantId ||
|
44
|
+
$slide.attr(isMasterVariantAttributeName) === 'true'
|
45
|
+
var $slideIndicator = $carouselIndicators.eq(itemIndex)
|
46
|
+
|
47
|
+
if (qualifies) {
|
48
|
+
qualifiedSlides += 1
|
49
|
+
// Switch indicator slide to index based on picked variant.
|
50
|
+
$slideIndicator.attr(
|
51
|
+
carouselIndicatorSlidetoAttributeName,
|
52
|
+
qualifiedSlides - 1
|
53
|
+
)
|
54
|
+
} else {
|
55
|
+
$slideIndicator.detach()
|
56
|
+
$carouselIndicatorsContainer.append($slideIndicator)
|
57
|
+
|
58
|
+
$slide.detach()
|
59
|
+
$carouselItemsContainer.append($slide)
|
60
|
+
}
|
61
|
+
|
62
|
+
// Switch item visibility in the carousel based on picked variant.
|
63
|
+
$slide.toggleClass(enabledCarouselItemClass, qualifies)
|
64
|
+
// Switch indicator visibility in the carousel based on picked variant.
|
65
|
+
$slideIndicator.toggleClass(enabledCarouselIndicatorClass, qualifies)
|
66
|
+
|
67
|
+
// Safari doesn't correctly calculate width of $slideIndicator after page loading.
|
68
|
+
// w-100 class makes Safari work as expected. For visible images we don't need this class anymore.
|
69
|
+
$slideIndicator.find('img').toggleClass('w-100', !qualifies)
|
70
|
+
|
71
|
+
$slideIndicator.removeClass(activeCarouselIndicatorClass)
|
72
|
+
|
73
|
+
// Select an active image included in the new list of images for selected variant.
|
74
|
+
if (qualifies) {
|
75
|
+
if ($slide.hasClass(activeCarouselItemClass)) {
|
76
|
+
// Use the current active slide if it's still active after changing the variant.
|
77
|
+
oldActiveQualifiedIndex = qualifiedSlides - 1
|
78
|
+
}
|
79
|
+
|
80
|
+
if ($firstQualifyingSlide === null) {
|
81
|
+
$firstQualifyingSlide = $slide
|
82
|
+
}
|
83
|
+
} else {
|
84
|
+
$slide.removeClass(activeCarouselItemClass)
|
85
|
+
}
|
86
|
+
})
|
87
|
+
|
88
|
+
if (qualifiedSlides === 0) {
|
89
|
+
// There are no images to show after picking a variant. Disable the carousel.
|
90
|
+
$carousel.addClass(carouselEmptyClass)
|
91
|
+
} else {
|
92
|
+
$carousel.removeClass(carouselEmptyClass)
|
93
|
+
|
94
|
+
if (oldActiveQualifiedIndex === null) {
|
95
|
+
// Pick the first qualifying slide if the old active slide does not qualify.
|
96
|
+
$firstQualifyingSlide.addClass(activeCarouselItemClass)
|
97
|
+
// Activate first indicator.
|
98
|
+
$carouselIndicators
|
99
|
+
.filter('.' + enabledCarouselIndicatorClass)
|
100
|
+
.eq(0)
|
101
|
+
.addClass(activeCarouselIndicatorClass)
|
102
|
+
} else {
|
103
|
+
// Activate proper indicator based on active slide.
|
104
|
+
$carouselIndicators
|
105
|
+
.filter('.' + enabledCarouselIndicatorClass)
|
106
|
+
.eq(oldActiveQualifiedIndex)
|
107
|
+
.addClass(activeCarouselIndicatorClass)
|
108
|
+
}
|
109
|
+
|
110
|
+
$carousel.carouselBootstrap4()
|
111
|
+
|
112
|
+
setTimeout(function() {
|
113
|
+
// Add delay to allow other carousels to adjust their slides after a variant is picked before syncing slides.
|
114
|
+
var enabledSlides = $carousel.find('.' + enabledCarouselItemClass)
|
115
|
+
var toSlideIndex = enabledSlides.index(
|
116
|
+
enabledSlides.find('.' + activeCarouselItemClass)
|
117
|
+
)
|
118
|
+
Spree.goToCarouselSlide($carousel, toSlideIndex, true, true)
|
119
|
+
Spree.addSwipeEventListeners($carousel)
|
120
|
+
|
121
|
+
$carousel.on('slide.bs.carousel', function(event) {
|
122
|
+
$carousel.trigger('single_carousel:slide', event.to)
|
123
|
+
})
|
124
|
+
})
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
productDetailsPage.on('variant_id_change', function (options) {
|
129
|
+
var triggerId = options.triggerId
|
130
|
+
var variantId = options.variantId
|
131
|
+
$(getCarouselsWithVariantChangeTriggerSelector(triggerId)).each(function (
|
132
|
+
_carouselElementIndex,
|
133
|
+
carouselElement
|
134
|
+
) {
|
135
|
+
Spree.showSingleCarouselVariantImages($(carouselElement), variantId)
|
136
|
+
})
|
137
|
+
})
|
138
|
+
}
|
139
|
+
})
|
@@ -0,0 +1,53 @@
|
|
1
|
+
Spree.ready(function($) {
|
2
|
+
Spree.addSwipeEventListeners = function($carousel) {
|
3
|
+
var touchStartX = 0
|
4
|
+
var touchStartY = 0
|
5
|
+
var touchCurrentX = 0
|
6
|
+
var touchCurrentY = 0
|
7
|
+
|
8
|
+
var SWIPE_THRESHOLD = 40
|
9
|
+
|
10
|
+
$carousel.on('touchstart.bs.carousel', function(event) {
|
11
|
+
touchStartX = event.touches[0].clientX
|
12
|
+
touchStartY = event.touches[0].clientY
|
13
|
+
})
|
14
|
+
|
15
|
+
$carousel.on('touchmove.bs.carousel', function(event) {
|
16
|
+
touchCurrentX = event.touches[0].clientX
|
17
|
+
touchCurrentY = event.touches[0].clientY
|
18
|
+
})
|
19
|
+
|
20
|
+
$carousel.on('touchend.bs.carousel', function(_event) {
|
21
|
+
var carouselInstance = $carousel.data('bs.carousel')
|
22
|
+
|
23
|
+
var touchDeltaX = touchCurrentX - touchStartX
|
24
|
+
var touchDeltaY = touchCurrentY - touchStartY
|
25
|
+
|
26
|
+
var absDeltaX = Math.abs(touchDeltaX)
|
27
|
+
var absDeltaY = Math.abs(touchDeltaY)
|
28
|
+
|
29
|
+
if (touchCurrentX > 0 && absDeltaX > SWIPE_THRESHOLD && absDeltaX > absDeltaY) {
|
30
|
+
var direction = absDeltaX / touchDeltaX
|
31
|
+
|
32
|
+
if (direction > 0) {
|
33
|
+
carouselInstance.prev()
|
34
|
+
}
|
35
|
+
|
36
|
+
if (direction < 0) {
|
37
|
+
carouselInstance.next()
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
touchCurrentX = 0
|
42
|
+
touchStartX = 0
|
43
|
+
touchCurrentY = 0
|
44
|
+
touchStartY = 0
|
45
|
+
|
46
|
+
carouselInstance.touchDeltaX = 0
|
47
|
+
})
|
48
|
+
}
|
49
|
+
|
50
|
+
$('.carousel').each(function(_index, carousel) {
|
51
|
+
Spree.addSwipeEventListeners($(carousel))
|
52
|
+
})
|
53
|
+
})
|
@@ -0,0 +1,137 @@
|
|
1
|
+
function ThumbnailsCarousel($, $carousel) {
|
2
|
+
var VISIBLE_IMAGE_SELECTOR = '.product-thumbnails-carousel-item-single--visible img'
|
3
|
+
var SELECTED_IMAGE_CLASS = 'selected'
|
4
|
+
var self = this
|
5
|
+
|
6
|
+
this.constructor = function() {
|
7
|
+
this.bindEventHandlers()
|
8
|
+
}
|
9
|
+
|
10
|
+
this.bindEventHandlers = function() {
|
11
|
+
$carousel.on('click', 'img', this.handleImageClick)
|
12
|
+
$carousel.on('thumbnails:ready', this.handleThumbnailsReady)
|
13
|
+
|
14
|
+
$('body').on('single_carousel:slide', this.handleSingleCarouselSlide)
|
15
|
+
}
|
16
|
+
|
17
|
+
this.handleImageClick = function(event) {
|
18
|
+
self.selectImage($(event.target))
|
19
|
+
}
|
20
|
+
|
21
|
+
this.handleThumbnailsReady = function(_event) {
|
22
|
+
var $image = $carousel.find(VISIBLE_IMAGE_SELECTOR).eq(0)
|
23
|
+
|
24
|
+
self.selectImage($image)
|
25
|
+
}
|
26
|
+
|
27
|
+
this.handleSingleCarouselSlide = function(_event, imageIndex) {
|
28
|
+
var $image = $carousel.find('[data-product-carousel-to-slide=' + imageIndex + '] img')
|
29
|
+
|
30
|
+
self.selectImage($image)
|
31
|
+
}
|
32
|
+
|
33
|
+
this.selectImage = function($image) {
|
34
|
+
this.unselectImages()
|
35
|
+
|
36
|
+
$image.addClass(SELECTED_IMAGE_CLASS)
|
37
|
+
}
|
38
|
+
|
39
|
+
this.unselectImages = function() {
|
40
|
+
$carousel.find('img').removeClass(SELECTED_IMAGE_CLASS)
|
41
|
+
}
|
42
|
+
|
43
|
+
this.constructor()
|
44
|
+
}
|
45
|
+
|
46
|
+
Spree.ready(function($) {
|
47
|
+
// Adjust thumbnails carousel based on picked variant.
|
48
|
+
|
49
|
+
if ($('#product-details').length) {
|
50
|
+
|
51
|
+
var variantIdAttributeName = 'data-variant-id'
|
52
|
+
var carouselItemSelector = '[data-variant-id]'
|
53
|
+
var isMasterVariantAttributeName = 'data-variant-is-master'
|
54
|
+
var enabledCarouselItemClass = 'carousel-item'
|
55
|
+
var activeCarouselItemClass = 'active'
|
56
|
+
var getCarouselsWithVariantChangeTriggerSelector = function(triggerId) {
|
57
|
+
return (
|
58
|
+
'.product-thumbnails-carousel[data-variant-change-trigger-identifier="' +
|
59
|
+
triggerId +
|
60
|
+
'"]'
|
61
|
+
)
|
62
|
+
}
|
63
|
+
|
64
|
+
Spree.showThumbnailsCarouselVariantImages = function($carousel, variantId) {
|
65
|
+
var carouselSlideSelector = '.product-thumbnails-carousel-item'
|
66
|
+
var carouselSlideContainerSelector =
|
67
|
+
'.product-thumbnails-carousel-item-content'
|
68
|
+
var enabledCarouselSingleClass =
|
69
|
+
'product-thumbnails-carousel-item-single--visible'
|
70
|
+
var carouselToSlideAttributeName = 'data-product-carousel-to-slide'
|
71
|
+
var carouselPerPageAttributeName = 'data-product-carousel-per-page'
|
72
|
+
var carouselEmptyClass = 'product-thumbnails-carousel--empty'
|
73
|
+
|
74
|
+
$carousel.carouselBootstrap4('dispose')
|
75
|
+
var qualifiedSlides = 0
|
76
|
+
var perPage = parseInt($carousel.attr(carouselPerPageAttributeName)) || 1
|
77
|
+
var $slides = $carousel.find(carouselSlideSelector)
|
78
|
+
|
79
|
+
$carousel
|
80
|
+
.find(carouselItemSelector)
|
81
|
+
.each(function(_itemIndex, slideElement) {
|
82
|
+
// Switch item visibility in the carousel based on picked variant.
|
83
|
+
|
84
|
+
var targetSlideIndex
|
85
|
+
var $slide = $(slideElement)
|
86
|
+
var qualifies =
|
87
|
+
$slide.attr(variantIdAttributeName) === variantId ||
|
88
|
+
$slide.attr(isMasterVariantAttributeName) === 'true'
|
89
|
+
|
90
|
+
if (qualifies) {
|
91
|
+
qualifiedSlides += 1
|
92
|
+
$slide.attr(carouselToSlideAttributeName, qualifiedSlides - 1)
|
93
|
+
}
|
94
|
+
|
95
|
+
targetSlideIndex = Math.max(0, Math.ceil(qualifiedSlides / perPage) - 1)
|
96
|
+
$slide.detach()
|
97
|
+
$slides
|
98
|
+
.eq(targetSlideIndex)
|
99
|
+
.find(carouselSlideContainerSelector)
|
100
|
+
.append($slide)
|
101
|
+
$slide.toggleClass(enabledCarouselSingleClass, qualifies)
|
102
|
+
})
|
103
|
+
var enabledSlidesCount = Math.ceil(qualifiedSlides / perPage)
|
104
|
+
$carousel
|
105
|
+
.find(carouselSlideSelector)
|
106
|
+
.each(function(slideIndex, slideElement) {
|
107
|
+
var $slide = $(slideElement)
|
108
|
+
$slide.toggleClass(
|
109
|
+
enabledCarouselItemClass,
|
110
|
+
slideIndex < enabledSlidesCount
|
111
|
+
)
|
112
|
+
$slide.toggleClass(activeCarouselItemClass, slideIndex === 0)
|
113
|
+
})
|
114
|
+
|
115
|
+
// If there are no images to show after picking a variant, disable the carousel.
|
116
|
+
$carousel.toggleClass(carouselEmptyClass, enabledSlidesCount === 0)
|
117
|
+
|
118
|
+
$carousel.carouselBootstrap4()
|
119
|
+
$carousel.trigger('thumbnails:ready')
|
120
|
+
}
|
121
|
+
|
122
|
+
$('#product-details').on('variant_id_change', function(options) {
|
123
|
+
var triggerId = options.triggerId
|
124
|
+
var variantId = options.variantId
|
125
|
+
$(getCarouselsWithVariantChangeTriggerSelector(triggerId)).each(function(
|
126
|
+
_carouselElementIndex,
|
127
|
+
carouselElement
|
128
|
+
) {
|
129
|
+
Spree.showThumbnailsCarouselVariantImages($(carouselElement), variantId)
|
130
|
+
})
|
131
|
+
})
|
132
|
+
|
133
|
+
var $carousel = $('#productThumbnailsCarousel')
|
134
|
+
|
135
|
+
ThumbnailsCarousel($, $carousel)
|
136
|
+
}
|
137
|
+
})
|
@@ -0,0 +1,129 @@
|
|
1
|
+
Spree.ready(function($) {
|
2
|
+
// Synchronize carousels.
|
3
|
+
|
4
|
+
var carouselGroupIdentifierAttributeName =
|
5
|
+
'data-product-carousel-group-identifier'
|
6
|
+
var carouselPerPageAttributeName = 'data-product-carousel-per-page'
|
7
|
+
var carouselIsSlaveAttributeName = 'data-product-carousel-is-slave'
|
8
|
+
var carouselToSlideAttributeName = 'data-product-carousel-to-slide'
|
9
|
+
var groupedCarousels = []
|
10
|
+
Spree.goToCarouselSlide = function(
|
11
|
+
$invokedCarousel,
|
12
|
+
slideIndex,
|
13
|
+
slideIndexLocalToSlide,
|
14
|
+
respectIsSlave
|
15
|
+
) {
|
16
|
+
var elementGroupIdentifier = $invokedCarousel.attr(
|
17
|
+
carouselGroupIdentifierAttributeName
|
18
|
+
)
|
19
|
+
|
20
|
+
var carouselGroupDescription = groupedCarousels.find(function(
|
21
|
+
candidateCarouselGroupDescription
|
22
|
+
) {
|
23
|
+
return (
|
24
|
+
candidateCarouselGroupDescription.identifier === elementGroupIdentifier
|
25
|
+
)
|
26
|
+
})
|
27
|
+
|
28
|
+
carouselGroupDescription.elements.forEach(function(element) {
|
29
|
+
var $candidateCarousel = element.$carousel
|
30
|
+
if (
|
31
|
+
(!respectIsSlave || element.isSlave) &&
|
32
|
+
!$candidateCarousel.is($invokedCarousel)
|
33
|
+
) {
|
34
|
+
setTimeout(function() {
|
35
|
+
// setTimeout is required due to "Returns to the caller before the target item has been shown" issue.
|
36
|
+
// Details: https://getbootstrap.com/docs/4.0/components/carousel/#carouselnumber
|
37
|
+
if (slideIndexLocalToSlide) {
|
38
|
+
var invokedPerPage = carouselGroupDescription.elements.find(
|
39
|
+
function(element) {
|
40
|
+
var $candidateCarousel = element.$carousel
|
41
|
+
return $candidateCarousel.is($invokedCarousel)
|
42
|
+
}
|
43
|
+
).perPage
|
44
|
+
|
45
|
+
$candidateCarousel.carouselBootstrap4(
|
46
|
+
Math.floor((slideIndex * invokedPerPage) / element.perPage)
|
47
|
+
)
|
48
|
+
} else {
|
49
|
+
$candidateCarousel.carouselBootstrap4(
|
50
|
+
Math.floor(slideIndex / element.perPage)
|
51
|
+
)
|
52
|
+
}
|
53
|
+
})
|
54
|
+
}
|
55
|
+
})
|
56
|
+
}
|
57
|
+
|
58
|
+
$('[' + carouselGroupIdentifierAttributeName + ']').each(function(
|
59
|
+
_carouselIndex,
|
60
|
+
carouselElement
|
61
|
+
) {
|
62
|
+
var $carousel = $(carouselElement)
|
63
|
+
|
64
|
+
$carousel.carouselBootstrap4()
|
65
|
+
|
66
|
+
var elementGroupIdentifier = $carousel.attr(
|
67
|
+
carouselGroupIdentifierAttributeName
|
68
|
+
)
|
69
|
+
var perPage = parseInt($carousel.attr(carouselPerPageAttributeName)) || 1
|
70
|
+
var isSlave = !!$carousel.attr(carouselIsSlaveAttributeName)
|
71
|
+
|
72
|
+
var carouselGroupDescription = groupedCarousels.find(function(
|
73
|
+
candidateCarouselGroupDescription
|
74
|
+
) {
|
75
|
+
return (
|
76
|
+
candidateCarouselGroupDescription.identifier === elementGroupIdentifier
|
77
|
+
)
|
78
|
+
})
|
79
|
+
if (carouselGroupDescription) {
|
80
|
+
carouselGroupDescription.elements.push({
|
81
|
+
$carousel: $carousel,
|
82
|
+
perPage: perPage,
|
83
|
+
isSlave: isSlave
|
84
|
+
})
|
85
|
+
} else {
|
86
|
+
groupedCarousels.push({
|
87
|
+
identifier: elementGroupIdentifier,
|
88
|
+
elements: [
|
89
|
+
{
|
90
|
+
$carousel: $carousel,
|
91
|
+
perPage: perPage,
|
92
|
+
isSlave: isSlave
|
93
|
+
}
|
94
|
+
]
|
95
|
+
})
|
96
|
+
}
|
97
|
+
})
|
98
|
+
|
99
|
+
$('body').on('click', '[' + carouselToSlideAttributeName + ']', function(
|
100
|
+
event
|
101
|
+
) {
|
102
|
+
var $invokedCarousel = $(
|
103
|
+
event.currentTarget.closest(
|
104
|
+
'[' + carouselGroupIdentifierAttributeName + ']'
|
105
|
+
)
|
106
|
+
)
|
107
|
+
|
108
|
+
var toSlideOnPageIndex = parseInt(
|
109
|
+
$(event.currentTarget).attr(carouselToSlideAttributeName)
|
110
|
+
)
|
111
|
+
|
112
|
+
Spree.goToCarouselSlide($invokedCarousel, toSlideOnPageIndex, false, false)
|
113
|
+
})
|
114
|
+
|
115
|
+
$('body').on(
|
116
|
+
'slide.bs.carousel',
|
117
|
+
'[' + carouselGroupIdentifierAttributeName + ']',
|
118
|
+
function(event) {
|
119
|
+
var invokedCarouselElement = event.relatedTarget.closest(
|
120
|
+
'[' + carouselGroupIdentifierAttributeName + ']'
|
121
|
+
)
|
122
|
+
var $invokedCarousel = $(invokedCarouselElement)
|
123
|
+
var toSlideIndex = event.to
|
124
|
+
Spree.goToCarouselSlide($invokedCarousel, toSlideIndex, true, true)
|
125
|
+
}
|
126
|
+
)
|
127
|
+
|
128
|
+
$('.carousel').carouselBootstrap4()
|
129
|
+
})
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Spree.ready(function($) {
|
2
|
+
var deleteAddressLinks = document.querySelectorAll('.js-delete-address-link');
|
3
|
+
if (deleteAddressLinks.length > 0) {
|
4
|
+
deleteAddressLinks.forEach(function(deleteLink) {
|
5
|
+
deleteLink.addEventListener('click', function(e) {
|
6
|
+
document.querySelector('#overlay').classList.add('shown');
|
7
|
+
document.querySelector('#delete-address-popup').classList.add('shown');
|
8
|
+
document.querySelector('#delete-address-popup-confirm').href = e.currentTarget.dataset.address;
|
9
|
+
}, false)
|
10
|
+
})
|
11
|
+
}
|
12
|
+
|
13
|
+
document.querySelector('#overlay').addEventListener('click', function () {
|
14
|
+
var addressActionElement = document.querySelector('#delete-address-popup');
|
15
|
+
if (addressActionElement) addressActionElement.classList.remove('shown');
|
16
|
+
}, false);
|
17
|
+
|
18
|
+
var popupCloseButtons = document.querySelectorAll('.js-delete-address-popup-close-button')
|
19
|
+
if (popupCloseButtons.length > 0) {
|
20
|
+
popupCloseButtons.forEach(function(closeButton) {
|
21
|
+
closeButton.addEventListener('click', function(e) {
|
22
|
+
document.querySelector('#overlay').classList.remove('shown');
|
23
|
+
document.querySelector('#delete-address-popup').classList.remove('shown');
|
24
|
+
})
|
25
|
+
})
|
26
|
+
}
|
27
|
+
})
|
@@ -0,0 +1,123 @@
|
|
1
|
+
Spree.ready(function($) {
|
2
|
+
|
3
|
+
function MobileNavigationManager() {
|
4
|
+
this.mobileNavigation = document.querySelector('.mobile-navigation');
|
5
|
+
|
6
|
+
if (this.mobileNavigation !== null) {
|
7
|
+
this.burgerButton = document.querySelector('.navbar-toggler');
|
8
|
+
this.closeButton = document.querySelector('#mobile-navigation-close-button');
|
9
|
+
this.categoryLinks = document.querySelectorAll('.mobile-navigation-category-link');
|
10
|
+
this.backButton = document.querySelector('#mobile-navigation-back-button');
|
11
|
+
this.overlay = document.querySelector('#overlay');
|
12
|
+
this.navigationOpen = false;
|
13
|
+
this.openedCategories = ['main'];
|
14
|
+
|
15
|
+
this.onResize = this.onResize.bind(this);
|
16
|
+
this.onCategoryClick = this.onCategoryClick.bind(this);
|
17
|
+
this.onTouchMove = this.onTouchMove.bind(this);
|
18
|
+
this.onBurgerClick = this.onBurgerClick.bind(this);
|
19
|
+
this.onCloseClick = this.onCloseClick.bind(this);
|
20
|
+
this.onBackClick = this.onBackClick.bind(this);
|
21
|
+
this.closeAllCategories = this.closeAllCategories.bind(this);
|
22
|
+
|
23
|
+
window.addEventListener('resize', this.onResize);
|
24
|
+
window.addEventListener('turbolinks:request-start', this.onCloseClick);
|
25
|
+
|
26
|
+
this.mobileNavigation.addEventListener('touchmove', this.onTouchMove, false);
|
27
|
+
this.burgerButton.addEventListener('click', this.onBurgerClick, false);
|
28
|
+
this.closeButton.addEventListener('click', this.onCloseClick, false);
|
29
|
+
this.backButton.addEventListener('click', this.onBackClick, false);
|
30
|
+
|
31
|
+
this.categoryLinks.forEach(function(link) {
|
32
|
+
link.addEventListener('click', this.onCategoryClick)
|
33
|
+
}.bind(this))
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
MobileNavigationManager.prototype.onResize = function(e) {
|
38
|
+
var currentWidth = e.currentTarget.innerWidth;
|
39
|
+
if (this.navigationOpen && currentWidth >= 1200) this.close();
|
40
|
+
}
|
41
|
+
|
42
|
+
MobileNavigationManager.prototype.onCategoryClick = function(e) {
|
43
|
+
var category = e.currentTarget.dataset.category;
|
44
|
+
e.preventDefault();
|
45
|
+
this.openCategory(category);
|
46
|
+
}
|
47
|
+
|
48
|
+
MobileNavigationManager.prototype.onTouchMove = function(e) {
|
49
|
+
e.preventDefault();
|
50
|
+
};
|
51
|
+
|
52
|
+
MobileNavigationManager.prototype.onBurgerClick = function() {
|
53
|
+
if (this.navigationOpen) {
|
54
|
+
this.close();
|
55
|
+
} else {
|
56
|
+
this.open();
|
57
|
+
}
|
58
|
+
};
|
59
|
+
|
60
|
+
MobileNavigationManager.prototype.onCloseClick = function() {
|
61
|
+
this.close();
|
62
|
+
setTimeout(this.closeAllCategories, 500);
|
63
|
+
};
|
64
|
+
|
65
|
+
MobileNavigationManager.prototype.onBackClick = function() {
|
66
|
+
this.closeCurrentCategory();
|
67
|
+
};
|
68
|
+
|
69
|
+
MobileNavigationManager.prototype.open = function() {
|
70
|
+
this.navigationOpen = true;
|
71
|
+
this.mobileNavigation.classList.add('shown');
|
72
|
+
document.body.style.overflow = "hidden";
|
73
|
+
this.overlay.classList.add('shown');
|
74
|
+
}
|
75
|
+
|
76
|
+
MobileNavigationManager.prototype.close = function() {
|
77
|
+
this.navigationOpen = false;
|
78
|
+
this.mobileNavigation.classList.remove('shown');
|
79
|
+
document.body.style.overflow = "";
|
80
|
+
this.overlay.classList.remove('shown');
|
81
|
+
}
|
82
|
+
|
83
|
+
MobileNavigationManager.prototype.openCategory = function(category) {
|
84
|
+
this.openedCategories.push(category);
|
85
|
+
var subList = document.querySelector('ul[data-category=' + category + ']');
|
86
|
+
if (subList) {
|
87
|
+
subList.classList.add('shown');
|
88
|
+
this.backButton.classList.add('shown');
|
89
|
+
}
|
90
|
+
return false;
|
91
|
+
}
|
92
|
+
|
93
|
+
MobileNavigationManager.prototype.closeCurrentCategory = function() {
|
94
|
+
var category = this.openedCategories.pop();
|
95
|
+
var subList = document.querySelector('ul[data-category=' + category + ']');
|
96
|
+
if (subList) {
|
97
|
+
subList.classList.remove('shown');
|
98
|
+
}
|
99
|
+
if (this.openedCategories[this.openedCategories.length - 1] === 'main') {
|
100
|
+
this.backButton.classList.remove('shown');
|
101
|
+
}
|
102
|
+
return false;
|
103
|
+
}
|
104
|
+
|
105
|
+
MobileNavigationManager.prototype.closeCategory = function(category) {
|
106
|
+
var subList = document.querySelector('ul[data-category=' + category + ']');
|
107
|
+
subList.style.transition = 'none';
|
108
|
+
subList.classList.remove('shown');
|
109
|
+
setTimeout(function(){ subList.style.transition = ''; }, 500);
|
110
|
+
}
|
111
|
+
|
112
|
+
MobileNavigationManager.prototype.closeAllCategories = function() {
|
113
|
+
var openedCategories = this.openedCategories;
|
114
|
+
if (openedCategories.length === 1) return false;
|
115
|
+
for (var i = openedCategories.length - 1; i > 0; i--) {
|
116
|
+
var category = openedCategories.pop();
|
117
|
+
this.closeCategory(category);
|
118
|
+
}
|
119
|
+
this.backButton.classList.remove('shown');
|
120
|
+
}
|
121
|
+
|
122
|
+
new MobileNavigationManager();
|
123
|
+
})
|