spree_frontend 4.1.13 → 4.2.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (381) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/arrow-down.svg +12 -0
  3. data/app/assets/images/edit.svg +1 -1
  4. data/app/assets/images/flags/4x3/ad.svg +150 -0
  5. data/app/assets/images/flags/4x3/ae.svg +6 -0
  6. data/app/assets/images/flags/4x3/af.svg +81 -0
  7. data/app/assets/images/flags/4x3/ag.svg +14 -0
  8. data/app/assets/images/flags/4x3/ai.svg +763 -0
  9. data/app/assets/images/flags/4x3/al.svg +5 -0
  10. data/app/assets/images/flags/4x3/am.svg +5 -0
  11. data/app/assets/images/flags/4x3/ao.svg +13 -0
  12. data/app/assets/images/flags/4x3/aq.svg +5 -0
  13. data/app/assets/images/flags/4x3/ar.svg +31 -0
  14. data/app/assets/images/flags/4x3/as.svg +33 -0
  15. data/app/assets/images/flags/4x3/at.svg +6 -0
  16. data/app/assets/images/flags/4x3/au.svg +9 -0
  17. data/app/assets/images/flags/4x3/aw.svg +186 -0
  18. data/app/assets/images/flags/4x3/ax.svg +18 -0
  19. data/app/assets/images/flags/4x3/az.svg +8 -0
  20. data/app/assets/images/flags/4x3/ba.svg +12 -0
  21. data/app/assets/images/flags/4x3/bb.svg +6 -0
  22. data/app/assets/images/flags/4x3/bd.svg +4 -0
  23. data/app/assets/images/flags/4x3/be.svg +7 -0
  24. data/app/assets/images/flags/4x3/bf.svg +7 -0
  25. data/app/assets/images/flags/4x3/bg.svg +7 -0
  26. data/app/assets/images/flags/4x3/bh.svg +9 -0
  27. data/app/assets/images/flags/4x3/bi.svg +15 -0
  28. data/app/assets/images/flags/4x3/bj.svg +14 -0
  29. data/app/assets/images/flags/4x3/bl.svg +7 -0
  30. data/app/assets/images/flags/4x3/bm.svg +98 -0
  31. data/app/assets/images/flags/4x3/bn.svg +36 -0
  32. data/app/assets/images/flags/4x3/bo.svg +676 -0
  33. data/app/assets/images/flags/4x3/bq.svg +5 -0
  34. data/app/assets/images/flags/4x3/br.svg +45 -0
  35. data/app/assets/images/flags/4x3/bs.svg +13 -0
  36. data/app/assets/images/flags/4x3/bt.svg +89 -0
  37. data/app/assets/images/flags/4x3/bv.svg +13 -0
  38. data/app/assets/images/flags/4x3/bw.svg +7 -0
  39. data/app/assets/images/flags/4x3/by.svg +20 -0
  40. data/app/assets/images/flags/4x3/bz.svg +145 -0
  41. data/app/assets/images/flags/4x3/ca.svg +4 -0
  42. data/app/assets/images/flags/4x3/cc.svg +19 -0
  43. data/app/assets/images/flags/4x3/cd.svg +5 -0
  44. data/app/assets/images/flags/4x3/cf.svg +15 -0
  45. data/app/assets/images/flags/4x3/cg.svg +12 -0
  46. data/app/assets/images/flags/4x3/ch.svg +9 -0
  47. data/app/assets/images/flags/4x3/ci.svg +7 -0
  48. data/app/assets/images/flags/4x3/ck.svg +9 -0
  49. data/app/assets/images/flags/4x3/cl.svg +13 -0
  50. data/app/assets/images/flags/4x3/cm.svg +15 -0
  51. data/app/assets/images/flags/4x3/cn.svg +11 -0
  52. data/app/assets/images/flags/4x3/co.svg +7 -0
  53. data/app/assets/images/flags/4x3/cr.svg +7 -0
  54. data/app/assets/images/flags/4x3/cu.svg +13 -0
  55. data/app/assets/images/flags/4x3/cv.svg +13 -0
  56. data/app/assets/images/flags/4x3/cw.svg +14 -0
  57. data/app/assets/images/flags/4x3/cx.svg +15 -0
  58. data/app/assets/images/flags/4x3/cy.svg +6 -0
  59. data/app/assets/images/flags/4x3/cz.svg +5 -0
  60. data/app/assets/images/flags/4x3/de.svg +5 -0
  61. data/app/assets/images/flags/4x3/dj.svg +13 -0
  62. data/app/assets/images/flags/4x3/dk.svg +5 -0
  63. data/app/assets/images/flags/4x3/dm.svg +152 -0
  64. data/app/assets/images/flags/4x3/do.svg +6745 -0
  65. data/app/assets/images/flags/4x3/dz.svg +5 -0
  66. data/app/assets/images/flags/4x3/ec.svg +138 -0
  67. data/app/assets/images/flags/4x3/ee.svg +7 -0
  68. data/app/assets/images/flags/4x3/eg.svg +38 -0
  69. data/app/assets/images/flags/4x3/eh.svg +15 -0
  70. data/app/assets/images/flags/4x3/er.svg +8 -0
  71. data/app/assets/images/flags/4x3/es-ca.svg +4 -0
  72. data/app/assets/images/flags/4x3/es.svg +544 -0
  73. data/app/assets/images/flags/4x3/et.svg +14 -0
  74. data/app/assets/images/flags/4x3/eu.svg +28 -0
  75. data/app/assets/images/flags/4x3/fi.svg +5 -0
  76. data/app/assets/images/flags/4x3/fj.svg +122 -0
  77. data/app/assets/images/flags/4x3/fk.svg +90 -0
  78. data/app/assets/images/flags/4x3/fm.svg +11 -0
  79. data/app/assets/images/flags/4x3/fo.svg +12 -0
  80. data/app/assets/images/flags/4x3/fr.svg +7 -0
  81. data/app/assets/images/flags/4x3/ga.svg +7 -0
  82. data/app/assets/images/flags/4x3/gb-eng.svg +5 -0
  83. data/app/assets/images/flags/4x3/gb-nir.svg +132 -0
  84. data/app/assets/images/flags/4x3/gb-sct.svg +4 -0
  85. data/app/assets/images/flags/4x3/gb-wls.svg +9 -0
  86. data/app/assets/images/flags/4x3/gb.svg +7 -0
  87. data/app/assets/images/flags/4x3/gd.svg +27 -0
  88. data/app/assets/images/flags/4x3/ge.svg +6 -0
  89. data/app/assets/images/flags/4x3/gf.svg +7 -0
  90. data/app/assets/images/flags/4x3/gg.svg +9 -0
  91. data/app/assets/images/flags/4x3/gh.svg +6 -0
  92. data/app/assets/images/flags/4x3/gi.svg +32 -0
  93. data/app/assets/images/flags/4x3/gl.svg +4 -0
  94. data/app/assets/images/flags/4x3/gm.svg +14 -0
  95. data/app/assets/images/flags/4x3/gn.svg +7 -0
  96. data/app/assets/images/flags/4x3/gp.svg +7 -0
  97. data/app/assets/images/flags/4x3/gq.svg +23 -0
  98. data/app/assets/images/flags/4x3/gr.svg +16 -0
  99. data/app/assets/images/flags/4x3/gs.svg +201 -0
  100. data/app/assets/images/flags/4x3/gt.svg +204 -0
  101. data/app/assets/images/flags/4x3/gu.svg +39 -0
  102. data/app/assets/images/flags/4x3/gw.svg +13 -0
  103. data/app/assets/images/flags/4x3/gy.svg +9 -0
  104. data/app/assets/images/flags/4x3/hk.svg +30 -0
  105. data/app/assets/images/flags/4x3/hm.svg +9 -0
  106. data/app/assets/images/flags/4x3/hn.svg +18 -0
  107. data/app/assets/images/flags/4x3/hr.svg +58 -0
  108. data/app/assets/images/flags/4x3/ht.svg +116 -0
  109. data/app/assets/images/flags/4x3/hu.svg +7 -0
  110. data/app/assets/images/flags/4x3/id.svg +6 -0
  111. data/app/assets/images/flags/4x3/ie.svg +7 -0
  112. data/app/assets/images/flags/4x3/il.svg +14 -0
  113. data/app/assets/images/flags/4x3/im.svg +36 -0
  114. data/app/assets/images/flags/4x3/in.svg +25 -0
  115. data/app/assets/images/flags/4x3/io.svg +138 -0
  116. data/app/assets/images/flags/4x3/iq.svg +10 -0
  117. data/app/assets/images/flags/4x3/ir.svg +219 -0
  118. data/app/assets/images/flags/4x3/is.svg +12 -0
  119. data/app/assets/images/flags/4x3/it.svg +7 -0
  120. data/app/assets/images/flags/4x3/je.svg +29 -0
  121. data/app/assets/images/flags/4x3/jm.svg +8 -0
  122. data/app/assets/images/flags/4x3/jo.svg +16 -0
  123. data/app/assets/images/flags/4x3/jp.svg +11 -0
  124. data/app/assets/images/flags/4x3/ke.svg +23 -0
  125. data/app/assets/images/flags/4x3/kg.svg +15 -0
  126. data/app/assets/images/flags/4x3/kh.svg +61 -0
  127. data/app/assets/images/flags/4x3/ki.svg +36 -0
  128. data/app/assets/images/flags/4x3/km.svg +16 -0
  129. data/app/assets/images/flags/4x3/kn.svg +14 -0
  130. data/app/assets/images/flags/4x3/kp.svg +15 -0
  131. data/app/assets/images/flags/4x3/kr.svg +24 -0
  132. data/app/assets/images/flags/4x3/kw.svg +13 -0
  133. data/app/assets/images/flags/4x3/ky.svg +63 -0
  134. data/app/assets/images/flags/4x3/kz.svg +23 -0
  135. data/app/assets/images/flags/4x3/la.svg +12 -0
  136. data/app/assets/images/flags/4x3/lb.svg +15 -0
  137. data/app/assets/images/flags/4x3/lc.svg +8 -0
  138. data/app/assets/images/flags/4x3/li.svg +43 -0
  139. data/app/assets/images/flags/4x3/lk.svg +22 -0
  140. data/app/assets/images/flags/4x3/lr.svg +14 -0
  141. data/app/assets/images/flags/4x3/ls.svg +8 -0
  142. data/app/assets/images/flags/4x3/lt.svg +7 -0
  143. data/app/assets/images/flags/4x3/lu.svg +5 -0
  144. data/app/assets/images/flags/4x3/lv.svg +6 -0
  145. data/app/assets/images/flags/4x3/ly.svg +13 -0
  146. data/app/assets/images/flags/4x3/ma.svg +4 -0
  147. data/app/assets/images/flags/4x3/mc.svg +6 -0
  148. data/app/assets/images/flags/4x3/md.svg +70 -0
  149. data/app/assets/images/flags/4x3/me.svg +116 -0
  150. data/app/assets/images/flags/4x3/mf.svg +7 -0
  151. data/app/assets/images/flags/4x3/mg.svg +7 -0
  152. data/app/assets/images/flags/4x3/mh.svg +7 -0
  153. data/app/assets/images/flags/4x3/mk.svg +5 -0
  154. data/app/assets/images/flags/4x3/ml.svg +7 -0
  155. data/app/assets/images/flags/4x3/mm.svg +16 -0
  156. data/app/assets/images/flags/4x3/mn.svg +13 -0
  157. data/app/assets/images/flags/4x3/mo.svg +9 -0
  158. data/app/assets/images/flags/4x3/mp.svg +86 -0
  159. data/app/assets/images/flags/4x3/mq.svg +7 -0
  160. data/app/assets/images/flags/4x3/mr.svg +6 -0
  161. data/app/assets/images/flags/4x3/ms.svg +78 -0
  162. data/app/assets/images/flags/4x3/mt.svg +49 -0
  163. data/app/assets/images/flags/4x3/mu.svg +8 -0
  164. data/app/assets/images/flags/4x3/mv.svg +6 -0
  165. data/app/assets/images/flags/4x3/mw.svg +10 -0
  166. data/app/assets/images/flags/4x3/mx.svg +382 -0
  167. data/app/assets/images/flags/4x3/my.svg +15 -0
  168. data/app/assets/images/flags/4x3/mz.svg +21 -0
  169. data/app/assets/images/flags/4x3/na.svg +16 -0
  170. data/app/assets/images/flags/4x3/nc.svg +14 -0
  171. data/app/assets/images/flags/4x3/ne.svg +6 -0
  172. data/app/assets/images/flags/4x3/nf.svg +9 -0
  173. data/app/assets/images/flags/4x3/ng.svg +6 -0
  174. data/app/assets/images/flags/4x3/ni.svg +129 -0
  175. data/app/assets/images/flags/4x3/nl.svg +5 -0
  176. data/app/assets/images/flags/4x3/no.svg +7 -0
  177. data/app/assets/images/flags/4x3/np.svg +14 -0
  178. data/app/assets/images/flags/4x3/nr.svg +12 -0
  179. data/app/assets/images/flags/4x3/nu.svg +26 -0
  180. data/app/assets/images/flags/4x3/nz.svg +41 -0
  181. data/app/assets/images/flags/4x3/om.svg +115 -0
  182. data/app/assets/images/flags/4x3/pa.svg +14 -0
  183. data/app/assets/images/flags/4x3/pe.svg +244 -0
  184. data/app/assets/images/flags/4x3/pf.svg +19 -0
  185. data/app/assets/images/flags/4x3/pg.svg +9 -0
  186. data/app/assets/images/flags/4x3/ph.svg +9 -0
  187. data/app/assets/images/flags/4x3/pk.svg +15 -0
  188. data/app/assets/images/flags/4x3/pl.svg +6 -0
  189. data/app/assets/images/flags/4x3/pm.svg +7 -0
  190. data/app/assets/images/flags/4x3/pn.svg +62 -0
  191. data/app/assets/images/flags/4x3/pr.svg +13 -0
  192. data/app/assets/images/flags/4x3/ps.svg +15 -0
  193. data/app/assets/images/flags/4x3/pt.svg +57 -0
  194. data/app/assets/images/flags/4x3/pw.svg +11 -0
  195. data/app/assets/images/flags/4x3/py.svg +157 -0
  196. data/app/assets/images/flags/4x3/qa.svg +4 -0
  197. data/app/assets/images/flags/4x3/re.svg +7 -0
  198. data/app/assets/images/flags/4x3/ro.svg +7 -0
  199. data/app/assets/images/flags/4x3/rs.svg +292 -0
  200. data/app/assets/images/flags/4x3/ru.svg +7 -0
  201. data/app/assets/images/flags/4x3/rw.svg +13 -0
  202. data/app/assets/images/flags/4x3/sa.svg +26 -0
  203. data/app/assets/images/flags/4x3/sb.svg +13 -0
  204. data/app/assets/images/flags/4x3/sc.svg +14 -0
  205. data/app/assets/images/flags/4x3/sd.svg +13 -0
  206. data/app/assets/images/flags/4x3/se.svg +5 -0
  207. data/app/assets/images/flags/4x3/sg.svg +13 -0
  208. data/app/assets/images/flags/4x3/sh.svg +74 -0
  209. data/app/assets/images/flags/4x3/si.svg +18 -0
  210. data/app/assets/images/flags/4x3/sj.svg +7 -0
  211. data/app/assets/images/flags/4x3/sk.svg +9 -0
  212. data/app/assets/images/flags/4x3/sl.svg +7 -0
  213. data/app/assets/images/flags/4x3/sm.svg +91 -0
  214. data/app/assets/images/flags/4x3/sn.svg +8 -0
  215. data/app/assets/images/flags/4x3/so.svg +11 -0
  216. data/app/assets/images/flags/4x3/sr.svg +6 -0
  217. data/app/assets/images/flags/4x3/ss.svg +8 -0
  218. data/app/assets/images/flags/4x3/st.svg +16 -0
  219. data/app/assets/images/flags/4x3/sv.svg +594 -0
  220. data/app/assets/images/flags/4x3/sx.svg +56 -0
  221. data/app/assets/images/flags/4x3/sy.svg +6 -0
  222. data/app/assets/images/flags/4x3/sz.svg +45 -0
  223. data/app/assets/images/flags/4x3/tc.svg +67 -0
  224. data/app/assets/images/flags/4x3/td.svg +7 -0
  225. data/app/assets/images/flags/4x3/tf.svg +15 -0
  226. data/app/assets/images/flags/4x3/tg.svg +14 -0
  227. data/app/assets/images/flags/4x3/th.svg +7 -0
  228. data/app/assets/images/flags/4x3/tj.svg +22 -0
  229. data/app/assets/images/flags/4x3/tk.svg +5 -0
  230. data/app/assets/images/flags/4x3/tl.svg +13 -0
  231. data/app/assets/images/flags/4x3/tm.svg +206 -0
  232. data/app/assets/images/flags/4x3/tn.svg +13 -0
  233. data/app/assets/images/flags/4x3/to.svg +10 -0
  234. data/app/assets/images/flags/4x3/tr.svg +8 -0
  235. data/app/assets/images/flags/4x3/tt.svg +5 -0
  236. data/app/assets/images/flags/4x3/tv.svg +16 -0
  237. data/app/assets/images/flags/4x3/tw.svg +14 -0
  238. data/app/assets/images/flags/4x3/tz.svg +13 -0
  239. data/app/assets/images/flags/4x3/ua.svg +6 -0
  240. data/app/assets/images/flags/4x3/ug.svg +30 -0
  241. data/app/assets/images/flags/4x3/um.svg +15 -0
  242. data/app/assets/images/flags/4x3/un.svg +16 -0
  243. data/app/assets/images/flags/4x3/us.svg +10 -0
  244. data/app/assets/images/flags/4x3/uy.svg +28 -0
  245. data/app/assets/images/flags/4x3/uz.svg +30 -0
  246. data/app/assets/images/flags/4x3/va.svg +479 -0
  247. data/app/assets/images/flags/4x3/vc.svg +8 -0
  248. data/app/assets/images/flags/4x3/ve.svg +26 -0
  249. data/app/assets/images/flags/4x3/vg.svg +127 -0
  250. data/app/assets/images/flags/4x3/vi.svg +28 -0
  251. data/app/assets/images/flags/4x3/vn.svg +11 -0
  252. data/app/assets/images/flags/4x3/vu.svg +18 -0
  253. data/app/assets/images/flags/4x3/wf.svg +7 -0
  254. data/app/assets/images/flags/4x3/ws.svg +7 -0
  255. data/app/assets/images/flags/4x3/xk.svg +16 -0
  256. data/app/assets/images/flags/4x3/ye.svg +7 -0
  257. data/app/assets/images/flags/4x3/yt.svg +7 -0
  258. data/app/assets/images/flags/4x3/za.svg +17 -0
  259. data/app/assets/images/flags/4x3/zm.svg +27 -0
  260. data/app/assets/images/flags/4x3/zw.svg +21 -0
  261. data/app/assets/images/global.svg +1 -0
  262. data/app/assets/images/info.svg +7 -0
  263. data/app/assets/images/pagination-arrow-right.svg +3 -10
  264. data/app/assets/images/pagination-double-arrow-right.svg +6 -13
  265. data/app/assets/images/plus.svg +1 -1
  266. data/app/assets/images/search.svg +1 -1
  267. data/app/assets/javascripts/spree/frontend.js +4 -1
  268. data/app/assets/javascripts/spree/frontend/cart.js +23 -1
  269. data/app/assets/javascripts/spree/frontend/checkout.js +1 -1
  270. data/app/assets/javascripts/spree/frontend/checkout/address.js +75 -49
  271. data/app/assets/javascripts/spree/frontend/checkout/payment.js +50 -23
  272. data/app/assets/javascripts/spree/frontend/login.js +5 -0
  273. data/app/assets/javascripts/spree/frontend/main_nav_bar.js +86 -0
  274. data/app/assets/javascripts/spree/frontend/multi_currency.js +13 -0
  275. data/app/assets/javascripts/spree/frontend/views/spree/product/related.js +2 -2
  276. data/app/assets/javascripts/spree/frontend/views/spree/products/cart_form.js +53 -10
  277. data/app/assets/javascripts/spree/frontend/views/spree/products/index.js +84 -14
  278. data/app/assets/javascripts/spree/frontend/views/spree/shared/product_added_modal.js +7 -0
  279. data/app/assets/javascripts/spree/frontend/views/spree/shared/variant_select.js +93 -0
  280. data/app/assets/stylesheets/spree/frontend.css +0 -1
  281. data/app/assets/stylesheets/spree/frontend/application.scss +4 -0
  282. data/app/assets/stylesheets/spree/frontend/components-bootstrap/carousel.scss +4 -0
  283. data/app/assets/stylesheets/spree/frontend/components-custom/inputs.scss +80 -1
  284. data/app/assets/stylesheets/spree/frontend/flags/_flag-icon-base.scss +23 -0
  285. data/app/assets/stylesheets/spree/frontend/flags/_flag-icon-list.scss +265 -0
  286. data/app/assets/stylesheets/spree/frontend/flags/_variables.scss +2 -0
  287. data/app/assets/stylesheets/spree/frontend/flags/flag-icon.scss +3 -0
  288. data/app/assets/stylesheets/spree/frontend/functions.scss +1 -0
  289. data/app/assets/stylesheets/spree/frontend/helpers/spree/frontend_helper.scss +7 -0
  290. data/app/assets/stylesheets/spree/frontend/variables/bootstrap-overrides.scss +1 -2
  291. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/confirm.scss +0 -4
  292. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/delivery.scss +6 -0
  293. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/edit.scss +6 -4
  294. data/app/assets/stylesheets/spree/frontend/views/spree/orders/edit.scss +2 -2
  295. data/app/assets/stylesheets/spree/frontend/views/spree/products/cart_form.scss +8 -0
  296. data/app/assets/stylesheets/spree/frontend/views/spree/products/gallery_modal.scss +1 -0
  297. data/app/assets/stylesheets/spree/frontend/views/spree/products/index.scss +28 -4
  298. data/app/assets/stylesheets/spree/frontend/views/spree/products/show.scss +7 -0
  299. data/app/assets/stylesheets/spree/frontend/views/spree/shared/_color_select.scss +10 -9
  300. data/app/assets/stylesheets/spree/frontend/views/spree/shared/carousel/single.scss +1 -1
  301. data/app/assets/stylesheets/spree/frontend/views/spree/shared/carousel/thumbnails.scss +1 -0
  302. data/app/assets/stylesheets/spree/frontend/views/spree/shared/cart.scss +9 -4
  303. data/app/assets/stylesheets/spree/frontend/views/spree/shared/change_store.scss +7 -0
  304. data/app/assets/stylesheets/spree/frontend/views/spree/shared/main_nav_bar.scss +30 -25
  305. data/app/assets/stylesheets/spree/frontend/views/spree/shared/mobile_navigation.scss +29 -3
  306. data/app/assets/stylesheets/spree/frontend/views/spree/shared/nav_bar.scss +24 -7
  307. data/app/assets/stylesheets/spree/frontend/views/spree/shared/quantity_select.scss +9 -12
  308. data/app/assets/stylesheets/spree/frontend/views/spree/shared/search_form.scss +12 -0
  309. data/app/assets/stylesheets/spree/frontend/views/spree/users/show.scss +0 -6
  310. data/app/controllers/spree/currency_controller.rb +17 -0
  311. data/app/controllers/spree/home_controller.rb +5 -1
  312. data/app/controllers/spree/products_controller.rb +32 -13
  313. data/app/controllers/spree/taxons_controller.rb +4 -3
  314. data/app/helpers/spree/addresses_helper.rb +44 -10
  315. data/app/helpers/spree/cache_helper.rb +7 -0
  316. data/app/helpers/spree/frontend_helper.rb +35 -5
  317. data/app/helpers/spree/navigation_helper.rb +4 -1
  318. data/app/models/spree/frontend_configuration.rb +1 -0
  319. data/app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb +1 -1
  320. data/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb +1 -1
  321. data/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb +1 -1
  322. data/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb +1 -1
  323. data/app/views/spree/address/_form.html.erb +22 -22
  324. data/app/views/spree/addresses/_form.html.erb +15 -6
  325. data/app/views/spree/addresses/edit.html.erb +13 -8
  326. data/app/views/spree/addresses/new.html.erb +5 -1
  327. data/app/views/spree/checkout/_address.html.erb +16 -18
  328. data/app/views/spree/checkout/_confirm.html.erb +5 -47
  329. data/app/views/spree/checkout/_delivery.html.erb +10 -3
  330. data/app/views/spree/checkout/_delivery_informations.html.erb +44 -0
  331. data/app/views/spree/checkout/_payment.html.erb +5 -24
  332. data/app/views/spree/checkout/_payment_sources.html.erb +17 -0
  333. data/app/views/spree/checkout/_summary.html.erb +22 -17
  334. data/app/views/spree/checkout/edit.html.erb +1 -1
  335. data/app/views/spree/checkout/payment/_gateway.html.erb +1 -1
  336. data/app/views/spree/checkout/registration.html.erb +2 -2
  337. data/app/views/spree/errors/not_found.html.erb +2 -2
  338. data/app/views/spree/home/index.html.erb +29 -35
  339. data/app/views/spree/layouts/checkout.html.erb +3 -1
  340. data/app/views/spree/orders/_coupon_code.html.erb +1 -1
  341. data/app/views/spree/orders/_line_item.html.erb +1 -1
  342. data/app/views/spree/orders/_line_item_data.html.erb +2 -2
  343. data/app/views/spree/orders/show.html.erb +1 -1
  344. data/app/views/spree/products/_cart_form.html.erb +6 -2
  345. data/app/views/spree/products/_color_option_type.html.erb +15 -14
  346. data/app/views/spree/products/_description.html.erb +10 -2
  347. data/app/views/spree/products/_filters_desktop.html.erb +43 -41
  348. data/app/views/spree/products/_filters_mobile.html.erb +6 -6
  349. data/app/views/spree/products/_gallery_modal.html.erb +1 -1
  350. data/app/views/spree/products/_option_type.html.erb +0 -1
  351. data/app/views/spree/products/_properties.html.erb +6 -4
  352. data/app/views/spree/products/_sort_desktop.html.erb +6 -6
  353. data/app/views/spree/products/_sort_mobile.html.erb +8 -8
  354. data/app/views/spree/shared/_breadcrumbs.html.erb +2 -2
  355. data/app/views/spree/shared/_carousel_4_products.html.erb +1 -1
  356. data/app/views/spree/shared/_cart.html.erb +1 -1
  357. data/app/views/spree/shared/_change_store.html.erb +25 -0
  358. data/app/views/spree/shared/_checkout_header.html.erb +2 -2
  359. data/app/views/spree/shared/_footer.html.erb +12 -8
  360. data/app/views/spree/shared/_head.html.erb +2 -1
  361. data/app/views/spree/shared/_link_to_account.html.erb +1 -0
  362. data/app/views/spree/shared/_link_to_cart.html.erb +1 -2
  363. data/app/views/spree/shared/_login.html.erb +4 -4
  364. data/app/views/spree/shared/_main_nav_bar.html.erb +46 -40
  365. data/app/views/spree/shared/_mobile_change_store.html.erb +30 -0
  366. data/app/views/spree/shared/_mobile_navigation.html.erb +29 -52
  367. data/app/views/spree/shared/_nav_bar.html.erb +6 -16
  368. data/app/views/spree/shared/_option_values.html.erb +2 -2
  369. data/app/views/spree/shared/_quantity_select.html.erb +1 -1
  370. data/app/views/spree/shared/_search.html.erb +8 -11
  371. data/app/views/spree/shared/_taxonomies.html.erb +1 -1
  372. data/app/views/spree/shared/carousel/_single.html.erb +1 -1
  373. data/app/views/spree/shared/carousel/_thumbnails.html.erb +32 -30
  374. data/app/views/spree/users/_address.html.erb +16 -24
  375. data/app/views/spree/users/_address_controls.html.erb +11 -0
  376. data/app/views/spree/users/show.html.erb +14 -12
  377. data/config/routes.rb +2 -0
  378. data/spree_frontend.gemspec +4 -4
  379. metadata +300 -17
  380. data/app/assets/stylesheets/spree/frontend/_glyphicons_urls_fix.scss +0 -10
  381. data/app/assets/stylesheets/spree/frontend/address_book.scss +0 -8
