spree_frontend 4.1.0 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (314) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +120 -0
  3. data/.codeclimate.yml +36 -0
  4. data/.deepsource.toml +19 -0
  5. data/.editorconfig +22 -0
  6. data/.eslintignore +7 -0
  7. data/.eslintrc +36 -0
  8. data/.gem_release.yml +7 -0
  9. data/.github/CONTRIBUTING.md +1 -0
  10. data/.github/ISSUE_TEMPLATE/bug_report.md +47 -0
  11. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  12. data/.github/ISSUE_TEMPLATE.md +39 -0
  13. data/.github/dependabot.yml +32 -0
  14. data/.gitignore +58 -0
  15. data/.rubocop.yml +197 -0
  16. data/.solargraph.yml +20 -0
  17. data/.stylelintignore +4 -0
  18. data/.stylelintrc +6 -0
  19. data/CODE_OF_CONDUCT.md +22 -0
  20. data/Gemfile +57 -3
  21. data/LICENSE +1 -1
  22. data/README.md +89 -0
  23. data/Rakefile +1 -1
  24. data/SECURITY.md +1 -0
  25. data/app/assets/config/spree_frontend_manifest.js +5 -0
  26. data/app/assets/images/arrow-down.svg +12 -0
  27. data/app/assets/images/arrow-right-circle-fill.svg +3 -0
  28. data/app/assets/images/card-image.svg +4 -0
  29. data/app/assets/images/edit.svg +1 -1
  30. data/app/assets/images/favicon.ico +0 -0
  31. data/app/assets/images/file-image.svg +4 -0
  32. data/app/assets/images/global.svg +1 -0
  33. data/app/assets/images/image.svg +4 -0
  34. data/app/assets/images/info.svg +7 -0
  35. data/app/assets/images/logo/spree_50.png +0 -0
  36. data/app/assets/images/logo-spree.png +0 -0
  37. data/app/assets/images/logo.png +0 -0
  38. data/app/assets/images/logo.svg +10 -1
  39. data/app/assets/images/logo@2x.png +0 -0
  40. data/app/assets/images/logo@3x.png +0 -0
  41. data/app/assets/images/noimage/large.png +0 -0
  42. data/app/assets/images/noimage/mini.png +0 -0
  43. data/app/assets/images/noimage/plp.png +0 -0
  44. data/app/assets/images/noimage/plp.svg +16 -0
  45. data/app/assets/images/noimage/product.png +0 -0
  46. data/app/assets/images/noimage/small.png +0 -0
  47. data/app/assets/images/pagination-arrow-right.svg +3 -10
  48. data/app/assets/images/pagination-double-arrow-right.svg +6 -13
  49. data/app/assets/images/plus.svg +1 -1
  50. data/app/assets/images/search.svg +1 -1
  51. data/app/assets/javascripts/spree/frontend/account.js +1 -1
  52. data/app/assets/javascripts/spree/frontend/api/main.js +36 -0
  53. data/app/assets/javascripts/spree/frontend/api/storefront/cart.js +49 -0
  54. data/app/assets/javascripts/spree/frontend/cart.js +24 -2
  55. data/app/assets/javascripts/spree/frontend/checkout/address.js +78 -52
  56. data/app/assets/javascripts/spree/frontend/checkout/address_book.js +38 -40
  57. data/app/assets/javascripts/spree/frontend/checkout/payment.js +63 -23
  58. data/app/assets/javascripts/spree/frontend/checkout/shipment.js +15 -2
  59. data/app/assets/javascripts/spree/frontend/checkout.js +17 -1
  60. data/app/assets/javascripts/spree/frontend/coupon_manager.js +1 -1
  61. data/app/assets/javascripts/spree/frontend/currency.js +44 -0
  62. data/app/assets/javascripts/spree/frontend/locale.es6 +12 -0
  63. data/app/assets/javascripts/spree/frontend/login.js +5 -0
  64. data/app/assets/javascripts/spree/frontend/main.js +78 -0
  65. data/app/assets/javascripts/spree/frontend/main_nav_bar.js +86 -0
  66. data/app/assets/javascripts/spree/frontend/{turbolinks_scroll_fix.js → turbo_scroll_fix.js} +3 -3
  67. data/app/assets/javascripts/spree/frontend/views/spree/home/product_carousels.js +4 -4
  68. data/app/assets/javascripts/spree/frontend/views/spree/product/related.js +3 -3
  69. data/app/assets/javascripts/spree/frontend/views/spree/products/cart_form.js +67 -18
  70. data/app/assets/javascripts/spree/frontend/views/spree/products/description.js +1 -1
  71. data/app/assets/javascripts/spree/frontend/views/spree/products/index.js +76 -15
  72. data/app/assets/javascripts/spree/frontend/views/spree/products/price_filters.es6 +46 -0
  73. data/app/assets/javascripts/spree/frontend/views/spree/shared/mobile_navigation.js +9 -10
  74. data/app/assets/javascripts/spree/frontend/views/spree/shared/product_added_modal.js +7 -0
  75. data/app/assets/javascripts/spree/frontend/views/spree/shared/variant_select.js +93 -0
  76. data/app/assets/javascripts/spree/frontend.js +68 -11
  77. data/app/assets/stylesheets/spree/frontend/application.scss +5 -2
  78. data/app/assets/stylesheets/spree/frontend/components-bootstrap/button.scss +8 -0
  79. data/app/assets/stylesheets/spree/frontend/components-bootstrap/carousel.scss +4 -0
  80. data/app/assets/stylesheets/spree/frontend/components-custom/inputs.scss +80 -1
  81. data/app/assets/stylesheets/spree/frontend/flags/_flag-icon-base.scss +23 -0
  82. data/app/assets/stylesheets/spree/frontend/flags/_flag-icon-list.scss +265 -0
  83. data/app/assets/stylesheets/spree/frontend/flags/_variables.scss +2 -0
  84. data/app/assets/stylesheets/spree/frontend/flags/flag-icon.scss +3 -0
  85. data/app/assets/stylesheets/spree/frontend/functions.scss +1 -0
  86. data/app/assets/stylesheets/spree/frontend/helpers/spree/frontend_helper.scss +48 -0
  87. data/app/assets/stylesheets/spree/frontend/variables/bootstrap-overrides.scss +2 -2
  88. data/app/assets/stylesheets/spree/frontend/variables/helper-variables.scss +1 -0
  89. data/app/assets/stylesheets/spree/frontend/variables/variables.scss +54 -0
  90. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/confirm.scss +27 -26
  91. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/delivery.scss +6 -0
  92. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/edit.scss +24 -10
  93. data/app/assets/stylesheets/spree/frontend/views/spree/cms_sections/_index.scss +1 -0
  94. data/app/assets/stylesheets/spree/frontend/views/spree/cms_sections/product_buy_bar.scss +20 -0
  95. data/app/assets/stylesheets/spree/frontend/views/spree/home/index.scss +54 -67
  96. data/app/assets/stylesheets/spree/frontend/views/spree/orders/edit.scss +4 -3
  97. data/app/assets/stylesheets/spree/frontend/views/spree/orders/show.scss +3 -0
  98. data/app/assets/stylesheets/spree/frontend/views/spree/products/cart_form.scss +8 -0
  99. data/app/assets/stylesheets/spree/frontend/views/spree/products/gallery_modal.scss +7 -0
  100. data/app/assets/stylesheets/spree/frontend/views/spree/products/index.scss +55 -26
  101. data/app/assets/stylesheets/spree/frontend/views/spree/products/show.scss +7 -0
  102. data/app/assets/stylesheets/spree/frontend/views/spree/shared/_color_select.scss +10 -9
  103. data/app/assets/stylesheets/spree/frontend/views/spree/shared/carousel/single.scss +1 -1
  104. data/app/assets/stylesheets/spree/frontend/views/spree/shared/carousel/thumbnails.scss +1 -0
  105. data/app/assets/stylesheets/spree/frontend/views/spree/shared/cart.scss +9 -4
  106. data/app/assets/stylesheets/spree/frontend/views/spree/shared/category_nav_bar.scss +3 -3
  107. data/app/assets/stylesheets/spree/frontend/views/spree/shared/change_store.scss +7 -0
  108. data/app/assets/stylesheets/spree/frontend/views/spree/shared/footer.scss +4 -0
  109. data/app/assets/stylesheets/spree/frontend/views/spree/shared/main_nav_bar.scss +42 -26
  110. data/app/assets/stylesheets/spree/frontend/views/spree/shared/mobile_navigation.scss +34 -3
  111. data/app/assets/stylesheets/spree/frontend/views/spree/shared/nav_bar.scss +24 -7
  112. data/app/assets/stylesheets/spree/frontend/views/spree/shared/quantity_select.scss +9 -12
  113. data/app/assets/stylesheets/spree/frontend/views/spree/shared/search_form.scss +12 -0
  114. data/app/assets/stylesheets/spree/frontend/views/spree/users/show.scss +7 -13
  115. data/app/assets/stylesheets/spree/frontend.css +0 -1
  116. data/app/controllers/concerns/spree/checkout/address_book.rb +9 -7
  117. data/app/controllers/concerns/spree/locale_urls.rb +21 -0
  118. data/app/controllers/spree/addresses_controller.rb +16 -33
  119. data/app/controllers/spree/checkout_controller.rb +15 -13
  120. data/app/controllers/spree/cms_pages_controller.rb +29 -0
  121. data/app/controllers/spree/content_controller.rb +0 -2
  122. data/app/controllers/spree/currency_controller.rb +17 -0
  123. data/app/controllers/spree/errors_controller.rb +11 -0
  124. data/app/controllers/spree/home_controller.rb +38 -1
  125. data/app/controllers/spree/locale_controller.rb +35 -6
  126. data/app/controllers/spree/orders_controller.rb +12 -10
  127. data/app/controllers/spree/products_controller.rb +46 -28
  128. data/app/controllers/spree/store_controller.rb +77 -12
  129. data/app/controllers/spree/taxons_controller.rb +16 -8
  130. data/app/helpers/spree/addresses_helper.rb +64 -12
  131. data/app/helpers/spree/cache_helper.rb +7 -0
  132. data/app/helpers/spree/cms_pages_helper.rb +23 -0
  133. data/app/helpers/spree/frontend_helper.rb +170 -18
  134. data/app/helpers/spree/navigation_helper.rb +81 -4
  135. data/app/helpers/spree/products_filters_helper.rb +168 -0
  136. data/app/helpers/spree/store_helper.rb +41 -0
  137. data/app/helpers/spree/structured_data_helper.rb +6 -2
  138. data/app/helpers/spree/taxons_helper.rb +2 -2
  139. data/app/services/spree/build_localized_redirect_url.rb +141 -0
  140. data/app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb +3 -3
  141. data/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb +2 -2
  142. data/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb +3 -3
  143. data/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb +3 -3
  144. data/app/views/kaminari/twitter-bootstrap-4/_page.html.erb +2 -2
  145. data/app/views/kaminari/twitter-bootstrap-4/_paginator.html.erb +2 -2
  146. data/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb +3 -3
  147. data/app/views/spree/address/_form.html.erb +26 -27
  148. data/app/views/spree/addresses/_form.html.erb +15 -6
  149. data/app/views/spree/addresses/edit.html.erb +13 -8
  150. data/app/views/spree/addresses/new.html.erb +8 -4
  151. data/app/views/spree/checkout/_address.html.erb +19 -23
  152. data/app/views/spree/checkout/_confirm.html.erb +1 -75
  153. data/app/views/spree/checkout/_credit_card.html.erb +3 -2
  154. data/app/views/spree/checkout/_delivery.html.erb +11 -4
  155. data/app/views/spree/checkout/_delivery_informations.html.erb +51 -0
  156. data/app/views/spree/checkout/_payment.html.erb +5 -24
  157. data/app/views/spree/checkout/_payment_sources.html.erb +17 -0
  158. data/app/views/spree/checkout/_summary.html.erb +22 -19
  159. data/app/views/spree/checkout/edit.html.erb +22 -2
  160. data/app/views/spree/checkout/payment/_gateway.html.erb +2 -2
  161. data/app/views/spree/checkout/registration.html.erb +3 -3
  162. data/app/views/spree/cms_pages/show.html.erb +16 -0
  163. data/app/views/spree/errors/not_found.html.erb +2 -2
  164. data/app/views/spree/home/index.html.erb +17 -123
  165. data/app/views/spree/layouts/checkout.html.erb +3 -1
  166. data/app/views/spree/layouts/spree_application.html.erb +3 -2
  167. data/app/views/spree/locale/index.html.erb +1 -0
  168. data/app/views/spree/orders/_coupon_code.html.erb +3 -4
  169. data/app/views/spree/orders/_line_item.html.erb +4 -4
  170. data/app/views/spree/orders/_line_item_data.html.erb +3 -3
  171. data/app/views/spree/orders/edit.html.erb +2 -3
  172. data/app/views/spree/orders/show.html.erb +2 -72
  173. data/app/views/spree/products/_cart_form.html.erb +5 -2
  174. data/app/views/spree/products/_color_option_type.html.erb +14 -14
  175. data/app/views/spree/products/_description.html.erb +19 -14
  176. data/app/views/spree/products/_filters_desktop.html.erb +80 -40
  177. data/app/views/spree/products/_filters_mobile.html.erb +47 -15
  178. data/app/views/spree/products/_gallery.html.erb +4 -6
  179. data/app/views/spree/products/_gallery_modal.html.erb +4 -6
  180. data/app/views/spree/products/_option_type.html.erb +1 -3
  181. data/app/views/spree/products/_product.html.erb +1 -1
  182. data/app/views/spree/products/_properties.html.erb +6 -4
  183. data/app/views/spree/products/_sort_desktop.html.erb +20 -14
  184. data/app/views/spree/products/_sort_mobile.html.erb +24 -8
  185. data/app/views/spree/products/_thumbnails.html.erb +2 -2
  186. data/app/views/spree/products/index.html.erb +7 -4
  187. data/app/views/spree/products/related.html.erb +11 -5
  188. data/app/views/spree/products/show.html.erb +2 -3
  189. data/app/views/spree/shared/_breadcrumbs.html.erb +2 -2
  190. data/app/views/spree/shared/_carousel_4_products.html.erb +14 -20
  191. data/app/views/spree/shared/_cart.html.erb +1 -1
  192. data/app/views/spree/shared/_checkout_header.html.erb +22 -21
  193. data/app/views/spree/shared/_color_select.html.erb +3 -3
  194. data/app/views/spree/shared/_copyright.html.erb +1 -10
  195. data/app/views/spree/shared/_currency_dropdown.html.erb +13 -0
  196. data/app/views/spree/shared/_delete_address_popup.html.erb +1 -2
  197. data/app/views/spree/shared/_error_messages.html.erb +2 -2
  198. data/app/views/spree/shared/_footer.html.erb +31 -21
  199. data/app/views/spree/shared/_get_started.html.erb +32 -0
  200. data/app/views/spree/shared/_head.html.erb +8 -5
  201. data/app/views/spree/shared/_header.html.erb +4 -4
  202. data/app/views/spree/shared/_internationalization_options.html.erb +31 -0
  203. data/app/views/spree/shared/_line_item.html.erb +3 -3
  204. data/app/views/spree/shared/_link_to_account.html.erb +7 -4
  205. data/app/views/spree/shared/_link_to_cart.html.erb +1 -2
  206. data/app/views/spree/shared/_locale_and_currency.html.erb +6 -0
  207. data/app/views/spree/shared/_locale_dropdown.html.erb +13 -0
  208. data/app/views/spree/shared/_login.html.erb +5 -5
  209. data/app/views/spree/shared/_main_nav_bar.html.erb +69 -45
  210. data/app/views/spree/shared/_mobile_internationalization_options.html.erb +37 -0
  211. data/app/views/spree/shared/_mobile_navigation.html.erb +48 -63
  212. data/app/views/spree/shared/_nav_bar.html.erb +9 -19
  213. data/app/views/spree/shared/_no_product_available.html.erb +1 -1
  214. data/app/views/spree/shared/_option_values.html.erb +2 -21
  215. data/app/views/spree/shared/_order_details.html.erb +117 -174
  216. data/app/views/spree/shared/_paths.html.erb +8 -0
  217. data/app/views/spree/shared/_payment.html.erb +2 -2
  218. data/app/views/spree/shared/_payment_sources.html.erb +2 -2
  219. data/app/views/spree/shared/_product_added_modal.html.erb +3 -3
  220. data/app/views/spree/shared/_properties.html.erb +4 -0
  221. data/app/views/spree/shared/_quantity_select.html.erb +2 -2
  222. data/app/views/spree/shared/_search.html.erb +9 -13
  223. data/app/views/spree/shared/_translations.html.erb +8 -7
  224. data/app/views/spree/shared/carousel/_single.html.erb +9 -14
  225. data/app/views/spree/shared/carousel/_thumbnails.html.erb +35 -39
  226. data/app/views/spree/shared/cms/pages/_edit_mode.html.erb +13 -0
  227. data/app/views/spree/shared/cms/sections/_featured_article.html.erb +27 -0
  228. data/app/views/spree/shared/cms/sections/_hero_image.html.erb +60 -0
  229. data/app/views/spree/shared/cms/sections/_image_gallery.html.erb +171 -0
  230. data/app/views/spree/shared/cms/sections/_product_carousel.html.erb +5 -0
  231. data/app/views/spree/shared/cms/sections/_rich_text_content.html.erb +3 -0
  232. data/app/views/spree/shared/cms/sections/_side_by_side_images.html.erb +118 -0
  233. data/app/views/spree/taxons/_header.html.erb +7 -2
  234. data/app/views/spree/users/_address.html.erb +16 -24
  235. data/app/views/spree/users/_address_controls.html.erb +10 -0
  236. data/app/views/spree/users/show.html.erb +21 -16
  237. data/config/initializers/admin_actions.rb +18 -0
  238. data/config/initializers/assets.rb +4 -13
  239. data/config/initializers/canonical_rails.rb +1 -1
  240. data/config/routes.rb +30 -26
  241. data/lib/generators/spree/frontend/copy_storefront/copy_storefront_generator.rb +1 -7
  242. data/lib/generators/spree/frontend/install/install_generator.rb +34 -0
  243. data/lib/generators/spree/frontend/install/templates/app/assets/config/manifest.js +2 -0
  244. data/lib/generators/spree/frontend/install/templates/vendor/assets/javascripts/spree/frontend/all.js +8 -0
  245. data/lib/generators/spree/frontend/install/templates/vendor/assets/stylesheets/spree/frontend/all.css +9 -0
  246. data/lib/spree/frontend/configuration.rb +18 -0
  247. data/lib/spree/frontend/engine.rb +3 -1
  248. data/lib/spree/frontend/version.rb +9 -0
  249. data/lib/spree/frontend.rb +8 -4
  250. data/license.md +13 -0
  251. data/spec/fixtures/files/store_favicon.ico +0 -0
  252. data/spree_frontend.gemspec +26 -14
  253. data/vendor/assets/javascripts/cleave.js +8 -0
  254. data/vendor/assets/javascripts/fetch.umd.js +531 -0
  255. data/vendor/assets/javascripts/jquery.payment.js +652 -0
  256. data/vendor/assets/javascripts/jsuri.js +458 -0
  257. data/vendor/assets/javascripts/polyfill.min.js +1 -0
  258. metadata +224 -86
  259. data/app/assets/images/homepage/big_category_banner.jpg +0 -0
  260. data/app/assets/images/homepage/big_category_banner_mobile.jpg +0 -0
  261. data/app/assets/images/homepage/big_category_banner_tablet_landscape.jpg +0 -0
  262. data/app/assets/images/homepage/big_category_banner_tablet_portrait.jpg +0 -0
  263. data/app/assets/images/homepage/category_banner_lower.jpg +0 -0
  264. data/app/assets/images/homepage/category_banner_lower_mobile.jpg +0 -0
  265. data/app/assets/images/homepage/category_banner_lower_tablet_landscape.jpg +0 -0
  266. data/app/assets/images/homepage/category_banner_lower_tablet_portrait.jpg +0 -0
  267. data/app/assets/images/homepage/category_banner_upper.jpg +0 -0
  268. data/app/assets/images/homepage/category_banner_upper_mobile.jpg +0 -0
  269. data/app/assets/images/homepage/category_banner_upper_tablet_landscape.jpg +0 -0
  270. data/app/assets/images/homepage/category_banner_upper_tablet_portrait.jpg +0 -0
  271. data/app/assets/images/homepage/main_banner.jpg +0 -0
  272. data/app/assets/images/homepage/main_banner_mobile.jpg +0 -0
  273. data/app/assets/images/homepage/main_banner_tablet_landscape.jpg +0 -0
  274. data/app/assets/images/homepage/main_banner_tablet_portrait.jpg +0 -0
  275. data/app/assets/images/homepage/promo_banner_left.jpg +0 -0
  276. data/app/assets/images/homepage/promo_banner_left_mobile.jpg +0 -0
  277. data/app/assets/images/homepage/promo_banner_left_tablet_landscape.jpg +0 -0
  278. data/app/assets/images/homepage/promo_banner_left_tablet_portrait.jpg +0 -0
  279. data/app/assets/images/homepage/promo_banner_right.jpg +0 -0
  280. data/app/assets/images/homepage/promo_banner_right_mobile.jpg +0 -0
  281. data/app/assets/images/homepage/promo_banner_right_tablet_landscape.jpg +0 -0
  282. data/app/assets/images/homepage/promo_banner_right_tablet_portrait.jpg +0 -0
  283. data/app/assets/images/meganav/promo_banner_left-first-category.jpg +0 -0
  284. data/app/assets/images/meganav/promo_banner_left-second-category.jpg +0 -0
  285. data/app/assets/images/meganav/promo_banner_left-third-category.jpg +0 -0
  286. data/app/assets/images/meganav/promo_banner_right-first-category.jpg +0 -0
  287. data/app/assets/images/meganav/promo_banner_right-second-category.jpg +0 -0
  288. data/app/assets/images/meganav/promo_banner_right-third-category.jpg +0 -0
  289. data/app/assets/images/noimage/big_category_banner.jpg +0 -0
  290. data/app/assets/images/noimage/big_category_banner_mobile.jpg +0 -0
  291. data/app/assets/images/noimage/big_category_banner_tablet_landscape.jpg +0 -0
  292. data/app/assets/images/noimage/big_category_banner_tablet_portrait.jpg +0 -0
  293. data/app/assets/images/noimage/category_banner.jpg +0 -0
  294. data/app/assets/images/noimage/category_banner_mobile.jpg +0 -0
  295. data/app/assets/images/noimage/category_banner_plp.jpg +0 -0
  296. data/app/assets/images/noimage/category_banner_tablet_landscape.jpg +0 -0
  297. data/app/assets/images/noimage/category_banner_tablet_portrait.jpg +0 -0
  298. data/app/assets/images/noimage/main_banner.jpg +0 -0
  299. data/app/assets/images/noimage/main_banner_mobile.jpg +0 -0
  300. data/app/assets/images/noimage/main_banner_tablet_landscape.jpg +0 -0
  301. data/app/assets/images/noimage/main_banner_tablet_portrait.jpg +0 -0
  302. data/app/assets/images/noimage/product_photo.jpg +0 -0
  303. data/app/assets/images/noimage/promo_banner.jpg +0 -0
  304. data/app/assets/images/noimage/promo_banner_megamenu.jpg +0 -0
  305. data/app/assets/images/noimage/promo_banner_mobile.jpg +0 -0
  306. data/app/assets/images/noimage/promo_banner_tablet_landscape.jpg +0 -0
  307. data/app/assets/images/noimage/promo_banner_tablet_portrait.jpg +0 -0
  308. data/app/assets/images/spark-logo@3x.png +0 -0
  309. data/app/assets/stylesheets/spree/frontend/_glyphicons_urls_fix.scss +0 -10
  310. data/app/assets/stylesheets/spree/frontend/address_book.scss +0 -8
  311. data/app/models/spree/frontend_configuration.rb +0 -7
  312. data/app/views/spree/shared/_taxonomies.html.erb +0 -16
  313. /data/app/views/spree/{shared → errors}/forbidden.html.erb +0 -0
  314. /data/app/views/spree/{shared → errors}/unauthorized.html.erb +0 -0
