solidus_frontend 1.1.4 → 1.2.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_frontend might be problematic. Click here for more details.

Files changed (283) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/icons/delete.png +0 -0
  3. data/app/assets/images/spree/frontend/cart.png +0 -0
  4. data/app/assets/javascripts/spree/frontend/checkout/address.js.coffee +0 -3
  5. data/app/assets/stylesheets/spree/frontend/screen.css.scss +0 -6
  6. data/app/controllers/spree/checkout_controller.rb +22 -3
  7. data/app/controllers/spree/orders_controller.rb +1 -1
  8. data/app/views/spree/address/_form.html.erb +15 -15
  9. data/app/views/spree/checkout/payment/_gateway.html.erb +4 -5
  10. data/app/views/spree/shared/_main_nav_bar.html.erb +1 -1
  11. data/app/views/spree/taxons/show.html.erb +0 -0
  12. data/lib/spree/frontend.rb +0 -3
  13. data/solidus_frontend.gemspec +4 -6
  14. data/spec/controllers/controller_helpers_spec.rb +1 -2
  15. data/spec/controllers/spree/checkout_controller_spec.rb +50 -49
  16. data/spec/controllers/spree/checkout_controller_with_views_spec.rb +1 -1
  17. data/spec/controllers/spree/orders_controller_spec.rb +1 -1
  18. data/spec/controllers/spree/orders_controller_transitions_spec.rb +1 -1
  19. data/spec/controllers/spree/products_controller_spec.rb +3 -3
  20. data/spec/features/cart_spec.rb +2 -2
  21. data/spec/features/checkout_spec.rb +8 -45
  22. data/spec/features/currency_spec.rb +2 -2
  23. data/spec/features/free_shipping_promotions_spec.rb +1 -1
  24. data/spec/features/order_spec.rb +4 -6
  25. data/spec/features/products_spec.rb +1 -5
  26. data/spec/features/taxons_spec.rb +2 -2
  27. data/spec/helpers/base_helper_spec.rb +1 -1
  28. data/spec/spec_helper.rb +1 -0
  29. data/spec/views/spree/checkout/_summary_spec.rb +3 -5
  30. metadata +9 -290
  31. data/app/assets/images/spree/frontend/select_arrow.gif +0 -0
  32. data/vendor/assets/images/datepicker/cal.gif +0 -0
  33. data/vendor/assets/images/flags/ad.png +0 -0
  34. data/vendor/assets/images/flags/ae.png +0 -0
  35. data/vendor/assets/images/flags/af.png +0 -0
  36. data/vendor/assets/images/flags/ag.png +0 -0
  37. data/vendor/assets/images/flags/ai.png +0 -0
  38. data/vendor/assets/images/flags/al.png +0 -0
  39. data/vendor/assets/images/flags/am.png +0 -0
  40. data/vendor/assets/images/flags/an.png +0 -0
  41. data/vendor/assets/images/flags/ao.png +0 -0
  42. data/vendor/assets/images/flags/ar.png +0 -0
  43. data/vendor/assets/images/flags/as.png +0 -0
  44. data/vendor/assets/images/flags/at.png +0 -0
  45. data/vendor/assets/images/flags/au.png +0 -0
  46. data/vendor/assets/images/flags/aw.png +0 -0
  47. data/vendor/assets/images/flags/ax.png +0 -0
  48. data/vendor/assets/images/flags/az.png +0 -0
  49. data/vendor/assets/images/flags/ba.png +0 -0
  50. data/vendor/assets/images/flags/bb.png +0 -0
  51. data/vendor/assets/images/flags/bd.png +0 -0
  52. data/vendor/assets/images/flags/be.png +0 -0
  53. data/vendor/assets/images/flags/bf.png +0 -0
  54. data/vendor/assets/images/flags/bg.png +0 -0
  55. data/vendor/assets/images/flags/bh.png +0 -0
  56. data/vendor/assets/images/flags/bi.png +0 -0
  57. data/vendor/assets/images/flags/bj.png +0 -0
  58. data/vendor/assets/images/flags/bm.png +0 -0
  59. data/vendor/assets/images/flags/bn.png +0 -0
  60. data/vendor/assets/images/flags/bo.png +0 -0
  61. data/vendor/assets/images/flags/br.png +0 -0
  62. data/vendor/assets/images/flags/bs.png +0 -0
  63. data/vendor/assets/images/flags/bt.png +0 -0
  64. data/vendor/assets/images/flags/bv.png +0 -0
  65. data/vendor/assets/images/flags/bw.png +0 -0
  66. data/vendor/assets/images/flags/by.png +0 -0
  67. data/vendor/assets/images/flags/bz.png +0 -0
  68. data/vendor/assets/images/flags/ca.png +0 -0
  69. data/vendor/assets/images/flags/catalonia.png +0 -0
  70. data/vendor/assets/images/flags/cc.png +0 -0
  71. data/vendor/assets/images/flags/cd.png +0 -0
  72. data/vendor/assets/images/flags/cf.png +0 -0
  73. data/vendor/assets/images/flags/cg.png +0 -0
  74. data/vendor/assets/images/flags/ch.png +0 -0
  75. data/vendor/assets/images/flags/ci.png +0 -0
  76. data/vendor/assets/images/flags/ck.png +0 -0
  77. data/vendor/assets/images/flags/cl.png +0 -0
  78. data/vendor/assets/images/flags/cm.png +0 -0
  79. data/vendor/assets/images/flags/cn.png +0 -0
  80. data/vendor/assets/images/flags/co.png +0 -0
  81. data/vendor/assets/images/flags/cr.png +0 -0
  82. data/vendor/assets/images/flags/cs.png +0 -0
  83. data/vendor/assets/images/flags/cu.png +0 -0
  84. data/vendor/assets/images/flags/cv.png +0 -0
  85. data/vendor/assets/images/flags/cx.png +0 -0
  86. data/vendor/assets/images/flags/cy.png +0 -0
  87. data/vendor/assets/images/flags/cz.png +0 -0
  88. data/vendor/assets/images/flags/de.png +0 -0
  89. data/vendor/assets/images/flags/dj.png +0 -0
  90. data/vendor/assets/images/flags/dk.png +0 -0
  91. data/vendor/assets/images/flags/dm.png +0 -0
  92. data/vendor/assets/images/flags/do.png +0 -0
  93. data/vendor/assets/images/flags/dz.png +0 -0
  94. data/vendor/assets/images/flags/ec.png +0 -0
  95. data/vendor/assets/images/flags/ee.png +0 -0
  96. data/vendor/assets/images/flags/eg.png +0 -0
  97. data/vendor/assets/images/flags/eh.png +0 -0
  98. data/vendor/assets/images/flags/england.png +0 -0
  99. data/vendor/assets/images/flags/er.png +0 -0
  100. data/vendor/assets/images/flags/es.png +0 -0
  101. data/vendor/assets/images/flags/et.png +0 -0
  102. data/vendor/assets/images/flags/europeanunion.png +0 -0
  103. data/vendor/assets/images/flags/fam.png +0 -0
  104. data/vendor/assets/images/flags/fi.png +0 -0
  105. data/vendor/assets/images/flags/fj.png +0 -0
  106. data/vendor/assets/images/flags/fk.png +0 -0
  107. data/vendor/assets/images/flags/fm.png +0 -0
  108. data/vendor/assets/images/flags/fo.png +0 -0
  109. data/vendor/assets/images/flags/fr.png +0 -0
  110. data/vendor/assets/images/flags/ga.png +0 -0
  111. data/vendor/assets/images/flags/gb.png +0 -0
  112. data/vendor/assets/images/flags/gd.png +0 -0
  113. data/vendor/assets/images/flags/ge.png +0 -0
  114. data/vendor/assets/images/flags/gf.png +0 -0
  115. data/vendor/assets/images/flags/gh.png +0 -0
  116. data/vendor/assets/images/flags/gi.png +0 -0
  117. data/vendor/assets/images/flags/gl.png +0 -0
  118. data/vendor/assets/images/flags/gm.png +0 -0
  119. data/vendor/assets/images/flags/gn.png +0 -0
  120. data/vendor/assets/images/flags/gp.png +0 -0
  121. data/vendor/assets/images/flags/gq.png +0 -0
  122. data/vendor/assets/images/flags/gr.png +0 -0
  123. data/vendor/assets/images/flags/gs.png +0 -0
  124. data/vendor/assets/images/flags/gt.png +0 -0
  125. data/vendor/assets/images/flags/gu.png +0 -0
  126. data/vendor/assets/images/flags/gw.png +0 -0
  127. data/vendor/assets/images/flags/gy.png +0 -0
  128. data/vendor/assets/images/flags/hk.png +0 -0
  129. data/vendor/assets/images/flags/hm.png +0 -0
  130. data/vendor/assets/images/flags/hn.png +0 -0
  131. data/vendor/assets/images/flags/hr.png +0 -0
  132. data/vendor/assets/images/flags/ht.png +0 -0
  133. data/vendor/assets/images/flags/hu.png +0 -0
  134. data/vendor/assets/images/flags/id.png +0 -0
  135. data/vendor/assets/images/flags/ie.png +0 -0
  136. data/vendor/assets/images/flags/il.png +0 -0
  137. data/vendor/assets/images/flags/in.png +0 -0
  138. data/vendor/assets/images/flags/io.png +0 -0
  139. data/vendor/assets/images/flags/iq.png +0 -0
  140. data/vendor/assets/images/flags/ir.png +0 -0
  141. data/vendor/assets/images/flags/is.png +0 -0
  142. data/vendor/assets/images/flags/it.png +0 -0
  143. data/vendor/assets/images/flags/ja.png +0 -0
  144. data/vendor/assets/images/flags/jm.png +0 -0
  145. data/vendor/assets/images/flags/jo.png +0 -0
  146. data/vendor/assets/images/flags/ke.png +0 -0
  147. data/vendor/assets/images/flags/kg.png +0 -0
  148. data/vendor/assets/images/flags/kh.png +0 -0
  149. data/vendor/assets/images/flags/ki.png +0 -0
  150. data/vendor/assets/images/flags/km.png +0 -0
  151. data/vendor/assets/images/flags/kn.png +0 -0
  152. data/vendor/assets/images/flags/kp.png +0 -0
  153. data/vendor/assets/images/flags/kr.png +0 -0
  154. data/vendor/assets/images/flags/kw.png +0 -0
  155. data/vendor/assets/images/flags/ky.png +0 -0
  156. data/vendor/assets/images/flags/kz.png +0 -0
  157. data/vendor/assets/images/flags/la.png +0 -0
  158. data/vendor/assets/images/flags/lb.png +0 -0
  159. data/vendor/assets/images/flags/lc.png +0 -0
  160. data/vendor/assets/images/flags/li.png +0 -0
  161. data/vendor/assets/images/flags/lk.png +0 -0
  162. data/vendor/assets/images/flags/lr.png +0 -0
  163. data/vendor/assets/images/flags/ls.png +0 -0
  164. data/vendor/assets/images/flags/lt.png +0 -0
  165. data/vendor/assets/images/flags/lu.png +0 -0
  166. data/vendor/assets/images/flags/lv.png +0 -0
  167. data/vendor/assets/images/flags/ly.png +0 -0
  168. data/vendor/assets/images/flags/ma.png +0 -0
  169. data/vendor/assets/images/flags/mc.png +0 -0
  170. data/vendor/assets/images/flags/md.png +0 -0
  171. data/vendor/assets/images/flags/me.png +0 -0
  172. data/vendor/assets/images/flags/mg.png +0 -0
  173. data/vendor/assets/images/flags/mh.png +0 -0
  174. data/vendor/assets/images/flags/mk.png +0 -0
  175. data/vendor/assets/images/flags/ml.png +0 -0
  176. data/vendor/assets/images/flags/mm.png +0 -0
  177. data/vendor/assets/images/flags/mn.png +0 -0
  178. data/vendor/assets/images/flags/mo.png +0 -0
  179. data/vendor/assets/images/flags/mp.png +0 -0
  180. data/vendor/assets/images/flags/mq.png +0 -0
  181. data/vendor/assets/images/flags/mr.png +0 -0
  182. data/vendor/assets/images/flags/ms.png +0 -0
  183. data/vendor/assets/images/flags/mt.png +0 -0
  184. data/vendor/assets/images/flags/mu.png +0 -0
  185. data/vendor/assets/images/flags/mv.png +0 -0
  186. data/vendor/assets/images/flags/mw.png +0 -0
  187. data/vendor/assets/images/flags/mx.png +0 -0
  188. data/vendor/assets/images/flags/my.png +0 -0
  189. data/vendor/assets/images/flags/mz.png +0 -0
  190. data/vendor/assets/images/flags/na.png +0 -0
  191. data/vendor/assets/images/flags/nc.png +0 -0
  192. data/vendor/assets/images/flags/ne.png +0 -0
  193. data/vendor/assets/images/flags/nf.png +0 -0
  194. data/vendor/assets/images/flags/ng.png +0 -0
  195. data/vendor/assets/images/flags/ni.png +0 -0
  196. data/vendor/assets/images/flags/nl.png +0 -0
  197. data/vendor/assets/images/flags/no.png +0 -0
  198. data/vendor/assets/images/flags/np.png +0 -0
  199. data/vendor/assets/images/flags/nr.png +0 -0
  200. data/vendor/assets/images/flags/nu.png +0 -0
  201. data/vendor/assets/images/flags/nz.png +0 -0
  202. data/vendor/assets/images/flags/om.png +0 -0
  203. data/vendor/assets/images/flags/pa.png +0 -0
  204. data/vendor/assets/images/flags/pe.png +0 -0
  205. data/vendor/assets/images/flags/pf.png +0 -0
  206. data/vendor/assets/images/flags/pg.png +0 -0
  207. data/vendor/assets/images/flags/ph.png +0 -0
  208. data/vendor/assets/images/flags/pk.png +0 -0
  209. data/vendor/assets/images/flags/pl.png +0 -0
  210. data/vendor/assets/images/flags/pm.png +0 -0
  211. data/vendor/assets/images/flags/pn.png +0 -0
  212. data/vendor/assets/images/flags/pr.png +0 -0
  213. data/vendor/assets/images/flags/ps.png +0 -0
  214. data/vendor/assets/images/flags/pt.png +0 -0
  215. data/vendor/assets/images/flags/pw.png +0 -0
  216. data/vendor/assets/images/flags/py.png +0 -0
  217. data/vendor/assets/images/flags/qa.png +0 -0
  218. data/vendor/assets/images/flags/re.png +0 -0
  219. data/vendor/assets/images/flags/ro.png +0 -0
  220. data/vendor/assets/images/flags/rs.png +0 -0
  221. data/vendor/assets/images/flags/ru.png +0 -0
  222. data/vendor/assets/images/flags/rw.png +0 -0
  223. data/vendor/assets/images/flags/sa.png +0 -0
  224. data/vendor/assets/images/flags/sb.png +0 -0
  225. data/vendor/assets/images/flags/sc.png +0 -0
  226. data/vendor/assets/images/flags/scotland.png +0 -0
  227. data/vendor/assets/images/flags/sd.png +0 -0
  228. data/vendor/assets/images/flags/se.png +0 -0
  229. data/vendor/assets/images/flags/sg.png +0 -0
  230. data/vendor/assets/images/flags/sh.png +0 -0
  231. data/vendor/assets/images/flags/si.png +0 -0
  232. data/vendor/assets/images/flags/sj.png +0 -0
  233. data/vendor/assets/images/flags/sk.png +0 -0
  234. data/vendor/assets/images/flags/sl.png +0 -0
  235. data/vendor/assets/images/flags/sm.png +0 -0
  236. data/vendor/assets/images/flags/sn.png +0 -0
  237. data/vendor/assets/images/flags/so.png +0 -0
  238. data/vendor/assets/images/flags/sr.png +0 -0
  239. data/vendor/assets/images/flags/st.png +0 -0
  240. data/vendor/assets/images/flags/sv.png +0 -0
  241. data/vendor/assets/images/flags/sy.png +0 -0
  242. data/vendor/assets/images/flags/sz.png +0 -0
  243. data/vendor/assets/images/flags/tc.png +0 -0
  244. data/vendor/assets/images/flags/td.png +0 -0
  245. data/vendor/assets/images/flags/tf.png +0 -0
  246. data/vendor/assets/images/flags/tg.png +0 -0
  247. data/vendor/assets/images/flags/th.png +0 -0
  248. data/vendor/assets/images/flags/tj.png +0 -0
  249. data/vendor/assets/images/flags/tk.png +0 -0
  250. data/vendor/assets/images/flags/tl.png +0 -0
  251. data/vendor/assets/images/flags/tm.png +0 -0
  252. data/vendor/assets/images/flags/tn.png +0 -0
  253. data/vendor/assets/images/flags/to.png +0 -0
  254. data/vendor/assets/images/flags/tr.png +0 -0
  255. data/vendor/assets/images/flags/tt.png +0 -0
  256. data/vendor/assets/images/flags/tv.png +0 -0
  257. data/vendor/assets/images/flags/tw.png +0 -0
  258. data/vendor/assets/images/flags/tz.png +0 -0
  259. data/vendor/assets/images/flags/ua.png +0 -0
  260. data/vendor/assets/images/flags/ug.png +0 -0
  261. data/vendor/assets/images/flags/um.png +0 -0
  262. data/vendor/assets/images/flags/us.png +0 -0
  263. data/vendor/assets/images/flags/uy.png +0 -0
  264. data/vendor/assets/images/flags/uz.png +0 -0
  265. data/vendor/assets/images/flags/va.png +0 -0
  266. data/vendor/assets/images/flags/vc.png +0 -0
  267. data/vendor/assets/images/flags/ve.png +0 -0
  268. data/vendor/assets/images/flags/vg.png +0 -0
  269. data/vendor/assets/images/flags/vi.png +0 -0
  270. data/vendor/assets/images/flags/vn.png +0 -0
  271. data/vendor/assets/images/flags/vu.png +0 -0
  272. data/vendor/assets/images/flags/wales.png +0 -0
  273. data/vendor/assets/images/flags/wf.png +0 -0
  274. data/vendor/assets/images/flags/ws.png +0 -0
  275. data/vendor/assets/images/flags/ye.png +0 -0
  276. data/vendor/assets/images/flags/yt.png +0 -0
  277. data/vendor/assets/images/flags/za.png +0 -0
  278. data/vendor/assets/images/flags/zm.png +0 -0
  279. data/vendor/assets/images/flags/zw.png +0 -0
  280. data/vendor/assets/images/jquery.formalize/button.png +0 -0
  281. data/vendor/assets/images/jquery.formalize/select_arrow.gif +0 -0
  282. data/vendor/assets/javascripts/jquery.formalize.min.js +0 -1
  283. data/vendor/assets/stylesheets/jquery.formalize.css.erb +0 -363
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63bfa9f673c5ba3f399dd3c643b1f231651b5533
4
- data.tar.gz: 1d781adb44a73c8e505285962a4a4cd8065ecd73
3
+ metadata.gz: 014616c55d9c2f1cedf9a12976a11155ccaf89b4
4
+ data.tar.gz: e684794f24c5a6aea4bb452b3c9fe4946f20edfa
5
5
  SHA512:
6
- metadata.gz: c5772895992c212862e2c0880a9be288c2340f778a0bd8228b3c3401e7a0d9e514d945e76d1b56fa7ad1a5999a858e3e6c76dfcd31b4144ef9e5d5c639f93d02
7
- data.tar.gz: 56b83d75ec28b5aff1f644b08b05fabf31682339617dd04263713c2d405b8c86b4a97f2f6c60fead48f1fd743c501daa9fa59015864a71b8ca2c25b2abe4df95
6
+ metadata.gz: 2499b1edebd95397a8bbd722fff282fa8a690aeefdd942bb36e1d76cea39422dcafbba3e1edf3a50e5873aac8f6f5fafa614b6a5630e02a351ef71dc4f1e435d
7
+ data.tar.gz: 2315833e9e0238c35237a51a0462da8ac0ce5ce9b73a6f5220abfb1c49a8318c8f9ab13457599004d916acb389119a779866754761dca40e51906fd5ad88d037
File without changes
File without changes
@@ -1,8 +1,5 @@
1
1
  $ ->
2
2
  if $('#checkout_form_address').is('*')
3
- # Hidden by default to support browsers with javascript disabled
4
- $('.js-address-fields').show()
5
-
6
3
  $('#checkout_form_address').validate()
7
4
 