@@ -12,7 +12,7 @@ Spree.disableSaveOnClick = function () {
12
12
  }
13
13
 
14
14
  Spree.enableSave = function () {
15
- $('form.edit_order').data('submitted', false).find(':submit, :image').attr('disabled', false).addClass('primary').removeClass('disabled')
15
+ $('#checkout form').data('submitted', false).find(':submit, :image').attr('disabled', false).addClass('primary').removeClass('disabled')
16
16
  }
17
17
 
18
18
  Spree.ready(function () {
@@ -1,16 +1,24 @@
1
- Spree.ready(function ($) {
2
- Spree.onAddress = function () {
1
+ Spree.ready(function($) {
2
+ Spree.onAddress = function() {
3
3
  if ($('#checkout_form_address').length) {
4
- Spree.updateState = function (region) {
4
+ Spree.updateState = function(region) {
5
5
  var countryId = getCountryId(region)
6
6
  if (countryId != null) {
7
7
  if (Spree.Checkout[countryId] == null) {
8
8
  $.ajax({
9
- async: false, method: 'GET', url: Spree.pathFor('/api/v2/storefront/countries/' + countryId + '?include=states'), dataType: 'json'
10
- }).done(function (data) {
11
- var json = data.included; var xStates = []
9
+ async: false,
10
+ method: 'GET',
11
+ url: Spree.pathFor('/api/v2/storefront/countries/' + countryId + '?include=checkout_zone_applicable_states'),
12
+ dataType: 'json'
13
+ }).done(function(data) {
14
+ var json = data.included;
15
+ var xStates = [];
12
16
  for (var i = 0; i < json.length; i++) {
13
- var obj = json[i]; xStates.push({ 'id': obj.id, 'name': obj.attributes.name })
17
+ var obj = json[i];
18
+ xStates.push({
19
+ id: obj.id,
20
+ name: obj.attributes.name
21
+ })
14
22
  }
15
23
  Spree.Checkout[countryId] = {
16
24
  states: xStates,
@@ -27,91 +35,108 @@ Spree.ready(function ($) {
27
35
  }
28
36
  }
29
37
 
30
- Spree.toggleZipcode = function (data, region) {
38
+ Spree.toggleZipcode = function(data, region) {
39
+ var requiredIndicator = $('span#required_marker').first().text()
31
40
  var zipcodeRequired = data.zipcode_required
32
41
  var zipcodePara = $('#' + region + 'zipcode')
33
42
  var zipcodeInput = zipcodePara.find('input')
34
- var zipcodeSpanRequired = zipcodePara.find('abbr')
43
+ var zipcodeLabel = zipcodePara.find('label')
44
+ var zipcodeLabelText = zipcodeInput.attr('aria-label')
35
45
 
36
46
  if (zipcodeRequired) {
37
- zipcodeInput.prop('required', true)
38
- zipcodeSpanRequired.show()
39
- // zipcodeInput.prop('disabled', false)
40
- // zipcodePara.show()
47
+ var zipText = zipcodeLabelText + ' ' + requiredIndicator
48
+ zipcodeInput.prop('required', true).attr('placeholder', zipText)
49
+ zipcodeLabel.text('')
50
+ zipcodeLabel.text(zipText)
51
+ zipcodeInput.addClass('required')
41
52
  } else {
42
- zipcodeInput.val('')
43
- zipcodeInput.prop('required', false)
44
- zipcodeSpanRequired.hide()
45
- // zipcodeInput.prop('disabled', true)
46
- // zipcodePara.hide()
53
+ zipcodeInput.prop('required', false).attr('placeholder', zipcodeLabelText)
54
+ zipcodeLabel.text('')
55
+ zipcodeLabel.text(zipcodeLabelText)
56
+ zipcodeInput.removeClass('required')
47
57
  }
48
58
  }
49
59
 
50
- Spree.fillStates = function (data, region) {
60
+ Spree.fillStates = function(data, region) {
51
61
  var selected
52
62
  var statesRequired = data.states_required
53
63
  var states = data.states
54
64
  var statePara = $('#' + region + 'state')
55
65
  var stateSelect = statePara.find('select')
56
66
  var stateInput = statePara.find('input')
67
+ var stateLabel = statePara.find('label')
68
+ var stateSelectImg = statePara.find('img')
57
69
  var stateSpanRequired = statePara.find('abbr')
58
70
 
59
71
  if (states.length > 0) {
60
72
  selected = parseInt(stateSelect.val())
61
73
  stateSelect.html('')
62
- $.each(states, function (idx, state) {
74
+ $.each(states, function(idx, state) {
63
75
  var opt = $(document.createElement('option')).attr('value', state.id).html(state.name)
64
76
  if (selected.toString(10) === state.id.toString(10)) {
65
77
  opt.prop('selected', true)
66
78
  }
67
79
  stateSelect.append(opt)
68
80
  })
69
- stateSelect.prop('required', false)
70
- stateSelect.prop('disabled', false).show()
71
- stateInput.hide().prop('disabled', true)
72
- statePara.show()
73
- stateSpanRequired.hide()
74
- stateSelect.removeClass('required')
81
+ // If States are listed for the Country selected kill the input field
82
+ stateInput.hide()
83
+ .prop('disabled', true)
84
+ .prop('required', false)
85
+ .val('')
75
86
 
76
- if (statesRequired) {
77
- stateSelect.addClass('required')
78
- stateSpanRequired.show()
79
- stateSelect.prop('required', true)
80
- }
81
- stateSelect.removeClass('hidden')
82
- stateInput.removeClass('required')
87
+ // Activate the State select dropdown.
88
+ statePara.show()
89
+ stateSelect.prop('required', statesRequired)
90
+ .prop('disabled', false)
91
+ .show()
92
+ stateSelectImg.show()
93
+ stateLabel.addClass('state-select-label')
94
+ stateSpanRequired.toggle(statesRequired)
83
95
  } else {
84
- stateSelect.hide().prop('disabled', true)
85
- stateInput.show()
96
+ // If no States are listed in the database for the country selected
97
+ // and a State is not required => (United Kingdom).
98
+ // Kill the State selector and input field.
99
+ stateSelectImg.hide()
100
+ stateSelect.hide()
101
+ .prop('disabled', true)
102
+ .prop('required', false)
103
+ .find('option').remove()
104
+
105
+ stateInput.prop('disabled', true)
106
+ .prop('required', false)
107
+ .hide()
108
+
109
+ // Toggle visibility of States parent element based on State required.
110
+ statePara.toggle(statesRequired)
111
+
86
112
  if (statesRequired) {
113
+ // If a State is required, but none are listed in the database
114
+ // for the country selected => (Hong Kong)
115
+ // Enable the State input field, set it to required.
116
+ stateInput.show()
117
+ .prop('disabled', false)
118
+ .prop('required', true)
87
119
  stateSpanRequired.show()
88
- stateInput.addClass('required form-control')
89
- } else {
90
- stateInput.val('')
91
- stateSpanRequired.hide()
92
- stateInput.removeClass('required')
120
+ stateLabel.removeClass('state-select-label') // required for floating label
93
121
  }
94
- statePara.toggle(!!statesRequired)
95
- stateInput.prop('disabled', !statesRequired)
96
- stateInput.removeClass('hidden')
97
- stateSelect.removeClass('required')
98
122
  }
99
123
  }
100
- $('#bcountry select').change(function () {
124
+ $('#bcountry select').change(function() {
101
125
  Spree.updateState('b')
102
126
  })
103
- $('#scountry select').change(function () {
127
+ $('#scountry select').change(function() {
104
128
  Spree.updateState('s')
105
129
  })
106
130
  Spree.updateState('b')
107
131
 
108
132
  var orderUseBilling = $('input#order_use_billing')
109
- orderUseBilling.change(function () {
133
+ orderUseBilling.change(function() {
110
134
  updateShippingFormState(orderUseBilling)
111
135
  })
112
136
  updateShippingFormState(orderUseBilling)
113
137
  }
114
- function updateShippingFormState (orderUseBilling) {
138
+
139
+ function updateShippingFormState(orderUseBilling) {
115
140
  if (orderUseBilling.is(':checked')) {
116
141
  $('#shipping .inner').hide()
117
142
  $('#shipping .inner input, #shipping .inner select').prop('disabled', true)
@@ -121,7 +146,8 @@ Spree.ready(function ($) {
121
146
  Spree.updateState('s')
122
147
  }
123
148
  }
124
- function getCountryId (region) {
149
+
150
+ function getCountryId(region) {
125
151
  return $('#' + region + 'country select').val()
126
152
  }
127
153
  }
@@ -1,45 +1,72 @@
1
+ /* global Cleave */
2
+ var CARD_NUMBER_SELECTOR = '.cardNumber'
3
+ var CARD_EXPIRATION_SELECTOR = '.cardExpiry'
4
+ var CARD_CODE_SELECTOR = '.cardCode'
5
+
1
6
  //= require spree/frontend/coupon_manager
2
7
  Spree.ready(function ($) {
3
8
  Spree.onPayment = function () {
4
9
  if ($('#checkout_form_payment').length) {
5
10
  if ($('#existing_cards').length) {
6
- $('#existing_cards').hide()
7
11
  $('#payment-methods').hide()
8
- $("#payment-method-fields label[data-type='card']").click(function() {
9
- $('#existing_cards').show()
10
- $('.payment-sources').show()
11
- $('.existing-cc-radio').first().prop('checked', true)
12
- })
13
- $("#payment-method-fields label:not([data-type='card'])").click(function() {
14
- $('#existing_cards').hide()
15
- $('#payment-methods').hide()
16
- $('.payment-sources').hide()
17
- $('.existing-cc-radio').prop('checked', false)
18
- $('#use_existing_card_no').prop('checked', false)
19
- })
20
12
  $('.existing-cc-radio').click(function () {
21
13
  $(this).prop('checked', true)
22
14
  $('#use_existing_card_no').prop('checked', false)
23
15
  $('#use_existing_card_yes').prop('checked', true)
24
16
  $('#payment-methods').hide()
17
+ Spree.enableSave()
25
18
  })
26
19
  $('#use_existing_card_no').click(function () {
27
20
  $('#payment-methods').show()
28
21
  $('.existing-cc-radio').prop('checked', false)
29
22
  $('#use_existing_card_yes').prop('checked', false)
23
+ Spree.enableSave()
30
24
  })
31
25
  }
32
- $('.cardNumber').payment('formatCardNumber')
33
- $('.cardExpiry').payment('formatCardExpiry')
34
- $('.cardCode').payment('formatCardCVC')
35
- $('.cardNumber').change(function () {
36
- $(this).parent().siblings('.ccType').val($.payment.cardType(this.value))
37
- })
26
+
27
+ if ($(CARD_NUMBER_SELECTOR).length > 0 &&
28
+ $(CARD_EXPIRATION_SELECTOR).length > 0 &&
29
+ $(CARD_CODE_SELECTOR).length > 0) {
30
+ /* eslint-disable no-new */
31
+ new Cleave(CARD_NUMBER_SELECTOR, {
32
+ creditCard: true,
33
+ onCreditCardTypeChanged: function (type) {
34
+ $('.ccType').val(type)
35
+ }
36
+ })
37
+ /* eslint-disable no-new */
38
+ new Cleave(CARD_EXPIRATION_SELECTOR, {
39
+ date: true,
40
+ datePattern: ['m', 'Y']
41
+ })
42
+ /* eslint-disable no-new */
43
+ new Cleave(CARD_CODE_SELECTOR, {
44
+ numericOnly: true,
45
+ blocks: [3]
46
+ })
47
+ }
48
+
38
49
  $('input[type="radio"][name="order[payments_attributes][][payment_method_id]"]').click(function () {
39
- if ($('#payment_method_' + this.value).find('fieldset').children().length == 0) {
40
- $('.payment-sources').hide()
41
- } else {
42
- $('.payment-sources').show()
50
+ $('#payment-methods').hide()
51
+ $('.payment-sources').hide()
52
+ Spree.enableSave()
53
+ if ($('#payment_method_' + this.value).find('fieldset').children().length !== 0) {
54
+ if (this.closest('label').dataset.type === 'card') {
55
+ if ($('#existing_cards').length) {
56
+ $('.existing-cc-radio').first().prop('checked', true);
57
+ $('#use_existing_card_no').prop('checked', false)
58
+ $('#use_existing_card_yes').prop('checked', true)
59
+ $('#existing_cards').show();
60
+ $('#payment-methods').hide();
61
+ $('.payment-sources').show()
62
+ }
63
+ } else {
64
+ $('.existing-cc-radio').prop('checked', false);
65
+ $('#use_existing_card_no').prop('checked', false);
66
+ $('#existing_cards').hide();
67
+ $('#payment-methods').show();
68
+ $('.payment-sources').show()
69
+ }
43
70
  }
44
71
  $('#payment-methods li').hide()
45
72
  if (this.checked) {
@@ -0,0 +1,5 @@
1
+ Spree.ready(function ($) {
2
+ $('#new_spree_user').on('submit', function() {
3
+ sessionStorage.setItem('page-invalidated', 'true')
4
+ })
5
+ })
@@ -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
+ })
@@ -0,0 +1,13 @@
1
+ Spree.ready(function () {
2
+ return $('#currency').on('change', function() {
3
+ return $.ajax({
4
+ type: 'GET',
5
+ url: $(this).data('href'),
6
+ data: {
7
+ currency: $(this).val()
8
+ }
9
+ }).done(function () {
10
+ window.location.reload()
11
+ })
12
+ })
13
+ })
@@ -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) {
@@ -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
1
  //= require spree/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) {
@@ -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
  }
@@ -220,7 +251,12 @@ function CartForm($, $cartForm) {
220
251
 
221
252
  if (!variant) return
222
253
 
254
+ var shouldDisplayCompareAtPrice = variant.should_display_compare_at_price
255
+
223
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,21 +279,24 @@ 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
301
  // https://github.com/spree/spree/blob/master/api/docs/v2/storefront/index.yaml#L42
263
302
  function(response) {
@@ -291,4 +330,8 @@ Spree.ready(function($) {
291
330
 
292
331
  CartForm($, $cartForm)
293
332
  })
333
+
334
+ document.addEventListener('turbolinks:request-start', function () {
335
+ Spree.hideProductAddedModal()
336
+ })
294
337
  })