@@ -0,0 +1,86 @@
1
+ Spree.ready(function () {
2
+ var $navLinks = $('.main-nav-bar .nav-link.dropdown-toggle')
3
+ var $dropdownMenu = $('.main-nav-bar .dropdown-menu')
4
+ var SHOW_CLASS = 'show'
5
+ var DATA_TOGGLE_ATTR = 'data-toggle'
6
+ var DATA_TOGGLE_VALUE = 'dropdown'
7
+
8
+ function handleMouseInOutNavLinks(event) {
9
+ var $navLink = $(this)
10
+ var $parent = $navLink.parent()
11
+ var $dropdown = $navLink.next()
12
+ var eventType = event.type
13
+
14
+ if (eventType === 'mouseenter') {
15
+ $navLink.removeAttr(DATA_TOGGLE_ATTR)
16
+ $parent.addClass(SHOW_CLASS)
17
+ $dropdown.addClass(SHOW_CLASS)
18
+ } else if (eventType === 'mouseleave') {
19
+ var isDropdownHovered = $dropdown.filter(':hover').length
20
+ var isNavLinkHovered = $navLink.filter(':hover').length
21
+ if (isDropdownHovered || isNavLinkHovered) {
22
+ return
23
+ }
24
+ $navLink.attr(DATA_TOGGLE_ATTR, DATA_TOGGLE_VALUE)
25
+ $parent.removeClass(SHOW_CLASS)
26
+ $dropdown.removeClass(SHOW_CLASS)
27
+ }
28
+ }
29
+
30
+ function handleFocusinNavLink() {
31
+ var $navLink = $(this)
32
+ var $parent = $navLink.parent()
33
+ var $dropdown = $navLink.next()
34
+
35
+ $parent.addClass(SHOW_CLASS)
36
+ $dropdownMenu.removeClass(SHOW_CLASS)
37
+ $dropdown.addClass(SHOW_CLASS)
38
+ }
39
+
40
+ function handleFocusoutNavLink() {
41
+ var $navLink = $(this)
42
+ var $parent = $navLink.parent()
43
+ var $dropdown = $navLink.next()
44
+
45
+ setTimeout(function() {
46
+ var dropdownHasActiveElement = $.contains($dropdown[0], document.activeElement)
47
+
48
+ if (!dropdownHasActiveElement) {
49
+ $parent.removeClass(SHOW_CLASS)
50
+ $dropdown.removeClass(SHOW_CLASS)
51
+ }
52
+ }, 0)
53
+
54
+ }
55
+
56
+ function handleMouseleaveDropdown() {
57
+ var $dropdown = $(this)
58
+ var isDropdownHovered = $dropdown.filter(':hover').length
59
+ var isNavLinkHovered = $dropdown.prev().filter(':hover').length
60
+ if (isDropdownHovered || isNavLinkHovered) {
61
+ return
62
+ }
63
+ $dropdown.parent().removeClass(SHOW_CLASS)
64
+ $dropdown.removeClass(SHOW_CLASS)
65
+ }
66
+
67
+ function handleFocusoutDropdownItems() {
68
+ var $dropdownLink = $(this)
69
+ setTimeout(function() {
70
+ var $parentDropdown = $dropdownLink.parents('.dropdown-menu')
71
+ var $navLink = $parentDropdown.parent()
72
+ var parentHasActiveElement = $.contains($parentDropdown[0], document.activeElement)
73
+
74
+ if (!parentHasActiveElement) {
75
+ $navLink.removeClass(SHOW_CLASS)
76
+ $parentDropdown.removeClass(SHOW_CLASS)
77
+ }
78
+ }, 0)
79
+ }
80
+
81
+ $navLinks.on('mouseenter mouseleave', handleMouseInOutNavLinks);
82
+ $navLinks.on('focusin', handleFocusinNavLink)
83
+ $navLinks.on('focusout', handleFocusoutNavLink)
84
+ $dropdownMenu.on('mouseleave', handleMouseleaveDropdown)
85
+ $dropdownMenu.on('focusout', '.dropdown-item', handleFocusoutDropdownItems)
86
+ })
@@ -15,8 +15,8 @@
15
15
 
