summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js/lib')
-rw-r--r--StoneIsland/www/js/lib/cart/CartConfirm.js3
-rw-r--r--StoneIsland/www/js/lib/cart/CartPayment.js3
-rw-r--r--StoneIsland/www/js/lib/cart/CartShipping.js3
-rw-r--r--StoneIsland/www/js/lib/cart/CartSummary.js28
-rw-r--r--StoneIsland/www/js/lib/cart/CartThanks.js3
-rw-r--r--StoneIsland/www/js/lib/cart/CartView.js18
6 files changed, 44 insertions, 14 deletions
diff --git a/StoneIsland/www/js/lib/cart/CartConfirm.js b/StoneIsland/www/js/lib/cart/CartConfirm.js
index 7d8c6568..687f3a93 100644
--- a/StoneIsland/www/js/lib/cart/CartConfirm.js
+++ b/StoneIsland/www/js/lib/cart/CartConfirm.js
@@ -5,7 +5,8 @@ var CartConfirm = FormView.extend({
events: {
},
- initialize: function(){
+ initialize: function(opt){
+ this.parent = opt.parent
this.scroller = new IScroll('#cart_confirm', app.iscroll_options)
},
diff --git a/StoneIsland/www/js/lib/cart/CartPayment.js b/StoneIsland/www/js/lib/cart/CartPayment.js
index bcca1915..a9772ffe 100644
--- a/StoneIsland/www/js/lib/cart/CartPayment.js
+++ b/StoneIsland/www/js/lib/cart/CartPayment.js
@@ -5,7 +5,8 @@ var CartPayment = FormView.extend({
events: {
},
- initialize: function(){
+ initialize: function(opt){
+ this.parent = opt.parent
this.$form = this.$("form")
this.$msg = this.$(".msg")
this.address = new AddressView ({ parent: this })
diff --git a/StoneIsland/www/js/lib/cart/CartShipping.js b/StoneIsland/www/js/lib/cart/CartShipping.js
index 65e2cb65..c0c21b4d 100644
--- a/StoneIsland/www/js/lib/cart/CartShipping.js
+++ b/StoneIsland/www/js/lib/cart/CartShipping.js
@@ -5,7 +5,8 @@ var CartShipping = FormView.extend({
events: {
},
- initialize: function(){
+ initialize: function(opt){
+ this.parent = opt.parent
this.$form = this.$("form")
this.$msg = this.$(".msg")
this.address = new AddressView ({ parent: this })
diff --git a/StoneIsland/www/js/lib/cart/CartSummary.js b/StoneIsland/www/js/lib/cart/CartSummary.js
index d8619990..290627d3 100644
--- a/StoneIsland/www/js/lib/cart/CartSummary.js
+++ b/StoneIsland/www/js/lib/cart/CartSummary.js
@@ -5,18 +5,42 @@ var CartSummary = ScrollableView.extend({
events: {
},
- initialize: function(){
+ initialize: function(opt){
+ this.parent = opt.parent
+ this.$loader = this.$(".loader")
+ this.$cart_body = this.$(".cart_body")
+ this.$cart_empty = this.$(".cart_empty")
this.scroller = new IScroll('#cart_summary', app.iscroll_options)
},
show: function(){
document.body.className = "cart"
app.cart.el.className = "summary"
+ this.$loader.show()
+
+ sdk.cart.get_status({
+ success: this.populate.bind(this),
+ error: this.error.bind(this),
+ })
+ },
+
+ populate: function(data){
+ this.$loader.hide()
app.footer.show("SHIPPING >", "CANCEL")
+
+ console.log(data)
+
+ this.parent.$itemcount.html("1 ITEM")
+
+ this.$el.removeClass("empty").addClass("full")
this.deferScrollToTop()
},
- populate: function(){
+ error: function(){
+ this.$loader.hide()
+ app.footer.hide()
+ this.parent.$itemcount.html("0 ITEMS")
+ this.$el.addClass("empty").removeClass("full")
},
ok: function(){
diff --git a/StoneIsland/www/js/lib/cart/CartThanks.js b/StoneIsland/www/js/lib/cart/CartThanks.js
index 9524ab83..993fd9ac 100644
--- a/StoneIsland/www/js/lib/cart/CartThanks.js
+++ b/StoneIsland/www/js/lib/cart/CartThanks.js
@@ -5,7 +5,8 @@ var CartThanks = View.extend({
events: {
},
- initialize: function(){
+ initialize: function(opt){
+ this.parent = opt.parent
},
show: function(){
diff --git a/StoneIsland/www/js/lib/cart/CartView.js b/StoneIsland/www/js/lib/cart/CartView.js
index 43dc7dd4..fdad3a07 100644
--- a/StoneIsland/www/js/lib/cart/CartView.js
+++ b/StoneIsland/www/js/lib/cart/CartView.js
@@ -3,17 +3,19 @@ var CartView = View.extend({
el: "#cart",
events: {
- "click .summary": "show_summary",
- "click .shipping": "show_shipping",
- "click .payment": "show_payment",
+ "click .summary_step": "show_summary",
+ "click .shipping_step": "show_shipping",
+ "click .payment_step": "show_payment",
},
initialize: function(){
- this.summary = new CartSummary ()
- this.payment = new CartPayment ()
- this.shipping = new CartShipping ()
- this.confirm = new CartConfirm ()
- this.thanks = new CartThanks ()
+ this.summary = new CartSummary ({ parent: this })
+ this.payment = new CartPayment ({ parent: this })
+ this.shipping = new CartShipping ({ parent: this })
+ this.confirm = new CartConfirm ({ parent: this })
+ this.thanks = new CartThanks ({ parent: this })
+
+ this.$itemcount = this.$(".itemcount")
},
show: function(){