spree_frontend 3.1.14 → 3.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/logo/spree_50.png +0 -0
- data/app/assets/javascripts/spree/frontend/cart.js.coffee +14 -1
- data/app/assets/javascripts/spree/frontend/checkout/payment.js.coffee +11 -35
- data/app/assets/javascripts/spree/frontend/checkout/shipment.js.coffee +38 -0
- data/app/assets/javascripts/spree/frontend/coupon_manager.js.coffee +37 -0
- data/app/assets/stylesheets/spree/frontend/frontend_bootstrap.css.scss +3 -3
- data/app/controllers/spree/checkout_controller.rb +0 -14
- data/app/controllers/spree/content_controller.rb +3 -3
- data/app/controllers/spree/orders_controller.rb +7 -2
- data/app/controllers/spree/products_controller.rb +3 -2
- data/app/controllers/spree/store_controller.rb +0 -18
- data/app/helpers/spree/frontend_helper.rb +1 -1
- data/app/helpers/spree/orders_helper.rb +0 -9
- data/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb +1 -1
- data/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb +1 -1
- data/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb +1 -1
- data/app/views/kaminari/twitter-bootstrap-3/_page.html.erb +1 -1
- data/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb +1 -1
- data/app/views/spree/address/_form.html.erb +16 -16
- data/app/views/spree/checkout/_address.html.erb +4 -4
- data/app/views/spree/checkout/_confirm.html.erb +2 -2
- data/app/views/spree/checkout/_delivery.html.erb +5 -3
- data/app/views/spree/checkout/_payment.html.erb +3 -3
- data/app/views/spree/checkout/_summary.html.erb +3 -3
- data/app/views/spree/checkout/edit.html.erb +1 -0
- data/app/views/spree/checkout/payment/_gateway.html.erb +8 -8
- data/app/views/spree/home/index.html.erb +3 -2
- data/app/views/spree/orders/_adjustment_row.html.erb +1 -1
- data/app/views/spree/orders/_adjustments.html.erb +3 -3
- data/app/views/spree/orders/edit.html.erb +15 -2
- data/app/views/spree/products/_properties.html.erb +1 -1
- data/app/views/spree/products/index.html.erb +5 -5
- data/app/views/spree/products/show.html.erb +6 -6
- data/app/views/spree/shared/_address.html.erb +3 -1
- data/app/views/spree/shared/_error_messages.html.erb +1 -1
- data/app/views/spree/shared/_filters.html.erb +2 -2
- data/app/views/spree/shared/_google_add_items.js.erb +5 -5
- data/app/views/spree/shared/_head.html.erb +2 -0
- data/app/views/spree/shared/_header.html.erb +2 -2
- data/app/views/spree/shared/_login.html.erb +4 -4
- data/app/views/spree/shared/_nav_bar.html.erb +1 -1
- data/app/views/spree/shared/_order_details.html.erb +2 -2
- data/app/views/spree/shared/_search.html.erb +3 -3
- data/app/views/spree/shared/_translations.html.erb +7 -0
- data/config/initializers/assets.rb +1 -1
- data/config/routes.rb +1 -6
- data/lib/tasks/taxon.rake +2 -2
- data/spec/controllers/controller_extension_spec.rb +126 -0
- data/spec/controllers/controller_helpers_spec.rb +122 -0
- data/spec/controllers/spree/checkout_controller_spec.rb +462 -0
- data/spec/controllers/spree/checkout_controller_with_views_spec.rb +36 -0
- data/spec/controllers/spree/content_controller_spec.rb +12 -0
- data/spec/controllers/spree/current_order_tracking_spec.rb +44 -0
- data/spec/controllers/spree/home_controller_spec.rb +47 -0
- data/spec/controllers/spree/orders_controller_ability_spec.rb +96 -0
- data/spec/controllers/spree/orders_controller_spec.rb +134 -0
- data/spec/controllers/spree/orders_controller_transitions_spec.rb +31 -0
- data/spec/controllers/spree/products_controller_spec.rb +87 -0
- data/spec/controllers/spree/taxons_controller_spec.rb +12 -0
- data/spec/features/address_spec.rb +93 -0
- data/spec/features/automatic_promotion_adjustments_spec.rb +47 -0
- data/spec/features/caching/products_spec.rb +59 -0
- data/spec/features/caching/taxons_spec.rb +22 -0
- data/spec/features/cart_spec.rb +132 -0
- data/spec/features/checkout_spec.rb +572 -0
- data/spec/features/checkout_unshippable_spec.rb +34 -0
- data/spec/features/coupon_code_spec.rb +88 -0
- data/spec/features/currency_spec.rb +18 -0
- data/spec/features/delivery_spec.rb +64 -0
- data/spec/features/free_shipping_promotions_spec.rb +59 -0
- data/spec/features/locale_spec.rb +60 -0
- data/spec/features/microdata_spec.rb +0 -0
- data/spec/features/order_spec.rb +107 -0
- data/spec/features/page_promotions_spec.rb +36 -0
- data/spec/features/products_spec.rb +334 -0
- data/spec/features/taxons_spec.rb +147 -0
- data/spec/features/template_rendering_spec.rb +19 -0
- data/spec/helpers/frontend_helper_spec.rb +57 -0
- data/spec/helpers/taxons_helper_spec.rb +17 -0
- data/spec/spec_helper.rb +126 -0
- data/spec/support/shared_contexts/checkout_setup.rb +10 -0
- data/spec/support/shared_contexts/custom_products.rb +25 -0
- data/spec/support/shared_contexts/product_prototypes.rb +30 -0
- data/spec/views/spree/checkout/_summary_spec.rb +11 -0
- data/spree_frontend.gemspec +6 -3
- metadata +92 -263
- data/app/assets/images/flags/ad.png +0 -0
- data/app/assets/images/flags/ae.png +0 -0
- data/app/assets/images/flags/af.png +0 -0
- data/app/assets/images/flags/ag.png +0 -0
- data/app/assets/images/flags/ai.png +0 -0
- data/app/assets/images/flags/al.png +0 -0
- data/app/assets/images/flags/am.png +0 -0
- data/app/assets/images/flags/an.png +0 -0
- data/app/assets/images/flags/ao.png +0 -0
- data/app/assets/images/flags/ar.png +0 -0
- data/app/assets/images/flags/as.png +0 -0
- data/app/assets/images/flags/at.png +0 -0
- data/app/assets/images/flags/au.png +0 -0
- data/app/assets/images/flags/aw.png +0 -0
- data/app/assets/images/flags/ax.png +0 -0
- data/app/assets/images/flags/az.png +0 -0
- data/app/assets/images/flags/ba.png +0 -0
- data/app/assets/images/flags/bb.png +0 -0
- data/app/assets/images/flags/bd.png +0 -0
- data/app/assets/images/flags/be.png +0 -0
- data/app/assets/images/flags/bf.png +0 -0
- data/app/assets/images/flags/bg.png +0 -0
- data/app/assets/images/flags/bh.png +0 -0
- data/app/assets/images/flags/bi.png +0 -0
- data/app/assets/images/flags/bj.png +0 -0
- data/app/assets/images/flags/bm.png +0 -0
- data/app/assets/images/flags/bn.png +0 -0
- data/app/assets/images/flags/bo.png +0 -0
- data/app/assets/images/flags/br.png +0 -0
- data/app/assets/images/flags/bs.png +0 -0
- data/app/assets/images/flags/bt.png +0 -0
- data/app/assets/images/flags/bv.png +0 -0
- data/app/assets/images/flags/bw.png +0 -0
- data/app/assets/images/flags/by.png +0 -0
- data/app/assets/images/flags/bz.png +0 -0
- data/app/assets/images/flags/ca.png +0 -0
- data/app/assets/images/flags/catalonia.png +0 -0
- data/app/assets/images/flags/cc.png +0 -0
- data/app/assets/images/flags/cd.png +0 -0
- data/app/assets/images/flags/cf.png +0 -0
- data/app/assets/images/flags/cg.png +0 -0
- data/app/assets/images/flags/ch.png +0 -0
- data/app/assets/images/flags/ci.png +0 -0
- data/app/assets/images/flags/ck.png +0 -0
- data/app/assets/images/flags/cl.png +0 -0
- data/app/assets/images/flags/cm.png +0 -0
- data/app/assets/images/flags/cn.png +0 -0
- data/app/assets/images/flags/co.png +0 -0
- data/app/assets/images/flags/cr.png +0 -0
- data/app/assets/images/flags/cs.png +0 -0
- data/app/assets/images/flags/cu.png +0 -0
- data/app/assets/images/flags/cv.png +0 -0
- data/app/assets/images/flags/cx.png +0 -0
- data/app/assets/images/flags/cy.png +0 -0
- data/app/assets/images/flags/cz.png +0 -0
- data/app/assets/images/flags/de.png +0 -0
- data/app/assets/images/flags/dj.png +0 -0
- data/app/assets/images/flags/dk.png +0 -0
- data/app/assets/images/flags/dm.png +0 -0
- data/app/assets/images/flags/do.png +0 -0
- data/app/assets/images/flags/dz.png +0 -0
- data/app/assets/images/flags/ec.png +0 -0
- data/app/assets/images/flags/ee.png +0 -0
- data/app/assets/images/flags/eg.png +0 -0
- data/app/assets/images/flags/eh.png +0 -0
- data/app/assets/images/flags/england.png +0 -0
- data/app/assets/images/flags/er.png +0 -0
- data/app/assets/images/flags/es.png +0 -0
- data/app/assets/images/flags/et.png +0 -0
- data/app/assets/images/flags/europeanunion.png +0 -0
- data/app/assets/images/flags/fam.png +0 -0
- data/app/assets/images/flags/fi.png +0 -0
- data/app/assets/images/flags/fj.png +0 -0
- data/app/assets/images/flags/fk.png +0 -0
- data/app/assets/images/flags/fm.png +0 -0
- data/app/assets/images/flags/fo.png +0 -0
- data/app/assets/images/flags/fr.png +0 -0
- data/app/assets/images/flags/ga.png +0 -0
- data/app/assets/images/flags/gb.png +0 -0
- data/app/assets/images/flags/gd.png +0 -0
- data/app/assets/images/flags/ge.png +0 -0
- data/app/assets/images/flags/gf.png +0 -0
- data/app/assets/images/flags/gh.png +0 -0
- data/app/assets/images/flags/gi.png +0 -0
- data/app/assets/images/flags/gl.png +0 -0
- data/app/assets/images/flags/gm.png +0 -0
- data/app/assets/images/flags/gn.png +0 -0
- data/app/assets/images/flags/gp.png +0 -0
- data/app/assets/images/flags/gq.png +0 -0
- data/app/assets/images/flags/gr.png +0 -0
- data/app/assets/images/flags/gs.png +0 -0
- data/app/assets/images/flags/gt.png +0 -0
- data/app/assets/images/flags/gu.png +0 -0
- data/app/assets/images/flags/gw.png +0 -0
- data/app/assets/images/flags/gy.png +0 -0
- data/app/assets/images/flags/hk.png +0 -0
- data/app/assets/images/flags/hm.png +0 -0
- data/app/assets/images/flags/hn.png +0 -0
- data/app/assets/images/flags/hr.png +0 -0
- data/app/assets/images/flags/ht.png +0 -0
- data/app/assets/images/flags/hu.png +0 -0
- data/app/assets/images/flags/id.png +0 -0
- data/app/assets/images/flags/ie.png +0 -0
- data/app/assets/images/flags/il.png +0 -0
- data/app/assets/images/flags/in.png +0 -0
- data/app/assets/images/flags/io.png +0 -0
- data/app/assets/images/flags/iq.png +0 -0
- data/app/assets/images/flags/ir.png +0 -0
- data/app/assets/images/flags/is.png +0 -0
- data/app/assets/images/flags/it.png +0 -0
- data/app/assets/images/flags/ja.png +0 -0
- data/app/assets/images/flags/jm.png +0 -0
- data/app/assets/images/flags/jo.png +0 -0
- data/app/assets/images/flags/ke.png +0 -0
- data/app/assets/images/flags/kg.png +0 -0
- data/app/assets/images/flags/kh.png +0 -0
- data/app/assets/images/flags/ki.png +0 -0
- data/app/assets/images/flags/km.png +0 -0
- data/app/assets/images/flags/kn.png +0 -0
- data/app/assets/images/flags/kp.png +0 -0
- data/app/assets/images/flags/kr.png +0 -0
- data/app/assets/images/flags/kw.png +0 -0
- data/app/assets/images/flags/ky.png +0 -0
- data/app/assets/images/flags/kz.png +0 -0
- data/app/assets/images/flags/la.png +0 -0
- data/app/assets/images/flags/lb.png +0 -0
- data/app/assets/images/flags/lc.png +0 -0
- data/app/assets/images/flags/li.png +0 -0
- data/app/assets/images/flags/lk.png +0 -0
- data/app/assets/images/flags/lr.png +0 -0
- data/app/assets/images/flags/ls.png +0 -0
- data/app/assets/images/flags/lt.png +0 -0
- data/app/assets/images/flags/lu.png +0 -0
- data/app/assets/images/flags/lv.png +0 -0
- data/app/assets/images/flags/ly.png +0 -0
- data/app/assets/images/flags/ma.png +0 -0
- data/app/assets/images/flags/mc.png +0 -0
- data/app/assets/images/flags/md.png +0 -0
- data/app/assets/images/flags/me.png +0 -0
- data/app/assets/images/flags/mg.png +0 -0
- data/app/assets/images/flags/mh.png +0 -0
- data/app/assets/images/flags/mk.png +0 -0
- data/app/assets/images/flags/ml.png +0 -0
- data/app/assets/images/flags/mm.png +0 -0
- data/app/assets/images/flags/mn.png +0 -0
- data/app/assets/images/flags/mo.png +0 -0
- data/app/assets/images/flags/mp.png +0 -0
- data/app/assets/images/flags/mq.png +0 -0
- data/app/assets/images/flags/mr.png +0 -0
- data/app/assets/images/flags/ms.png +0 -0
- data/app/assets/images/flags/mt.png +0 -0
- data/app/assets/images/flags/mu.png +0 -0
- data/app/assets/images/flags/mv.png +0 -0
- data/app/assets/images/flags/mw.png +0 -0
- data/app/assets/images/flags/mx.png +0 -0
- data/app/assets/images/flags/my.png +0 -0
- data/app/assets/images/flags/mz.png +0 -0
- data/app/assets/images/flags/na.png +0 -0
- data/app/assets/images/flags/nc.png +0 -0
- data/app/assets/images/flags/ne.png +0 -0
- data/app/assets/images/flags/nf.png +0 -0
- data/app/assets/images/flags/ng.png +0 -0
- data/app/assets/images/flags/ni.png +0 -0
- data/app/assets/images/flags/nl.png +0 -0
- data/app/assets/images/flags/no.png +0 -0
- data/app/assets/images/flags/np.png +0 -0
- data/app/assets/images/flags/nr.png +0 -0
- data/app/assets/images/flags/nu.png +0 -0
- data/app/assets/images/flags/nz.png +0 -0
- data/app/assets/images/flags/om.png +0 -0
- data/app/assets/images/flags/pa.png +0 -0
- data/app/assets/images/flags/pe.png +0 -0
- data/app/assets/images/flags/pf.png +0 -0
- data/app/assets/images/flags/pg.png +0 -0
- data/app/assets/images/flags/ph.png +0 -0
- data/app/assets/images/flags/pk.png +0 -0
- data/app/assets/images/flags/pl.png +0 -0
- data/app/assets/images/flags/pm.png +0 -0
- data/app/assets/images/flags/pn.png +0 -0
- data/app/assets/images/flags/pr.png +0 -0
- data/app/assets/images/flags/ps.png +0 -0
- data/app/assets/images/flags/pt.png +0 -0
- data/app/assets/images/flags/pw.png +0 -0
- data/app/assets/images/flags/py.png +0 -0
- data/app/assets/images/flags/qa.png +0 -0
- data/app/assets/images/flags/re.png +0 -0
- data/app/assets/images/flags/ro.png +0 -0
- data/app/assets/images/flags/rs.png +0 -0
- data/app/assets/images/flags/ru.png +0 -0
- data/app/assets/images/flags/rw.png +0 -0
- data/app/assets/images/flags/sa.png +0 -0
- data/app/assets/images/flags/sb.png +0 -0
- data/app/assets/images/flags/sc.png +0 -0
- data/app/assets/images/flags/scotland.png +0 -0
- data/app/assets/images/flags/sd.png +0 -0
- data/app/assets/images/flags/se.png +0 -0
- data/app/assets/images/flags/sg.png +0 -0
- data/app/assets/images/flags/sh.png +0 -0
- data/app/assets/images/flags/si.png +0 -0
- data/app/assets/images/flags/sj.png +0 -0
- data/app/assets/images/flags/sk.png +0 -0
- data/app/assets/images/flags/sl.png +0 -0
- data/app/assets/images/flags/sm.png +0 -0
- data/app/assets/images/flags/sn.png +0 -0
- data/app/assets/images/flags/so.png +0 -0
- data/app/assets/images/flags/sr.png +0 -0
- data/app/assets/images/flags/st.png +0 -0
- data/app/assets/images/flags/sv.png +0 -0
- data/app/assets/images/flags/sy.png +0 -0
- data/app/assets/images/flags/sz.png +0 -0
- data/app/assets/images/flags/tc.png +0 -0
- data/app/assets/images/flags/td.png +0 -0
- data/app/assets/images/flags/tf.png +0 -0
- data/app/assets/images/flags/tg.png +0 -0
- data/app/assets/images/flags/th.png +0 -0
- data/app/assets/images/flags/tj.png +0 -0
- data/app/assets/images/flags/tk.png +0 -0
- data/app/assets/images/flags/tl.png +0 -0
- data/app/assets/images/flags/tm.png +0 -0
- data/app/assets/images/flags/tn.png +0 -0
- data/app/assets/images/flags/to.png +0 -0
- data/app/assets/images/flags/tr.png +0 -0
- data/app/assets/images/flags/tt.png +0 -0
- data/app/assets/images/flags/tv.png +0 -0
- data/app/assets/images/flags/tw.png +0 -0
- data/app/assets/images/flags/tz.png +0 -0
- data/app/assets/images/flags/ua.png +0 -0
- data/app/assets/images/flags/ug.png +0 -0
- data/app/assets/images/flags/um.png +0 -0
- data/app/assets/images/flags/us.png +0 -0
- data/app/assets/images/flags/uy.png +0 -0
- data/app/assets/images/flags/uz.png +0 -0
- data/app/assets/images/flags/va.png +0 -0
- data/app/assets/images/flags/vc.png +0 -0
- data/app/assets/images/flags/ve.png +0 -0
- data/app/assets/images/flags/vg.png +0 -0
- data/app/assets/images/flags/vi.png +0 -0
- data/app/assets/images/flags/vn.png +0 -0
- data/app/assets/images/flags/vu.png +0 -0
- data/app/assets/images/flags/wales.png +0 -0
- data/app/assets/images/flags/wf.png +0 -0
- data/app/assets/images/flags/ws.png +0 -0
- data/app/assets/images/flags/ye.png +0 -0
- data/app/assets/images/flags/yt.png +0 -0
- data/app/assets/images/flags/za.png +0 -0
- data/app/assets/images/flags/zm.png +0 -0
- data/app/assets/images/flags/zw.png +0 -0
- data/app/assets/images/spree_header.jpg +0 -0
- data/app/views/spree/products/_image.html.erb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a338832e544a685ba98e6920db856223cebc89d
|
4
|
+
data.tar.gz: ba3582921a8f83ea5edb4477255c9f684899d156
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b40461730f99df2887a3f6367dec2605a701cec1741c0a1ccb594a09ca54c6572113c8773ccc8f1d654a6c29c36b2c7160f82e358526d743c583d59d0e69bc39
|
7
|
+
data.tar.gz: 986c4f262981d47995e9cc724b779c59382fd08a51be0967047525adf7b5391a9ff645b85e46c68828f52bd7ea5296112582cf61b8714d9b56d7292edba3371f
|
Binary file
|
@@ -1,3 +1,5 @@
|
|
1
|
+
#= require spree/frontend/coupon_manager
|
2
|
+
|
1
3
|
Spree.ready ($) ->
|
2
4
|
if ($ 'form#update-cart').is('*')
|
3
5
|
($ 'form#update-cart a.delete').show().one 'click', ->
|
@@ -5,8 +7,19 @@ Spree.ready ($) ->
|
|
5
7
|
($ this).parents('form').first().submit()
|
6
8
|
false
|
7
9
|
|
8
|
-
($ 'form#update-cart').submit ->
|
10
|
+
($ 'form#update-cart').submit (event) ->
|
9
11
|
($ 'form#update-cart #update-button').attr('disabled', true)
|
12
|
+
input =
|
13
|
+
couponCodeField: $('#order_coupon_code')
|
14
|
+
couponStatus: $('#coupon_status')
|
15
|
+
if input.couponCodeField.val().trim().length > 0
|
16
|
+
if new CouponManager(input).applyCoupon()
|
17
|
+
@submit()
|
18
|
+
return true
|
19
|
+
else
|
20
|
+
($ 'form#update-cart #update-button').attr('disabled', false)
|
21
|
+
event.preventDefault()
|
22
|
+
return false
|
10
23
|
|
11
24
|
Spree.fetch_cart = ->
|
12
25
|
$.ajax
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#= require spree/frontend/coupon_manager
|
1
2
|
Spree.ready ($) ->
|
2
3
|
Spree.onPayment = () ->
|
3
4
|
if ($ '#checkout_form_payment').is('*')
|
@@ -41,41 +42,16 @@ Spree.ready ($) ->
|
|
41
42
|
($ 'input[type="radio"]:checked').click()
|
42
43
|
|
43
44
|
$('#checkout_form_payment').submit (event) ->
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
coupon_status = $("<div id='coupon_status'></div>")
|
52
|
-
coupon_code_field.parent().append(coupon_status)
|
45
|
+
input =
|
46
|
+
couponCodeField: $('#order_coupon_code')
|
47
|
+
couponStatus: $('#coupon_status')
|
48
|
+
if input.couponCodeField.val().trim().length > 0
|
49
|
+
if new CouponManager(input).applyCoupon()
|
50
|
+
@submit()
|
51
|
+
return true
|
53
52
|
else
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
{
|
58
|
-
order_token: Spree.current_order_token,
|
59
|
-
coupon_code: coupon_code
|
60
|
-
}
|
61
|
-
)
|
62
|
-
|
63
|
-
coupon_status.removeClass();
|
64
|
-
$.ajax({
|
65
|
-
async: false,
|
66
|
-
method: "PUT",
|
67
|
-
url: url,
|
68
|
-
success: (data) =>
|
69
|
-
coupon_code_field.val('')
|
70
|
-
coupon_status.addClass("alert-success").html("Coupon code applied successfully.")
|
71
|
-
@submit()
|
72
|
-
return true
|
73
|
-
error: (xhr) ->
|
74
|
-
handler = JSON.parse(xhr.responseText)
|
75
|
-
coupon_status.addClass("alert-error").html(handler["error"])
|
76
|
-
Spree.enableSave()
|
77
|
-
event.preventDefault()
|
78
|
-
return false
|
79
|
-
})
|
53
|
+
Spree.enableSave()
|
54
|
+
event.preventDefault()
|
55
|
+
return false
|
80
56
|
|
81
57
|
Spree.onPayment()
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class @ShippingTotalManager
|
2
|
+
REGEX_FOR_REMOVING_SPECIAL_CHARS = /[^0-9\.]+/g
|
3
|
+
|
4
|
+
constructor: (@input) ->
|
5
|
+
@shippingMethods = @input.shippingMethods
|
6
|
+
@shipmentTotal = @input.shipmentTotal
|
7
|
+
@orderTotal = @input.orderTotal
|
8
|
+
|
9
|
+
calculateShipmentTotal: ->
|
10
|
+
@sum = 0
|
11
|
+
$.each ($(@shippingMethods).filter(':checked')), (idx, shippingMethod) =>
|
12
|
+
@sum += @parseCurrencyToFloat($(shippingMethod).data('cost'))
|
13
|
+
|
14
|
+
@readjustSummarySection(
|
15
|
+
@parseCurrencyToFloat(@orderTotal.html()),
|
16
|
+
@sum,
|
17
|
+
@parseCurrencyToFloat(@shipmentTotal.html())
|
18
|
+
)
|
19
|
+
|
20
|
+
parseCurrencyToFloat: (input) ->
|
21
|
+
parseFloat(input.replace(REGEX_FOR_REMOVING_SPECIAL_CHARS, ""))
|
22
|
+
|
23
|
+
readjustSummarySection: (orderTotal, newShipmentTotal, oldShipmentTotal) ->
|
24
|
+
newOrderTotal = orderTotal + (newShipmentTotal - oldShipmentTotal)
|
25
|
+
@shipmentTotal.html(@shipmentTotal.data('currency') + newShipmentTotal.toFixed(2))
|
26
|
+
@orderTotal.html(@orderTotal.data('currency') + newOrderTotal.toFixed(2))
|
27
|
+
|
28
|
+
bindEvent: ->
|
29
|
+
@shippingMethods.change =>
|
30
|
+
@calculateShipmentTotal()
|
31
|
+
|
32
|
+
Spree.ready ($) ->
|
33
|
+
input =
|
34
|
+
orderTotal: $('#summary-order-total')
|
35
|
+
shipmentTotal: $("[data-hook='shipping-total']")
|
36
|
+
shippingMethods: $("input[data-behavior='shipping-method-selector']")
|
37
|
+
|
38
|
+
new ShippingTotalManager(input).bindEvent()
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class @CouponManager
|
2
|
+
constructor: (@input) ->
|
3
|
+
@couponCodeField = @input.couponCodeField
|
4
|
+
@couponApplied = false
|
5
|
+
@couponStatus = @input.couponStatus
|
6
|
+
|
7
|
+
applyCoupon: ->
|
8
|
+
@couponCode = $.trim($(@couponCodeField).val())
|
9
|
+
if @couponCode != ''
|
10
|
+
if @couponStatus.length == 0
|
11
|
+
@couponStatus = $('<div/>', { id: 'coupon_status' })
|
12
|
+
@couponCodeField.parent().append @couponStatus
|
13
|
+
@createUrl()
|
14
|
+
@couponStatus.removeClass()
|
15
|
+
@sendRequest()
|
16
|
+
@couponApplied
|
17
|
+
else
|
18
|
+
true
|
19
|
+
|
20
|
+
createUrl: ->
|
21
|
+
@url = Spree.url(Spree.routes.apply_coupon_code(Spree.current_order_id),
|
22
|
+
order_token: Spree.current_order_token
|
23
|
+
coupon_code: @couponCode)
|
24
|
+
|
25
|
+
sendRequest: ->
|
26
|
+
$.ajax
|
27
|
+
async: false
|
28
|
+
method: 'PUT'
|
29
|
+
url: @url
|
30
|
+
success: =>
|
31
|
+
@couponCodeField.val ''
|
32
|
+
@couponStatus.addClass('alert-success')
|
33
|
+
.html Spree.translations.coupon_code_applied
|
34
|
+
@couponApplied = true
|
35
|
+
error: (xhr) =>
|
36
|
+
handler = JSON.parse(xhr.responseText)
|
37
|
+
@couponStatus.addClass('alert-error').html handler['error']
|
@@ -6,8 +6,7 @@
|
|
6
6
|
|
7
7
|
// -- Spree Custom Header and Footer ---------------------
|
8
8
|
#spree-header {
|
9
|
-
background: $brand-primary
|
10
|
-
background-size: cover;
|
9
|
+
background-color: $brand-primary;
|
11
10
|
margin-bottom: $line-height-computed;
|
12
11
|
|
13
12
|
#header {
|
@@ -19,7 +18,8 @@
|
|
19
18
|
margin-bottom: 10px;
|
20
19
|
|
21
20
|
img {
|
22
|
-
width: 100%;
|
21
|
+
max-width: 100%;
|
22
|
+
max-height: 50px;
|
23
23
|
}
|
24
24
|
}
|
25
25
|
|
@@ -4,7 +4,6 @@ module Spree
|
|
4
4
|
# checkout which has nothing to do with updating an order that this approach
|
5
5
|
# is waranted.
|
6
6
|
class CheckoutController < Spree::StoreController
|
7
|
-
before_action :expires_now, only: [:edit]
|
8
7
|
before_action :load_order_with_lock
|
9
8
|
before_action :ensure_valid_state_lock_version, only: [:update]
|
10
9
|
before_action :set_state_if_present
|
@@ -16,7 +15,6 @@ module Spree
|
|
16
15
|
|
17
16
|
before_action :associate_user
|
18
17
|
before_action :check_authorization
|
19
|
-
before_action :apply_coupon_code
|
20
18
|
|
21
19
|
before_action :setup_for_current_state
|
22
20
|
before_action :add_store_credit_payments, only: [:update]
|
@@ -189,17 +187,5 @@ module Spree
|
|
189
187
|
def check_authorization
|
190
188
|
authorize!(:edit, current_order, cookies.signed[:guest_token])
|
191
189
|
end
|
192
|
-
|
193
|
-
def sanitize_zip_code
|
194
|
-
order_params = params[:order]
|
195
|
-
return unless order_params
|
196
|
-
strip_zip(order_params[:bill_address_attributes])
|
197
|
-
strip_zip(order_params[:ship_address_attributes])
|
198
|
-
end
|
199
|
-
|
200
|
-
def strip_zip(address_params)
|
201
|
-
return unless address_params
|
202
|
-
address_params[:zipcode] = address_params[:zipcode].strip if address_params[:zipcode]
|
203
|
-
end
|
204
190
|
end
|
205
191
|
end
|
@@ -4,16 +4,16 @@ module Spree
|
|
4
4
|
before_action { render_404 if params[:path] =~ /(\.|\\)/ }
|
5
5
|
after_action :fire_visited_path, only: :show
|
6
6
|
|
7
|
-
rescue_from ActionView::MissingTemplate, :
|
7
|
+
rescue_from ActionView::MissingTemplate, with: :render_404
|
8
8
|
|
9
9
|
respond_to :html
|
10
10
|
|
11
11
|
def show
|
12
|
-
render :
|
12
|
+
render action: params[:path]
|
13
13
|
end
|
14
14
|
|
15
15
|
def cvv
|
16
|
-
render :
|
16
|
+
render layout: false
|
17
17
|
end
|
18
18
|
|
19
19
|
def fire_visited_path
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Spree
|
2
2
|
class OrdersController < Spree::StoreController
|
3
3
|
before_action :check_authorization
|
4
|
-
rescue_from ActiveRecord::RecordNotFound, :
|
4
|
+
rescue_from ActiveRecord::RecordNotFound, with: :render_404
|
5
5
|
helper 'spree/products', 'spree/orders'
|
6
6
|
|
7
7
|
respond_to :html
|
@@ -66,6 +66,11 @@ module Spree
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
def populate_redirect
|
70
|
+
flash[:error] = Spree.t(:populate_get_error)
|
71
|
+
redirect_to('/cart')
|
72
|
+
end
|
73
|
+
|
69
74
|
def empty
|
70
75
|
if @order = current_order
|
71
76
|
@order.empty!
|
@@ -76,7 +81,7 @@ module Spree
|
|
76
81
|
|
77
82
|
def accurate_title
|
78
83
|
if @order && @order.completed?
|
79
|
-
Spree.t(:order_number, :
|
84
|
+
Spree.t(:order_number, number: @order.number)
|
80
85
|
else
|
81
86
|
Spree.t(:shopping_cart)
|
82
87
|
end
|
@@ -3,7 +3,7 @@ module Spree
|
|
3
3
|
before_action :load_product, only: :show
|
4
4
|
before_action :load_taxon, only: :index
|
5
5
|
|
6
|
-
rescue_from ActiveRecord::RecordNotFound, :
|
6
|
+
rescue_from ActiveRecord::RecordNotFound, with: :render_404
|
7
7
|
helper 'spree/taxons'
|
8
8
|
|
9
9
|
respond_to :html
|
@@ -52,7 +52,8 @@ module Spree
|
|
52
52
|
# If an old id or a numeric id was used to find the record,
|
53
53
|
# we should do a 301 redirect that uses the current friendly id.
|
54
54
|
if params[:id] != @product.friendly_id
|
55
|
-
params
|
55
|
+
params[:id] = @product.friendly_id
|
56
|
+
params.permit!
|
56
57
|
return redirect_to url_for(params), status: :moved_permanently
|
57
58
|
end
|
58
59
|
end
|
@@ -19,24 +19,6 @@ module Spree
|
|
19
19
|
|
20
20
|
protected
|
21
21
|
|
22
|
-
# This method is placed here so that the CheckoutController
|
23
|
-
# and OrdersController can both reference it (or any other controller
|
24
|
-
# which needs it)
|
25
|
-
def apply_coupon_code
|
26
|
-
if params[:order] && params[:order][:coupon_code]
|
27
|
-
@order.coupon_code = params[:order][:coupon_code]
|
28
|
-
|
29
|
-
handler = PromotionHandler::Coupon.new(@order).apply
|
30
|
-
|
31
|
-
if handler.error.present?
|
32
|
-
flash.now[:error] = handler.error
|
33
|
-
respond_with(@order) { |format| format.html { render :edit } } and return
|
34
|
-
elsif handler.success
|
35
|
-
flash[:success] = handler.success
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
22
|
def config_locale
|
41
23
|
Spree::Frontend::Config[:locale]
|
42
24
|
end
|
@@ -73,7 +73,7 @@ module Spree
|
|
73
73
|
css_class = 'full'
|
74
74
|
end
|
75
75
|
|
76
|
-
link_to text.html_safe, spree.cart_path, :
|
76
|
+
link_to text.html_safe, spree.cart_path, class: "cart-info #{css_class}"
|
77
77
|
end
|
78
78
|
|
79
79
|
# helper to determine if its appropriate to show the store menu
|
@@ -1,14 +1,5 @@
|
|
1
|
-
require 'truncate_html'
|
2
|
-
require 'app/helpers/truncate_html_helper'
|
3
|
-
|
4
1
|
module Spree
|
5
2
|
module OrdersHelper
|
6
|
-
include TruncateHtmlHelper
|
7
|
-
|
8
|
-
def truncated_product_description(product)
|
9
|
-
truncate_html(raw(product.description))
|
10
|
-
end
|
11
|
-
|
12
3
|
def order_just_completed?(order)
|
13
4
|
flash[:order_completed] && order.present?
|
14
5
|
end
|
@@ -8,6 +8,6 @@
|
|
8
8
|
-%>
|
9
9
|
<% unless current_page.first? %>
|
10
10
|
<li class="first">
|
11
|
-
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :
|
11
|
+
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote %>
|
12
12
|
</li>
|
13
13
|
<% end %>
|
@@ -8,6 +8,6 @@
|
|
8
8
|
-%>
|
9
9
|
<% unless current_page.last? %>
|
10
10
|
<li class="last next"><%# "next" class present for border styling in twitter bootstrap %>
|
11
|
-
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:
|
11
|
+
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {remote: remote} %>
|
12
12
|
</li>
|
13
13
|
<% end %>
|
@@ -8,6 +8,6 @@
|
|
8
8
|
-%>
|
9
9
|
<% unless current_page.last? %>
|
10
10
|
<li class="next_page">
|
11
|
-
<%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :
|
11
|
+
<%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote %>
|
12
12
|
</li>
|
13
13
|
<% end %>
|
@@ -8,5 +8,5 @@
|
|
8
8
|
remote: data-remote
|
9
9
|
-%>
|
10
10
|
<li class="page<%= ' active' if page.current? %>">
|
11
|
-
<%= link_to page, url, opts = {:
|
11
|
+
<%= link_to page, url, opts = {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
|
12
12
|
</li>
|
@@ -8,6 +8,6 @@
|
|
8
8
|
-%>
|
9
9
|
<% unless current_page.first? %>
|
10
10
|
<li class="prev">
|
11
|
-
<%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :
|
11
|
+
<%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote %>
|
12
12
|
</li>
|
13
13
|
<% end %>
|
@@ -5,42 +5,42 @@
|
|
5
5
|
<%= form.label :firstname do %>
|
6
6
|
<%= Spree.t(:first_name) %><abbr class="required" title="required">*</abbr>
|
7
7
|
<% end %>
|
8
|
-
<%= form.text_field :firstname, :
|
8
|
+
<%= form.text_field :firstname, class: 'form-control required' %>
|
9
9
|
</p>
|
10
10
|
<p class="form-group" id=<%="#{address_id}lastname" %>>
|
11
11
|
<%= form.label :lastname do %>
|
12
12
|
<%= Spree.t(:last_name) %><abbr class="required" title="required">*</abbr>
|
13
13
|
<% end %>
|
14
|
-
<%= form.text_field :lastname, :
|
14
|
+
<%= form.text_field :lastname, class: 'form-control required' %>
|
15
15
|
</p>
|
16
16
|
<% if Spree::Config[:company] %>
|
17
17
|
<p class="form-group" id=<%="#{address_id}company" %>>
|
18
18
|
<%= form.label :company, Spree.t(:company) %>
|
19
|
-
<%= form.text_field :company, :
|
19
|
+
<%= form.text_field :company, class: 'form-control' %>
|
20
20
|
</p>
|
21
21
|
<% end %>
|
22
22
|
<p class="form-group" id=<%="#{address_id}address1" %>>
|
23
23
|
<%= form.label :address1 do %>
|
24
24
|
<%= Spree.t(:street_address) %><abbr class="required" title="required">*</abbr>
|
25
25
|
<% end %>
|
26
|
-
<%= form.text_field :address1, :
|
26
|
+
<%= form.text_field :address1, class: 'form-control required' %>
|
27
27
|
</p>
|
28
28
|
<p class="form-group" id=<%="#{address_id}address2" %>>
|
29
29
|
<%= form.label :address2, Spree.t(:street_address_2) %>
|
30
|
-
<%= form.text_field :address2, :
|
30
|
+
<%= form.text_field :address2, class: 'form-control' %>
|
31
31
|
</p>
|
32
32
|
<p class="form-group" id=<%="#{address_id}city" %>>
|
33
33
|
<%= form.label :city do %>
|
34
34
|
<%= Spree.t(:city) %><abbr class="required" title="required">*</abbr>
|
35
35
|
<% end %>
|
36
|
-
<%= form.text_field :city, :
|
36
|
+
<%= form.text_field :city, class: 'form-control required' %>
|
37
37
|
</p>
|
38
38
|
<p class="form-group" id=<%="#{address_id}country" %>>
|
39
39
|
<%= form.label :country_id do %>
|
40
40
|
<%= Spree.t(:country) %><abbr class="required" title="required">*</abbr>
|
41
41
|
<% end %>
|
42
42
|
<span id=<%="#{address_id}country-selection" %>>
|
43
|
-
<%= form.collection_select :country_id, available_countries, :id, :name, {}, {:
|
43
|
+
<%= form.collection_select :country_id, available_countries, :id, :name, {}, {class: 'form-control required'} %>
|
44
44
|
</span>
|
45
45
|
</p>
|
46
46
|
|
@@ -54,17 +54,17 @@
|
|
54
54
|
<%== state_elements = [
|
55
55
|
form.collection_select(:state_id, address.country.states,
|
56
56
|
:id, :name,
|
57
|
-
{:
|
58
|
-
{:
|
59
|
-
:
|
57
|
+
{include_blank: true},
|
58
|
+
{class: have_states ? 'form-control required' : 'form-control hidden',
|
59
|
+
disabled: !have_states}) +
|
60
60
|
form.text_field(:state_name,
|
61
|
-
:
|
62
|
-
:
|
61
|
+
class: !have_states ? 'form-control required' : 'form-control hidden',
|
62
|
+
disabled: have_states)
|
63
63
|
].join.gsub('"', "'").gsub("\n", "")
|
64
64
|
%>
|
65
65
|
</p>
|
66
66
|
<noscript>
|
67
|
-
<%= form.text_field :state_name, :
|
67
|
+
<%= form.text_field :state_name, class: 'form-control required' %>
|
68
68
|
</noscript>
|
69
69
|
<% end %>
|
70
70
|
|
@@ -72,18 +72,18 @@
|
|
72
72
|
<%= form.label :zipcode do %>
|
73
73
|
<%= Spree.t(:zip) %><% if address.require_zipcode? %><abbr class="required" title="required">*</abbr><% end %>
|
74
74
|
<% end %>
|
75
|
-
<%= form.text_field :zipcode, :
|
75
|
+
<%= form.text_field :zipcode, class: "form-control #{'required' if address.require_zipcode?}" %>
|
76
76
|
</p>
|
77
77
|
<p class="form-group" id=<%="#{address_id}phone" %>>
|
78
78
|
<%= form.label :phone do %>
|
79
79
|
<%= Spree.t(:phone) %><% if address.require_phone? %><abbr class="required" title="required">*</abbr><% end %>
|
80
80
|
<% end %>
|
81
|
-
<%= form.phone_field :phone, :
|
81
|
+
<%= form.phone_field :phone, class: "form-control #{'required' if address.require_phone?}" %>
|
82
82
|
</p>
|
83
83
|
<% if Spree::Config[:alternative_shipping_phone] %>
|
84
84
|
<p class="form-group" id=<%="#{address_id}altphone" %>>
|
85
85
|
<%= form.label :alternative_phone, Spree.t(:alternative_phone) %>
|
86
|
-
<%= form.phone_field :alternative_phone, :
|
86
|
+
<%= form.phone_field :alternative_phone, class: 'form-control' %>
|
87
87
|
</p>
|
88
88
|
<% end %>
|
89
89
|
</div>
|