8
5
  getCountryId = (region) ->
@@ -343,12 +343,6 @@ nav #main-nav-bar {
343
343
  }
344
344
  }
345
345
 
346
- figure#logo {
347
- img {
348
- padding-top:25px;
349
- }
350
- }
351
-
352
346
  nav#taxonomies {
353
347
  .taxonomy-root {
354
348
  text-transform: uppercase;
@@ -25,8 +25,7 @@ module Spree
25
25
 
26
26
  # Updates the order and advances to the next state (when possible.)
27
27
  def update
28
- massaged_params = move_payment_source_into_payments_attributes(params)
29
- if @order.update_from_params(massaged_params, permitted_checkout_attributes, request.headers.env)
28
+ if OrderUpdateAttributes.new(@order, update_params, request_env: request.headers.env).apply
30
29
  @order.temporary_address = !params[:save_user_address]
31
30
  success = if @order.state == 'confirm'
32
31
  @order.complete
@@ -52,6 +51,26 @@ module Spree
52
51
  end
53
52
 
54
53
  private
54
+
55
+ def update_params
56
+ if update_params = massaged_params[:order]
57
+ update_params.permit(permitted_checkout_attributes)
58
+ else
59
+ # We current allow update requests without any parameters in them.
60
+ {}
61
+ end
62
+ end
63
+
64
+ def massaged_params
65
+ massaged_params = params.deep_dup
66
+
67
+ move_payment_source_into_payments_attributes(massaged_params)
68
+ move_existing_card_into_payments_attributes(massaged_params)
69
+ set_payment_parameters_amount(massaged_params, @order)
70
+
71
+ massaged_params
72
+ end
73
+
55
74
  def ensure_valid_state
56
75
  unless skip_state_validation?
57
76
  if (params[:state] && !@order.has_checkout_step?(params[:state])) ||
@@ -61,7 +80,7 @@ module Spree
61
80
  end
62
81
  end
63
82
 
64
- # Fix for #4117
83
+ # Fix for https://github.com/spree/spree/issues/4117
65
84
  # If confirmation of payment fails, redirect back to payment screen
66
85
  if params[:state] == "confirm" && @order.payment_required? && @order.payments.valid.empty?
67
86
  flash.keep
@@ -45,7 +45,7 @@ module Spree
45
45
  variant = Spree::Variant.find(params[:variant_id])
46
46
  quantity = params[:quantity].to_i
47
47
 
48
- # 2,147,483,647 is crazy. See issue #2695.
48
+ # 2,147,483,647 is crazy. See issue https://github.com/spree/spree/issues/2695.
49
49
  if quantity.between?(1, 2_147_483_647)
50
50
  begin
51
51
  order.contents.add(variant, quantity)
@@ -38,24 +38,24 @@
38
38
  <% have_states = !address.country.states.empty? %>
39
39
  <%= form.label :state, Spree.t(:state) %><span class='required' id=<%="#{address_id}state-required"%>>*</span><br/>
40
40
 
41
- <span class="js-address-fields" style="display: none;">
42
- <%= form.collection_select(
43
- :state_id, address.country.states, :id, :name,
44
- {include_blank: true},
45
- {
46
- class: have_states ? 'required' : 'hidden',
47
- disabled: !have_states
48
- }) %>
49
- <%= form.text_field(
50
- :state_name,
51
- class: !have_states ? 'required' : 'hidden',
52
- disabled: have_states) %>
53
- </span>
54
-
41
+ <% state_elements = [
42
+ form.collection_select(:state_id, address.country.states,
43
+ :id, :name,
44
+ {:include_blank => true},
45
+ {:class => have_states ? 'required' : 'hidden',
46
+ :disabled => !have_states}) +
47
+ form.text_field(:state_name,
48
+ :class => !have_states ? 'required' : 'hidden',
49
+ :disabled => have_states)
50
+ ].join.gsub('"', "'").gsub("\n", "")
51
+ %>
52
+ <%= javascript_tag do -%>
53
+ $('#<%="#{address_id}state" %>').append("<%== state_elements %>");
54
+ <% end %>
55
+ </p>
55
56
  <noscript>
56
57
  <%= form.text_field :state_name, :class => 'required' %>
57
58
  </noscript>
58
- </p>
59
59
  <% end %>
60
60
 
61
61
  <p class="field" id=<%="#{address_id}zipcode" %>>
@@ -3,13 +3,12 @@
3
3
 
4
4
  <p class="field">
5
5
  <%= label_tag "name_on_card_#{payment_method.id}", Spree.t(:name_on_card) %><span class="required">*</span><br />
6
- <%= text_field_tag "#{param_prefix}[name]", "#{@order.billing_firstname} #{@order.billing_lastname}", { id: "name_on_card_#{payment_method.id}"} %>
6
+ <%= text_field_tag "#{param_prefix}[name]", "#{@order.billing_firstname} #{@order.billing_lastname}", { id: "name_on_card_#{payment_method.id}", :autocomplete => "cc-name" } %>
7
7
  </p>
8
8
 
9
9
  <p class="field" data-hook="card_number">
10
10
  <%= label_tag "card_number", Spree.t(:card_number) %><span class="required">*</span><br />
11
- <% options_hash = Rails.env.production? ? {:autocomplete => 'off'} : {} %>
12
- <%= text_field_tag "#{param_prefix}[number]", '', options_hash.merge(:id => 'card_number', :class => 'required cardNumber', :size => 19, :maxlength => 19, :autocomplete => "off") %>
11
+ <%= text_field_tag "#{param_prefix}[number]", '', {:id => 'card_number', :class => 'required cardNumber', :size => 19, :maxlength => 19, :autocomplete => "cc-number", type: "tel"} %>
13
12
  &nbsp;
14
13
  <span id="card_type" style="display:none;">
15
14
  ( <span id="looks_like" ><%= Spree.t(:card_type_is) %> <span id="type"></span></span>
@@ -20,12 +19,12 @@
20
19
 
21
20
  <p class="field" data-hook="card_expiration">
22
21
  <%= label_tag "card_expiry", Spree.t(:expiration) %><span class="required">*</span><br />
23
- <%= text_field_tag "#{param_prefix}[expiry]", '', :id => 'card_expiry', :class => "required cardExpiry", :placeholder => "MM / YY" %>
22
+ <%= text_field_tag "#{param_prefix}[expiry]", '', :id => 'card_expiry', :class => "required cardExpiry", :placeholder => "MM / YY", type: "tel" %>
24
23
  </p>
25
24
 
26
25
  <p class="field" data-hook="card_code">
27
26
  <%= label_tag "card_code", Spree.t(:card_code) %><span class="required">*</span><br />
28
- <%= text_field_tag "#{param_prefix}[verification_value]", '', options_hash.merge(:id => 'card_code', :class => 'required cardCode', :size => 5) %>
27
+ <%= text_field_tag "#{param_prefix}[verification_value]", '', {:id => 'card_code', :class => 'required cardCode', :size => 5, type: "tel", autocomplete: "off"} %>
29
28
  <%= link_to "(#{Spree.t(:what_is_this)})", spree.cvv_path, :target => '_blank', "data-hook" => "cvv_link", :id => "cvv_link" %>
30
29
  </p>
31
30
 
@@ -7,6 +7,6 @@
7
7
  </noscript>
8
8
  &nbsp;
9
9
  </li>
10
- <script>Spree.fetch_cart('<%= j cart_link_url %>')</script>
10
+ <script>Spree.fetch_cart('<%= j spree.cart_link_url %>')</script>
11
11
  </ul>
12
12
  </nav>
File without changes
@@ -1,9 +1,6 @@
1
1
  require 'rails/all'
2
2
  require 'jquery-rails'
3
3
  require 'canonical-rails'
4
- require 'deface'
5
- require 'coffee-rails'
6
- require 'sass-rails'
7
4
 
8
5
  require 'spree/core'
9
6
 
@@ -1,10 +1,10 @@
1
1
  # encoding: UTF-8
2
- version = File.read(File.expand_path("../../SOLIDUS_VERSION", __FILE__)).strip
2
+ require_relative '../core/lib/spree/core/version.rb'
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.name = 'solidus_frontend'
7
- s.version = version
7
+ s.version = Spree.solidus_version
8
8
  s.summary = 'Cart and storefront for the Solidus e-commerce project.'
9
9
  s.description = s.summary
10
10
 
@@ -18,13 +18,11 @@ Gem::Specification.new do |s|
18
18
  s.require_path = 'lib'
19
19
  s.requirements << 'none'
20
20
 
21
- s.add_dependency 'solidus_api', version
22
- s.add_dependency 'solidus_core', version
21
+ s.add_dependency 'solidus_api', s.version
22
+ s.add_dependency 'solidus_core', s.version
23
23
 
24
24
  s.add_dependency 'canonical-rails', '~> 0.0.4'
25
25
  s.add_dependency 'jquery-rails'
26
- s.add_dependency 'sass-rails'
27
- s.add_dependency 'coffee-rails'
28
26
 
29
27
  s.add_development_dependency 'capybara-accessible'
30
28
  end
@@ -7,7 +7,6 @@ describe Spree::ProductsController, :type => :controller do
7
7
 
8
8
  before do
9
9
  I18n.enforce_available_locales = false
10
- expect(I18n).to receive(:available_locales).and_return([:en, :de])
11
10
  Spree::Frontend::Config[:locale] = :de
12
11
  end
13
12
 
@@ -17,7 +16,7 @@ describe Spree::ProductsController, :type => :controller do
17
16
  I18n.enforce_available_locales = true
18
17
  end
19
18
 
20
- # Regression test for #1184
19
+ # Regression test for https://github.com/spree/spree/issues/1184
21
20
  it "sets the default locale based off Spree::Frontend::Config[:locale]" do
22
21
  expect(I18n.locale).to eq(:en)
23
22
  spree_get :index
@@ -41,7 +41,7 @@ describe Spree::CheckoutController, :type => :controller do
41
41
  expect(response).to redirect_to(spree.cart_path)
42
42
  end
43
43
 
44
- # Regression test for #2280
44
+ # Regression test for https://github.com/spree/spree/issues/2280
45
45
  it "should redirect to current step trying to access a future step" do
46
46
  order.update_column(:state, "address")
47
47
  spree_get :edit, { :state => "delivery" }
@@ -81,17 +81,18 @@ describe Spree::CheckoutController, :type => :controller do
81
81
  }
82
82
  end
83
83
 
84
- let!(:payment_method) { create(:payment_method) }
85
84
  before do
86
85
  # Must have *a* shipping method and a payment method so updating from address works
87
- allow(order).to receive_messages ensure_available_shipping_rates: true
86
+ allow(order).to receive_messages :available_shipping_methods => [stub_model(Spree::ShippingMethod)]
87
+ allow(order).to receive_messages :available_payment_methods => [stub_model(Spree::PaymentMethod)]
88
+ allow(order).to receive_messages :ensure_available_shipping_rates => true
88
89
  order.line_items << FactoryGirl.create(:line_item)
89
90
  end
90
91
 
91
92
  context "with the order in the cart state" do
92
93
  before do
94
+ order.update_attributes! user: user
93
95
  order.update_column(:state, "cart")
94
- allow(order).to receive_messages :user => user
95
96
  end
96
97
 
97
98
  it "should assign order" do
@@ -125,24 +126,22 @@ describe Spree::CheckoutController, :type => :controller do
125
126
 
126
127
  context "current_user doesnt respond to persist_order_address" do
127
128
  it "doesnt raise any error" do
128
- expect {
129
- spree_post :update, {
130
- :state => "address",
131
- :order => {
132
- :bill_address_attributes => address_params,
133
- :use_billing => true
134
- },
135
- :save_user_address => "1"
136
- }
137
- }.to_not raise_error
129
+ spree_post :update, {
130
+ :state => "address",
131
+ :order => {
132
+ :bill_address_attributes => address_params,
133
+ :use_billing => true
134
+ },
135
+ :save_user_address => "1"
136
+ }
138
137
  end
139
138
  end
140
139
  end
141
140
 
142
141
  context "with the order in the address state" do
143
142
  before do
143
+ order.update_attributes! user: user
144
144
  order.update_columns(ship_address_id: create(:address).id, state: "address")
145
- allow(order).to receive_messages user: user
146
145
  end
147
146
 
148
147
  context "with a billing and shipping address" do
@@ -169,7 +168,24 @@ describe Spree::CheckoutController, :type => :controller do
169
168
  end
170
169
  end
171
170
 
172
- context "when in the payment state" do
171
+ # This is the only time that we need the 'set_payment_parameters_amount'
172
+ # controller code, because otherwise the transition to 'confirm' will
173
+ # trigger the 'add_store_credit_payments' transition code which will do
174
+ # the same thing here.
175
+ # Perhaps we can just remove 'set_payment_parameters_amount' entirely at
176
+ # some point?
177
+ context "when there is a checkout step between payment and confirm" do
178
+ before do
179
+ @old_checkout_flow = Spree::Order.checkout_flow
180
+ Spree::Order.class_eval do
181
+ insert_checkout_step :new_step, after: :payment
182
+ end
183
+ end
184
+
185
+ after do
186
+ Spree::Order.checkout_flow(&@old_checkout_flow)
187
+ end
188
+
173
189
  let(:order) { create(:order_with_line_items) }
174
190
  let(:payment_method) { create(:credit_card_payment_method) }
175
191
 
@@ -180,10 +196,10 @@ describe Spree::CheckoutController, :type => :controller do
180
196
  payments_attributes: [
181
197
  {
182
198
  payment_method_id: payment_method.id.to_s,
183
- source_attributes: attributes_for(:credit_card)
184
- }
185
- ]
186
- }
199
+ source_attributes: attributes_for(:credit_card),
200
+ },
201
+ ],
202
+ },
187
203
  }