16
16
  // Invalidate the page when the next page is different from the current page
17
17
  // Persist scroll information across pages
18
- document.addEventListener('turbolinks:before-visit', function (event) {
19
- if (event.data.url !== location.href) {
18
+ document.addEventListener('turbo:before-visit', function (event) {
19
+ if (event.detail.url !== location.href) {
20
20
  sessionStorage.setItem(PAGE_INVALIDATED, 'true')
21
21
  }
22
22
  sessionStorage.setItem(SCROLL_POSITION, JSON.stringify(scrollData()))
@@ -28,7 +28,7 @@
28
28
  // invalidation,
29
29
  // 3. scroll to the persisted position if there, or to the top otherwise
30
30
  // 4. Remove the persisted information
31
- addEventListener('turbolinks:load', function (event) {
31
+ addEventListener('turbo:load', function (event) {
32
32
  var scrollPosition = JSON.parse(sessionStorage.getItem(SCROLL_POSITION))
33
33
 
34
34
  if (shouldScroll(scrollPosition)) {
@@ -23,13 +23,13 @@ Spree.loadCarousel = function (element, div) {
23
23
  }
24
24
 
25
25
  Spree.loadsCarouselElements = function () {
26
- $('div[data-product-carousel]').each(function (_index, element) { Spree.loadCarousel(element, this) })
26
+ $('div[data-product-carousel-taxon-id]').each(function (_index, element) { Spree.loadCarousel(element, this) })
27
27
  }
28
28
 
29
- document.addEventListener('turbolinks:load', function () {
30
- var homePage = $('body#home')
29
+ document.addEventListener('turbo:load', function () {
30
+ var carouselPresent = $('div[data-product-carousel-taxon-id]')
31
31
 
32
- if (homePage.length) {
32
+ if (carouselPresent.length) {
33
33
  // load Carousels straight away if they are in the viewport
34
34
  Spree.loadsCarouselElements()
35
35
 
@@ -1,6 +1,6 @@
1
1
  //= require spree/frontend/viewport
2
2
 
3
- Spree.fetchRelatedProductcs = function (id, htmlContainer) {
3
+ Spree.fetchRelatedProducts = function (id, htmlContainer) {
4
4
  return $.ajax({
5
5
  url: Spree.routes.product_related(id)
6
6
  }).done(function (data) {
@@ -9,7 +9,7 @@ Spree.fetchRelatedProductcs = function (id, htmlContainer) {
9
9
  })
10
10
  }
11
11
 
12
- document.addEventListener('turbolinks:load', function () {
12
+ document.addEventListener('turbo:load', function () {
13
13
  var productDetailsPage = $('body#product-details')
14
14
 
15
15
  if (productDetailsPage.length) {
@@ -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.fetchRelatedProductcs(productId, relatedProductsContainer)
24
+ Spree.fetchRelatedProducts(productId, relatedProductsContainer)
25
25
  relatedProductsFetched = true
26
26
  }
27
27
  })
@@ -1,5 +1,6 @@
1
- //= require spree/api/storefront/cart
1
+ //= require spree/frontend/api/storefront/cart
2
2
  //= require ../shared/product_added_modal
3
+ //= require ../shared/variant_select
3
4
 
4
5
  var ADD_TO_CART_FORM_SELECTOR = '.add-to-cart-form'
5
6
  var VARIANT_ID_SELECTOR = '[name="variant_id"]'
@@ -20,21 +21,36 @@ function CartForm($, $cartForm) {
20
21
  }
21
22
 
22
23
  this.initialize = function() {
24
+ this.urlQueryMatchFound = false
23
25
  this.selectedOptionValueIds = []
24
26
  this.variants = JSON.parse($cartForm.attr('data-variants'))
25
27
  this.withOptionValues = Boolean($cartForm.find(OPTION_VALUE_SELECTOR).length)
26
28
 
27
29
  this.$addToCart = $cartForm.find(ADD_TO_CART_SELECTOR)
28
30
  this.$price = $cartForm.find('.price.selling')
31
+ this.$compareAtPrice = $cartForm.find('.compare-at-price')
29
32
  this.$variantIdInput = $cartForm.find(VARIANT_ID_SELECTOR)
30
33
 
31
- this.initializeForm()
34
+ this.initializeQueryParamsCheck()
35
+ this.initializeColorVarianTooltip()
36
+
37
+ if (this.urlQueryMatchFound) {
38
+ this.setSelectedVariantFromUrl()
39
+ } else {
40
+ this.initializeForm()
41
+ }
32
42
  }
33
43
 
34
44
  this.initializeForm = function() {
35
45
  if (this.withOptionValues) {
36
46
  var $optionValue = this.firstCheckedOptionValue()
37
47
  this.applyCheckedOptionValue($optionValue, true)
48
+ var singleOptionValues = this.getSingleOptionValuesFromEachOptionType()
49
+ if (singleOptionValues.length) {
50
+ singleOptionValues.forEach(function($value) {
51
+ this.applyCheckedOptionValue($value, true)
52
+ })
53
+ }
38
54
  } else {
39
55
  this.updateAddToCart()
40
56
  this.triggerVariantImages()
@@ -46,7 +62,9 @@ function CartForm($, $cartForm) {
46
62
  }
47
63
 
48
64
  this.handleOptionValueClick = function(event) {
49
- this.applyCheckedOptionValue($(event.currentTarget))
65
+ var currentTarget = $(event.currentTarget)
66
+ this.applyCheckedOptionValue(currentTarget)
67
+ currentTarget.blur()
50
68
  }.bind(this)
51
69
 
52
70
  this.applyCheckedOptionValue = function($optionValue, initialUpdate) {
@@ -61,6 +79,8 @@ function CartForm($, $cartForm) {
61
79
  if (this.shouldTriggerVariantImage($optionValue)) {
62
80
  this.triggerVariantImages()
63
81
  }
82
+
83
+ if (initialUpdate) $optionValue.prop('checked', true)
64
84
  }
65
85
 
66
86
  this.saveCheckedOptionValue = function($optionValue) {
@@ -69,7 +89,7 @@ function CartForm($, $cartForm) {
69
89
  this.selectedOptionValueIds.splice(
70
90
  optionTypeIndex,
71
91
  this.selectedOptionValueIds.length,
72
- parseInt($optionValue.val())
92
+ $optionValue.val().toString()
73
93
  )
74
94
  }
75
95
 
@@ -84,7 +104,7 @@ function CartForm($, $cartForm) {
84
104
  .find(OPTION_VALUE_SELECTOR)
85
105
  .each(function(_index, ov) {
86
106
  var $ov = $(ov)
87
- var id = parseInt($ov.val())
107
+ var id = $ov.val().toString()
88
108
 
89
109
  $ov.prop('checked', false)
90
110
  $ov.prop('disabled', !availableOptionValueIds.includes(id))
@@ -101,7 +121,7 @@ function CartForm($, $cartForm) {
101
121
 
102
122
  return this.variants.reduce(function(acc, variant) {
103
123
  var optionValues = variant.option_values.map(function(ov) {
104
- return ov.id
124
+ return ov.id.toString()
105
125
  })
106
126
 
107
127
  var isPossibleVariantFound = selectedOptionValueIds.every(function(ov) {
@@ -120,6 +140,17 @@ function CartForm($, $cartForm) {
120
140
  return $cartForm.find(OPTION_VALUE_SELECTOR + '[data-option-type-index=0]' + ':checked')
121
141
  }
122
142
 
143
+ this.getSingleOptionValuesFromEachOptionType = function() {
144
+ var singleOptionValues = []
145
+ this.optionTypes().each(function(_, optionType) {
146
+ var $optionValues = $(optionType).find(OPTION_VALUE_SELECTOR)
147
+ if ($optionValues.length === 1) {
148
+ singleOptionValues.push($optionValues.first())
149
+ }
150
+ })
151
+ return singleOptionValues
152
+ }
153
+
123
154
  this.shouldTriggerVariantImage = function($optionValue) {
124
155
  return $optionValue.data('is-color') || !this.firstCheckedOptionValue().data('is-color')
125
156
  }
@@ -149,7 +180,7 @@ function CartForm($, $cartForm) {
149
180
 
150
181
  if (!this.withOptionValues) {
151
182
  return this.variants.find(function(variant) {
152
- return variant.id === parseInt(self.$variantIdInput.val())
183
+ return variant.id && self.$variantIdInput.val() && variant.id.toString() === self.$variantIdInput.val().toString()
153
184
  })
154
185
  }
155
186
 
@@ -159,7 +190,7 @@ function CartForm($, $cartForm) {
159
190
 
160
191
  return this.variants.find(function(variant) {
161
192
  var optionValueIds = variant.option_values.map(function(ov) {
162
- return ov.id
193
+ return ov.id.toString()
163
194
  })
164
195
 
165
196
  return self.areArraysEqual(optionValueIds, self.selectedOptionValueIds)
@@ -220,7 +251,12 @@ function CartForm($, $cartForm) {
220
251
 
221
252
  if (!variant) return
222
253
 
223
- this.$price.text(variant.display_price)
254
+ var shouldDisplayCompareAtPrice = variant.should_display_compare_at_price
255
+
256
+ this.$price.html(variant.display_price)
257
+
258
+ var compareAtPriceContent = shouldDisplayCompareAtPrice ? variant.display_compare_at_price : ''
259
+ this.$compareAtPrice.html(compareAtPriceContent)
224
260
  }
225
261
 
226
262
  this.updateVariantId = function() {
@@ -243,29 +279,38 @@ Spree.ready(function($) {
243
279
  )
244
280
  }
245
281
 
282
+ Spree.addToCartFormSubmissionOptions = function() {
283
+ return {};
284
+ }
285
+
246
286
  $('#product-details').on('submit', ADD_TO_CART_FORM_SELECTOR, function(event) {
247
- var variantId
248
- var quantity
249
- var $cartForm = $(event.currentTarget)
250
- var $addToCart = $cartForm.find(ADD_TO_CART_SELECTOR)
287
+ var $cartForm = $(event.currentTarget);
288
+ var $addToCart = $cartForm.find(ADD_TO_CART_SELECTOR);
289
+ var variantId = $cartForm.find(VARIANT_ID_SELECTOR).val();
290
+ var quantity = parseInt($cartForm.find('[name="quantity"]').val());
291
+ var options = Spree.addToCartFormSubmissionOptions();
251
292
 
252
293
  event.preventDefault()
253
- $addToCart.prop('disabled', true)
254
- variantId = $cartForm.find(VARIANT_ID_SELECTOR).val()
255
- quantity = parseInt($cartForm.find('[name="quantity"]').val())
294
+ $addToCart.prop('disabled', true);
256
295
  Spree.ensureCart(function() {
257
296
  SpreeAPI.Storefront.addToCart(
258
297
  variantId,
259
298
  quantity,
260
- {}, // options hash - you can pass additional parameters here, your backend
299
+ options, // options hash - you can pass additional parameters here, your backend
261
300
  // needs to be aware of those, see API docs:
262
- // https://github.com/spree/spree/blob/master/api/docs/v2/storefront/index.yaml#L42
301
+ // https://github.com/spree/spree/blob/d894358e49b8c3a7f6944e838de7cd92510e31d0/api/docs/v2/storefront/index.yaml#L442
263
302
  function(response) {
264
303
  $addToCart.prop('disabled', false)
265
304
  Spree.fetchCart()
266
305
  Spree.showProductAddedModal(JSON.parse(
267
306
  $cartForm.attr('data-product-summary')
268
307
  ), Spree.variantById($cartForm, variantId))
308
+ $cartForm.trigger({
309
+ type: 'product_add_to_cart',
310
+ variant: Spree.variantById($cartForm, variantId),
311
+ quantity_increment: quantity,
312
+ cart: response.attributes
313
+ })
269
314
  },
270
315
  function(error) {
271
316
  if (typeof error === 'string' && error !== '') {
@@ -285,4 +330,8 @@ Spree.ready(function($) {
285
330
 
286
331
  CartForm($, $cartForm)
287
332
  })
333
+
334
+ document.addEventListener('turbo:request-start', function () {
335
+ Spree.hideProductAddedModal()
336
+ })
288
337
  })
@@ -1,4 +1,4 @@
1
- document.addEventListener('turbolinks:load', function () {
1
+ document.addEventListener('turbo:load', function () {
2
2
  $('#product-description-arrow').click(function () {
3
3
  document.getElementById('product-description-long').classList.remove('d-none')
4
4
  document.getElementById('product-description-short').classList.add('d-none')
@@ -1,15 +1,15 @@
1
- Spree.ready(function($) {
2
- $('#sort-by-overlay-show-button').click(function() {
1
+ Spree.ready(function ($) {
2
+ $('#sort-by-overlay-show-button').click(function () {
3
3
  $('#sort-by-overlay').show();
4
4
  });
5
- $('#sort-by-overlay-hide-button').click(function() {
5
+ $('#sort-by-overlay-hide-button').click(function () {
6
6
  $('#sort-by-overlay').hide();
7
7
  });
8
8
 
9
- $('#filter-by-overlay-show-button').click(function() {
9
+ $('#filter-by-overlay-show-button').click(function () {
10
10
  $('#filter-by-overlay').show();
11
11
  });
12
- $('#filter-by-overlay-hide-button').click(function() {
12
+ $('#filter-by-overlay-hide-button').click(function () {
13
13
  $('#filter-by-overlay').hide();
14
14
  });
15
15
 
@@ -21,21 +21,82 @@ Spree.ready(function($) {
21
21
  $('#no-product-available-close-button').click(closeNoProductModal);
22
22
  $('#no-product-available-hide-button').click(closeNoProductModal);
23
23
 
24
- $('.plp-overlay-card-item').click(function() {
24
+ function customEncodeURI(value) {
25
+ return encodeURI(
26
+ value.replace(/\s/g, '+').replace(/'/g, '%27').replace(/\$/g, '%24')
27
+ ).replace(/%25/g, '%');
28
+ }
29
+
30
+ function setNewUrl(searchParams) {
31
+ history.replaceState(
32
+ {},
33
+ '',
34
+ location.pathname +
35
+ '?' +
36
+ customEncodeURI(decodeURIComponent(searchParams.toString()))
37
+ );
38
+ Turbo.visit(location);
39
+ }
40
+
41
+ function updateFilters(event, $this, removeValue) {
42
+ event.preventDefault();
43
+ var data = $this.closest('a[data-params]').data();
44
+ var searchParams = new URLSearchParams(location.search);
45
+ var key = data.filterName;
46
+ var value = data.params[key].toString();
47
+
48
+ searchParams.delete('page');
49
+ if (!searchParams.has('menu_open') && data.params['menu_open']) {
50
+ searchParams.set('menu_open', data.params['menu_open']);
51
+ } else if (searchParams.has('menu_open') && !data.params['menu_open']) {
52
+ searchParams.delete('menu_open');
53
+ }
54
+
55
+ if (searchParams.get(key) === null || !data.multiselect) {
56
+ searchParams.set(key, value);
57
+ } else {
58
+ var arr = searchParams.get(key).toString().split(',');
59
+ var index = arr.indexOf(data.id.toString());
60
+
61
+ if (index > -1 && removeValue) {
62
+ arr.splice(index, 1);
63
+ } else {
64
+ arr.push(data.id.toString());
65
+ }
66
+
67
+ searchParams.set(key, arr.join(','));
68
+ }
69
+
70
+ setNewUrl(searchParams);
71
+ }
72
+
73
+ $('.plp-overlay-card-item').click(function (event) {
74
+ if (window.URLSearchParams) {
75
+ updateFilters(
76
+ event,
77
+ $(this),
78
+ $(this).hasClass('plp-overlay-card-item--selected')
79
+ );
80
+ }
25
81
  $(this).toggleClass('plp-overlay-card-item--selected');
26
82
  });
27
83
 
28
- $('#filters-accordion .color-select, #plp-filters-accordion .color-select').click(function() {
29
- $(this).find('.plp-overlay-color-item').toggleClass('color-select-border--selected')
84
+ $(
85
+ '#filters-accordion .color-select, #plp-filters-accordion .color-select'
86
+ ).click(function (event) {
87
+ var colorItem = $(this).find('.plp-overlay-color-item');
88
+ if (window.URLSearchParams) {
89
+ updateFilters(
90
+ event,
91
+ $(this),
92
+ colorItem.hasClass('color-select-border--selected')
93
+ );
94
+ }
95
+ colorItem.toggleClass('color-select-border--selected');
30
96
  });
31
97
 
32
98
  $('.plp-overlay-ul-li').click(function() {
33
- $('.plp-overlay-ul-li--active')
34
- .removeClass('plp-overlay-ul-li--active')
35
- .addClass('plp-overlay-ul-li');
36
-
37
- $(this)
38
- .removeClass('plp-overlay-ul-li')
39
- .addClass('plp-overlay-ul-li--active');
99
+ $('.plp-overlay-ul-li').removeClass('plp-overlay-ul-li--active')
100
+ $(this).addClass('plp-overlay-ul-li--active');
40
101
  });
41
102
  });
@@ -0,0 +1,46 @@
1
+ Spree.ready(function() {
2
+ class PriceRangeFilter {
3
+ constructor(inputsContainer, filterButton) {
4
+ this.inputsContainer = inputsContainer
5
+ this.filterButton = filterButton
6
+
7
+ this.priceInputs = inputsContainer.querySelectorAll('input')
8
+ this.minPriceInput = inputsContainer.querySelector('input[name="min_price"]')
9
+ this.maxPriceInput = inputsContainer.querySelector('input[name="max_price"]')
10
+ }
11
+
12
+ handlePriceChange() {
13
+ this.priceInputs.forEach((priceInput) => {
14
+ priceInput.addEventListener('change', () => {
15
+ this.updatePricesForFiltering(
16
+ parseInt(this.minPriceInput.value) || 0,
17
+ parseInt(this.maxPriceInput.value) || 'Infinity'
18
+ )
19
+ })
20
+ })
21
+ }
22
+
23
+ updatePricesForFiltering(minPrice, maxPrice) {
24
+ const formattedPriceRange = `${minPrice}-${maxPrice}`
25
+ const url = new URL(this.filterButton.href)
26
+
27
+ url.searchParams.set('price', formattedPriceRange)
28
+ this.filterButton.href = `${url.pathname}${url.search}`
29
+ }
30
+ }
31
+
32
+ // we have 2 elements for filtering prices - desktop and mobile
33
+ const desktopElement = document.getElementById('filterPriceRangeDesktop')
34
+ if (desktopElement) {
35
+ const desktopFilterButton = desktopElement.querySelector('a')
36
+ const desktopPriceRangeFilter = new PriceRangeFilter(desktopElement, desktopFilterButton)
37
+ desktopPriceRangeFilter.handlePriceChange()
38
+ }
39
+
40
+ const mobileElement = document.getElementById('filterPriceRangeMobile')
41
+ if (mobileElement) {
42
+ const mobileFilterButton = document.getElementById('filterProductsButtonMobile')
43
+ const mobilePriceRangeFilter = new PriceRangeFilter(mobileElement, mobileFilterButton)
44
+ mobilePriceRangeFilter.handlePriceChange()
45
+ }
46
+ });
@@ -6,6 +6,7 @@ Spree.ready(function($) {
6
6
  if (this.mobileNavigation !== null) {
7
7
  this.burgerButton = document.querySelector('.navbar-toggler');
8
8
  this.closeButton = document.querySelector('#mobile-navigation-close-button');
9
+ this.mobileNavigationList = document.querySelector('.mobile-navigation-list');
9
10
  this.categoryLinks = document.querySelectorAll('.mobile-navigation-category-link');
10
11
  this.backButton = document.querySelector('#mobile-navigation-back-button');
11
12
  this.overlay = document.querySelector('#overlay');
@@ -14,16 +15,14 @@ Spree.ready(function($) {
14
15
 
15
16
  this.onResize = this.onResize.bind(this);
16
17
  this.onCategoryClick = this.onCategoryClick.bind(this);
17
- this.onTouchMove = this.onTouchMove.bind(this);
18
18
  this.onBurgerClick = this.onBurgerClick.bind(this);
19
19
  this.onCloseClick = this.onCloseClick.bind(this);
20
20
  this.onBackClick = this.onBackClick.bind(this);
21
21
  this.closeAllCategories = this.closeAllCategories.bind(this);
22
22
 
23
23
  window.addEventListener('resize', this.onResize);
24
- window.addEventListener('turbolinks:request-start', this.onCloseClick);
24
+ window.addEventListener('turbo:request-start', this.onCloseClick);
25
25
 
26
- this.mobileNavigation.addEventListener('touchmove', this.onTouchMove, false);
27
26
  this.burgerButton.addEventListener('click', this.onBurgerClick, false);
28
27
  this.closeButton.addEventListener('click', this.onCloseClick, false);
29
28
  this.backButton.addEventListener('click', this.onBackClick, false);
@@ -45,10 +44,6 @@ Spree.ready(function($) {
45
44
  this.openCategory(category);
46
45
  }
47
46
 
48
- MobileNavigationManager.prototype.onTouchMove = function(e) {
49
- e.preventDefault();
50
- };
51
-
52
47
  MobileNavigationManager.prototype.onBurgerClick = function() {
53
48
  if (this.navigationOpen) {
54
49
  this.close();
@@ -82,8 +77,10 @@ Spree.ready(function($) {
82
77
 
83
78
  MobileNavigationManager.prototype.openCategory = function(category) {
84
79
  this.openedCategories.push(category);
85
- var subList = document.querySelector('ul[data-category=' + category + ']');
80
+ var subList = document.querySelector('ul[data-category="' + category + '"]');
86
81
  if (subList) {
82
+ this.mobileNavigationList.classList.add('mobile-navigation-list-subcategory-shown');
83
+ this.mobileNavigationList.scrollTop = 0
87
84
  subList.classList.add('shown');
88
85
  this.backButton.classList.add('shown');
89
86
  }
@@ -92,18 +89,19 @@ Spree.ready(function($) {
92
89
 
93
90
  MobileNavigationManager.prototype.closeCurrentCategory = function() {
94
91
  var category = this.openedCategories.pop();
95
- var subList = document.querySelector('ul[data-category=' + category + ']');
92
+ var subList = document.querySelector('ul[data-category="' + category + '"]');
96
93
  if (subList) {
97
94
  subList.classList.remove('shown');
98
95
  }
99
96
  if (this.openedCategories[this.openedCategories.length - 1] === 'main') {
100
97
  this.backButton.classList.remove('shown');
101
98
  }
99
+ this.mobileNavigationList.classList.remove('mobile-navigation-list-subcategory-shown')
102
100
  return false;
103
101
  }
104
102
 
105
103
  MobileNavigationManager.prototype.closeCategory = function(category) {
106
- var subList = document.querySelector('ul[data-category=' + category + ']');
104
+ var subList = document.querySelector('ul[data-category="' + category + '"]');
107
105
  subList.style.transition = 'none';
108
106
  subList.classList.remove('shown');
109
107
  setTimeout(function(){ subList.style.transition = ''; }, 500);
@@ -116,6 +114,7 @@ Spree.ready(function($) {
116
114
  var category = openedCategories.pop();
117
115
  this.closeCategory(category);
118
116
  }
117
+ this.mobileNavigationList.classList.remove('mobile-navigation-list-subcategory-shown')
119
118
  this.backButton.classList.remove('shown');
120
119
  }
121
120
 
@@ -26,3 +26,10 @@ Spree.showProductAddedModal = function(product, variant) {
26
26
 
27
27
  $modal.modal()
28
28
  }
29
+
30
+ Spree.hideProductAddedModal = function() {
31
+ var modalSelector = '.product-added-modal'
32
+ var $modal = $(modalSelector)
33
+
34
+ $modal.modal('hide')
35
+ }