how to override the store/checkouts.js asset ? ( error Spree is not defined ...)

549 views
Skip to first unread message

Erwin

unread,
Feb 25, 2013, 4:22:45 AM2/25/13
to spree...@googlegroups.com
I am stuck with something that should be easy as per the documentation:

To replace an entire JavaScript file as provided by Spree you simply need to create a file with the same name and save it to the corresponding path within your application’s or extension’s app/assets/javascripts directory

so, I initially copied the Spree frontend/app/javascript/store.js.coffee script into my own app, 
into  my  app/assets/javascript/store/checkout.js.coffee
and added  in my  app/assets/javascript/store/all.js
    //= require store/checkout

but when I run it in dev mode , I get a js error :

Timestamp: 25/02/13 10:20:41
Error: ReferenceError: Spree is not defined
Line: 9

here is my all.js file

//= require jquery
//= require jquery_ujs
//= require store/spree_core
//= require store/spree_auth
//= require store/spree_promo
// require_tree .
//= require jquery.fancybox
//= require jquery.mousewheel-3.0.6.pack
//= require jcarousellite_1.3.1
//= require store/checkout
//= require store/workshop

//= require store/spree_multi_lingual



   

Laurens Nienhaus

unread,
Feb 25, 2013, 5:14:01 AM2/25/13
to spree...@googlegroups.com
I guess

// require_tree .

should read

//= require_tree .

or is that the cause of your problem?
> --
> You received this message because you are subscribed to the Google Groups
> "Spree" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to spree-user+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Erwin

unread,
Feb 25, 2013, 9:39:38 AM2/25/13
to spree...@googlegroups.com
yeah,  I thanks , but I already modified it and  it seems I don't need to require directly the script...
so it's overridden .. my own checkout file is taken in account but in this case there is an error

[15:32:48.583] ReferenceError: Spree is not defined @ http://localhost:3000/assets/store/checkout.js?body=1:9

>  faulty line :  Spree.checkout = {}

so I'm back to my issue , how to override 'correctly' the Spree checkout.js
( In Spree code there is a  spree.js ..  should I require it ... ?   no info on it in the doc...)





//= require jquery
//= require jquery_ujs

//= require jquery.fancybox
//= require jquery.mousewheel-3.0.6.pack
//= require jcarousellite_1.3.1

//= require store/spree_core
//= require store/spree_auth
//= require store/spree_promo

//= require_tree .

//= require jquery
//= require jquery_ujs

//= require jquery.fancybox
//= require jquery.mousewheel-3.0.6.pack
//= require jcarousellite_1.3.1

//= require store/spree_core
//= require store/spree_auth
//= require store/spree_promo

//= require_tree .

//= require store/workshop
Reply all
Reply to author
Forward
0 new messages