diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-11-08 19:32:08 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-11-08 19:32:19 -0500 |
| commit | 069e15c10ed10b45673c2365f78fe8918753f19d (patch) | |
| tree | b6e64d1f31f8c4390415efe186116479ef657fb9 /StoneIsland/www/js | |
| parent | aa23fc23b5a8cf43d115bcf3953806e66dadf1c3 (diff) | |
use jqxhr style callbacks
Diffstat (limited to 'StoneIsland/www/js')
| -rw-r--r-- | StoneIsland/www/js/lib/account/LoginView.js | 26 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/account/PaymentView.js | 5 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/account/ProfileView.js | 6 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/account/ShippingView.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/cart/CartBilling.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/cart/CartShipping.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/products/ProductView.js | 11 | ||||
| -rw-r--r-- | StoneIsland/www/js/sdk/account.js | 4 | ||||
| -rw-r--r-- | StoneIsland/www/js/sdk/address.js | 4 | ||||
| -rw-r--r-- | StoneIsland/www/js/sdk/cart.js | 20 | ||||
| -rw-r--r-- | StoneIsland/www/js/sdk/payment.js | 8 | ||||
| -rw-r--r-- | StoneIsland/www/js/sdk/product.js | 4 | ||||
| -rw-r--r-- | StoneIsland/www/js/sdk/shipping.js | 8 |
13 files changed, 42 insertions, 60 deletions
diff --git a/StoneIsland/www/js/lib/account/LoginView.js b/StoneIsland/www/js/lib/account/LoginView.js index 60f6263e..40cc29ba 100644 --- a/StoneIsland/www/js/lib/account/LoginView.js +++ b/StoneIsland/www/js/lib/account/LoginView.js @@ -3,9 +3,6 @@ var LoginView = View.extend({ el: "#login", events: { - "click .close": "hide", - "click .login_ask": "login", - "click .signup_ask": "signup", "submit form": "submit", }, @@ -13,15 +10,10 @@ var LoginView = View.extend({ initialize: function(){ this.$form = this.$("form") - this.$email = this.$("[name=email]") - this.$password = this.$("[name=password]") }, show: function(){ - this.$form.hide() - this.$email.val("") - this.$password.val("") - app.curtain.show() + this.$form.reset() document.body.classList.add("login") }, @@ -30,24 +22,8 @@ var LoginView = View.extend({ document.body.classList.remove("login") }, - login: function(){ - this.mode = "login" - this.$form.show() - }, - - signup: function(){ - this.mode = "signup" - this.$form.show() - }, - submit: function(e){ e.preventDefault() - if (this.mode == "login") { - // login api - } - else { - // signup api - } }, success: function(){ diff --git a/StoneIsland/www/js/lib/account/PaymentView.js b/StoneIsland/www/js/lib/account/PaymentView.js index a8c68267..1ce91283 100644 --- a/StoneIsland/www/js/lib/account/PaymentView.js +++ b/StoneIsland/www/js/lib/account/PaymentView.js @@ -6,7 +6,7 @@ var PaymentView = View.extend({ }, initialize: function(){ - this.address = new AddressView () + this.address = new AddressView ({ parent: this }) }, }) @@ -18,7 +18,8 @@ var AddressView = View.extend({ events: { }, - initialize: function(){ + initialize: function(opt){ + this.parent = opt.parent }, build: function(){ diff --git a/StoneIsland/www/js/lib/account/ProfileView.js b/StoneIsland/www/js/lib/account/ProfileView.js index 93c61b33..f6e331a5 100644 --- a/StoneIsland/www/js/lib/account/ProfileView.js +++ b/StoneIsland/www/js/lib/account/ProfileView.js @@ -1,5 +1,11 @@ var ProfileView = View.extend({ el: "#profile", + + events: { + }, + + initialize: function(){ + }, })
\ No newline at end of file diff --git a/StoneIsland/www/js/lib/account/ShippingView.js b/StoneIsland/www/js/lib/account/ShippingView.js index 5bf80cfb..d3a5d8df 100644 --- a/StoneIsland/www/js/lib/account/ShippingView.js +++ b/StoneIsland/www/js/lib/account/ShippingView.js @@ -6,7 +6,7 @@ var ShippingView = View.extend({ }, initialize: function(){ - this.address = new AddressView () + this.address = new AddressView ({ parent: this }) }, })
\ No newline at end of file diff --git a/StoneIsland/www/js/lib/cart/CartBilling.js b/StoneIsland/www/js/lib/cart/CartBilling.js index 447fae0f..ef9b8eff 100644 --- a/StoneIsland/www/js/lib/cart/CartBilling.js +++ b/StoneIsland/www/js/lib/cart/CartBilling.js @@ -6,7 +6,7 @@ var CartBilling = View.extend({ }, initialize: function(){ - this.address = new AddressView () + this.address = new AddressView ({ parent: this }) }, })
\ No newline at end of file diff --git a/StoneIsland/www/js/lib/cart/CartShipping.js b/StoneIsland/www/js/lib/cart/CartShipping.js index 32b25bb9..23b8cdf0 100644 --- a/StoneIsland/www/js/lib/cart/CartShipping.js +++ b/StoneIsland/www/js/lib/cart/CartShipping.js @@ -6,7 +6,7 @@ var CartShipping = View.extend({ }, initialize: function(){ - this.address = new AddressView () + this.address = new AddressView ({ parent: this }) }, })
\ No newline at end of file diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js index 0d0b0b25..9bfbe4a2 100644 --- a/StoneIsland/www/js/lib/products/ProductView.js +++ b/StoneIsland/www/js/lib/products/ProductView.js @@ -56,12 +56,11 @@ var ProductView = ScrollableView.extend({ this.el.className = "loading" } sdk.product.item({ - code: code, - success: function(details){ - this.cache[code] = details - this.populate(data, details) - }.bind(this), - }) + code: code + }).done(function(details){ + this.cache[code] = details + this.populate(data, details) + }.bind(this)) }, populate: function(data, details){ diff --git a/StoneIsland/www/js/sdk/account.js b/StoneIsland/www/js/sdk/account.js index 3dfe2cfe..7e7eb3dc 100644 --- a/StoneIsland/www/js/sdk/account.js +++ b/StoneIsland/www/js/sdk/account.js @@ -5,7 +5,7 @@ sdk.account = (function(){ // https://gist.github.com/fanfare/d18498e7fa25acbd4486 var account = {} account.signup = function(opt){ - $.ajax({ + return $.ajax({ method: "POST", url: sdk.path("Account.API/1.5", "users.json"), headers: { @@ -26,7 +26,7 @@ sdk.account = (function(){ } account.login = function(opt){ - $.ajax({ + return $.ajax({ method: "POST", url: sdk.path("Account.API/1.5", "authfull.json"), headers: { diff --git a/StoneIsland/www/js/sdk/address.js b/StoneIsland/www/js/sdk/address.js index 144589d0..35eaee56 100644 --- a/StoneIsland/www/js/sdk/address.js +++ b/StoneIsland/www/js/sdk/address.js @@ -2,7 +2,7 @@ sdk.address = (function(){ var address = {} address.add = function(opt){ - $.ajax({ + return $.ajax({ method: "POST", url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/addressBook/item.json"), headers: { @@ -19,7 +19,7 @@ sdk.address = (function(){ } address.list = function(opt){ - $.ajax({ + return $.ajax({ method: "GET", url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/addressBook.json"), headers: { diff --git a/StoneIsland/www/js/sdk/cart.js b/StoneIsland/www/js/sdk/cart.js index d0c8f6df..26540f59 100644 --- a/StoneIsland/www/js/sdk/cart.js +++ b/StoneIsland/www/js/sdk/cart.js @@ -6,7 +6,7 @@ sdk.cart = (function(){ // https://gist.github.com/fanfare/9a50c524aea417d0bf3e cart.initialize = function(opt){ - $.ajax({ + return $.ajax({ method: "POST", url: sdk.path("Cart.API/1.6", "carts.json"), headers: { @@ -25,7 +25,7 @@ sdk.cart = (function(){ } cart.set_user = function(opt){ - $.ajax({ + return $.ajax({ method: "PUT", url: sdk.path("Cart.API/1.6", "user.json"), headers: { @@ -46,7 +46,7 @@ sdk.cart = (function(){ // Code10, Size, Section cart.add_item = function(opt){ - $.ajax({ + return $.ajax({ method: "POST", url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/items.json"), headers: { @@ -63,7 +63,7 @@ sdk.cart = (function(){ } cart.delete_item = function(opt){ - $.ajax({ + return $.ajax({ method: "DELETE", url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/items/" + opt.code10 + @@ -81,7 +81,7 @@ sdk.cart = (function(){ } cart.get_status = function(opt){ - $.ajax({ + return $.ajax({ method: "GET", url: sdk.path("Cart.API/1.6", "carts/" + cart.id), headers: { @@ -103,7 +103,7 @@ sdk.cart = (function(){ // NOTE: data might be wrapped in a Receiver object cart.set_shipping_address = function(opt){ - $.ajax({ + return $.ajax({ method: "PUT", url: sdk.path("Cart.API/1.6", "receiver.json"), headers: { @@ -121,7 +121,7 @@ sdk.cart = (function(){ // NB: Payment type may simply be 1 (credit card) cart.set_payment_type = function(opt){ - $.ajax({ + return $.ajax({ method: "PUT", url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/paymentType.json"), headers: { @@ -139,7 +139,7 @@ sdk.cart = (function(){ // use with full CC data if not storing it in wallet cart.set_credit_card = function(opt){ - $.ajax({ + return $.ajax({ method: "PUT", url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/creditCard.json"), headers: { @@ -159,7 +159,7 @@ sdk.cart = (function(){ // NB: if "verification number" is 1, use CVV/CID/CVC security code // if "verification number" is 2, use "Issue Number" cart.use_stored_credit_card = function(opt){ - $.ajax({ + return $.ajax({ method: "PUT", url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/userCreditCard.json"), headers: { @@ -182,7 +182,7 @@ sdk.cart = (function(){ } cart.finalize = function(opt){ - $.ajax({ + return $.ajax({ method: "PUT", url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/secureFinalizer.json"), headers: { diff --git a/StoneIsland/www/js/sdk/payment.js b/StoneIsland/www/js/sdk/payment.js index 048cde4b..0076fbf8 100644 --- a/StoneIsland/www/js/sdk/payment.js +++ b/StoneIsland/www/js/sdk/payment.js @@ -2,7 +2,7 @@ sdk.payment = (function(){ var payment = {} payment.list_credit_cards = function(opt){ - $.ajax({ + return $.ajax({ method: "GET", url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/cards.json"), headers: { @@ -19,7 +19,7 @@ sdk.payment = (function(){ } payment.add_credit_card = function(opt){ - $.ajax({ + return $.ajax({ method: "POST", url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/cards.json"), headers: { @@ -36,7 +36,7 @@ sdk.payment = (function(){ } payment.delete_credit_card = function(opt){ - $.ajax({ + return $.ajax({ method: "DELETE", url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/cards/" + opt.guid + ".json"), headers: { @@ -52,7 +52,7 @@ sdk.payment = (function(){ } payment.get_payment_types = function(opt){ - $.ajax({ + return $.ajax({ method: "GET", url: sdk.path("Cart.API/1.6", "availablePaymentTypes.json"), headers: { diff --git a/StoneIsland/www/js/sdk/product.js b/StoneIsland/www/js/sdk/product.js index a2ba30a1..2cf58452 100644 --- a/StoneIsland/www/js/sdk/product.js +++ b/StoneIsland/www/js/sdk/product.js @@ -2,7 +2,7 @@ sdk.product = (function(){ var product = {} product.collection = function(opt){ - $.ajax({ + return $.ajax({ method: "GET", url: sdk.path("Search.API/1.2", "search.json"), data: { format: "full", gallery: opt.gallery_id }, @@ -13,7 +13,7 @@ sdk.product = (function(){ // https://gist.github.com/fanfare/2d25d1b36944188948ff product.item = function(opt){ - $.ajax({ + return $.ajax({ method: "GET", url: sdk.path("Item.API/1.0", "item/" + opt.code + ".json"), success: opt.success, diff --git a/StoneIsland/www/js/sdk/shipping.js b/StoneIsland/www/js/sdk/shipping.js index 400d3199..893c1172 100644 --- a/StoneIsland/www/js/sdk/shipping.js +++ b/StoneIsland/www/js/sdk/shipping.js @@ -6,7 +6,7 @@ sdk.shipping = (function(){ // BOX TYPE shipping.get_box_types = function(opt){ - $.ajax({ + return $.ajax({ method: "GET", url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/availableBoxTypes.json"), headers: { @@ -22,7 +22,7 @@ sdk.shipping = (function(){ } shipping.set_box_type = function(opt){ - $.ajax({ + return $.ajax({ method: "PUT", url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/boxType.json"), headers: { @@ -44,7 +44,7 @@ sdk.shipping = (function(){ // DELIVERY TYPES shipping.get_delivery_types = function(opt){ - $.ajax({ + return $.ajax({ method: "GET", url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/availableDeliveryTypes.json"), headers: { @@ -60,7 +60,7 @@ sdk.shipping = (function(){ } shipping.set_delivery_type = function(opt){ - $.ajax({ + return $.ajax({ method: "PUT", url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/availableBoxTypes.json"), headers: { |