188
204
  end
189
205
 
@@ -192,34 +208,19 @@ describe Spree::CheckoutController, :type => :controller do
192
208
  3.times { order.next! } # should put us in the payment state
193
209
  end
194
210
 
195
- context 'with a permitted payment method' do
196
- it 'sets the payment amount' do
197
- post :update, params
198
- order.reload
199
- expect(order.state).to eq('confirm')
200
- expect(order.payments.size).to eq(1)
201
- expect(order.payments.first.amount).to eq(order.total)
202
- end
203
- end
204
-
205
- context 'with an unpermitted payment method' do
206
- before { payment_method.update!(display_on: "back_end") }
207
-
208
- it 'sets the payment amount' do
209
- expect {
210
- post :update, params
211
- }.to raise_error(ActiveRecord::RecordNotFound)
212
-
213
- expect(order.state).to eq('payment')
214
- expect(order.payments).to be_empty
215
- end
211
+ it 'sets the payment amount' do
212
+ spree_post :update, params
213
+ order.reload
214
+ expect(order.state).to eq('new_step')
215
+ expect(order.payments.size).to eq(1)
216
+ expect(order.payments.first.amount).to eq(order.total)
216
217
  end
217
218
  end
218
219
 
219
220
  context "when in the confirm state" do
220
221
  before do
222
+ order.update_attributes! user: user
221
223
  order.update_column(:state, "confirm")
222
- allow(order).to receive_messages :user => user
223
224
  # An order requires a payment to reach the complete state
224
225
  # This is because payment_required? is true on the order
225
226
  create(:payment, :amount => order.total, :order => order)
@@ -227,7 +228,7 @@ describe Spree::CheckoutController, :type => :controller do
227
228
  order.payments.reload
228
229
  end
229
230
 
230
- # This inadvertently is a regression test for #2694
231
+ # This inadvertently is a regression test for https://github.com/spree/spree/issues/2694
231
232
  it "should redirect to the order view" do
232
233
  spree_post :update, {:state => "confirm"}
233
234
  expect(response).to redirect_to spree.order_path(order)
@@ -248,12 +249,12 @@ describe Spree::CheckoutController, :type => :controller do
248
249
 
249
250
  context "save unsuccessful" do
250
251
  before do
251
- allow(order).to receive_messages :user => user
252
- allow(order).to receive_messages :update_attributes => false
252
+ order.update_attributes! user: user
253
+ allow(order).to receive_messages valid?: false
253
254
  end
254
255
 
255
256
  it "should not assign order" do
256
- spree_post :update, {:state => "address"}
257
+ spree_post :update, {:state => "address", email: ''}
257
258
  expect(assigns[:order]).not_to be_nil
258
259
  end
259
260
 
@@ -283,8 +284,8 @@ describe Spree::CheckoutController, :type => :controller do
283
284
 
284
285
  context "Spree::Core::GatewayError" do
285
286
  before do
286
- allow(order).to receive_messages :user => user
287
- allow(order).to receive(:update_attributes).and_raise(Spree::Core::GatewayError.new("Invalid something or other."))
287
+ order.update_attributes! user: user
288
+ allow(order).to receive(:next).and_raise(Spree::Core::GatewayError.new("Invalid something or other."))
288
289
  spree_post :update, {:state => "address"}
289
290
  end
290
291
 
@@ -310,7 +311,7 @@ describe Spree::CheckoutController, :type => :controller do
310
311
 
311
312
  context "when the order is invalid" do
312
313
  before do
313
- allow(order).to receive_messages :update_attributes => true, :next => nil
314
+ allow(order).to receive_messages :valid? => true, :next => nil
314
315
  order.errors.add :base, 'Base error'
315
316
  order.errors.add :adjustments, 'error'
316
317
  end
@@ -12,7 +12,7 @@ describe Spree::CheckoutController, type: :controller do
12
12
  allow(controller).to receive_messages try_spree_current_user: user
13
13
  end
14
14
 
15
- # Regression test for #3246
15
+ # Regression test for https://github.com/spree/spree/issues/3246
16
16
  context "when using GBP" do
17
17
  before do
18
18
  Spree::Config[:currency] = "GBP"
@@ -100,7 +100,7 @@ describe Spree::OrdersController, :type => :controller do
100
100
  end
101
101
  end
102
102
 
103
- # Regression test for #2750
103
+ # Regression test for https://github.com/spree/spree/issues/2750
104
104
  context "#update" do
105
105
  before do
106
106
  allow(user).to receive :last_incomplete_spree_order