diff options
Diffstat (limited to 'StoneIsland')
| -rw-r--r-- | StoneIsland/www/css/index.css | 3 | ||||
| -rw-r--r-- | StoneIsland/www/index.html | 25 | ||||
| -rw-r--r-- | StoneIsland/www/js/index.js | 2 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/cart/CartPayment.js | 56 | ||||
| -rw-r--r-- | StoneIsland/www/js/sdk/_sdk.js | 2 |
5 files changed, 72 insertions, 16 deletions
diff --git a/StoneIsland/www/css/index.css b/StoneIsland/www/css/index.css index 0d855aeb..a67e4bcf 100644 --- a/StoneIsland/www/css/index.css +++ b/StoneIsland/www/css/index.css @@ -8,6 +8,9 @@ body, html { padding: 0px; overflow: hidden; } +body.loading { + opacity: 0; +} body { -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */ diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index cbe67700..8c7c649e 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -27,7 +27,7 @@ <link rel="stylesheet" type="text/css" href="css/blogs.css"> <title>Stone Island</title> </head> -<body> +<body class="loading"> <div id="nav"> <div id="nav-container"> @@ -689,7 +689,7 @@ <div class="billing-container container"> <div class="container-row"> - <div class="address_list checkbox-container"> + <div class="checkbox-container"> <div class="checkbox-row"> <div class="checkbox-toggle"> <input id="same-as-shipping" type="checkbox" name="SameAsShipping" value="true"> @@ -701,14 +701,14 @@ </div> </div> - <div class="dropdown-wrapper"> + <div class="address_dropdown dropdown-wrapper"> <div class="dropdown-title add_edit">add / edit</div> <div class="dropdown select_address"> BILLING ADDRESS </div> </div> <div class="address_list checkbox-container"> - <script type="text/html" class="template"> + <script type="text/html" class="address_template"> <div class="checkbox-row"> <div class="checkbox-toggle"> <input id="address-checkbox-{{id}}" type="radio" name="AddressId" value="{{id}}" {{checked}}> @@ -723,12 +723,27 @@ </script> </div> - <div class="dropdown-wrapper"> + <div class="cc_dropdown dropdown-wrapper"> <div class="dropdown-title add_edit">add / edit</div> <div class="dropdown select_address"> PAYMENT METHOD </div> </div> + + <div class="cc_list checkbox-container"> + <script type="text/html" class="cc_template"> + <div class="checkbox-row"> + <div class="checkbox-toggle"> + <input id="cc-checkbox-{{id}}" type="radio" name="CCId" value="{{id}}" {{checked}}> + <label for="cc-checkbox-{{id}}"></label> + </div> + <label class="checkbox-caption" for="cc-checkbox-{{id}}"> + XXXX XXXX XXXX {{last4}}<br> + {{type}} {{exp}} + </label> + </div> + </script> + </div> <div class="cc"></div> <div class="address"></div> diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js index ed8d9e5a..546bd637 100644 --- a/StoneIsland/www/js/index.js +++ b/StoneIsland/www/js/index.js @@ -69,6 +69,8 @@ var app = (function(){ app.view = null app.router = new SiteRouter () app.account.connect( app.router.route.bind(app.router) ) + + $("body").removeClass("loading") } return app diff --git a/StoneIsland/www/js/lib/cart/CartPayment.js b/StoneIsland/www/js/lib/cart/CartPayment.js index 90fe4a76..62dfe32d 100644 --- a/StoneIsland/www/js/lib/cart/CartPayment.js +++ b/StoneIsland/www/js/lib/cart/CartPayment.js @@ -2,11 +2,18 @@ var CartPayment = FormView.extend({ el: "#cart_payment", + address_template: $("#cart_payment .address_template").html(), + cc_template: $("#cart_payment .cc_template").html(), + action: sdk.cart.set_credit_card, + address_list_mode: false, + cc_list_mode: false, + events: { "change [name=same_as_shipping]": "toggle_shipping", - "click .dropdown-wrapper": "toggle_dropdown", + "click .address_dropdown": "toggle_address", + "click .cc_dropdown": "toggle_cc", }, initialize: function(opt){ @@ -15,6 +22,7 @@ var CartPayment = FormView.extend({ this.$msg = this.$(".msg") this.$address_list = this.$(".address_list") this.$address_form = this.$(".address") + this.$cc_list = this.$(".cc_list") this.$cc_form = this.$(".cc") this.address = new AddressView ({ parent: this, checkPhone: false }) @@ -41,28 +49,56 @@ var CartPayment = FormView.extend({ this.deferScrollToTop() }, - toggle_dropdown: function(state){ + toggle_address: function(state){ if (! app.account.ccs.length) { state = false } - this.list_mode = typeof state == "boolean" ? state : ! this.list_mode - this.address.disabled = this.list_mode - this.$address_form.toggle(! this.list_mode) - this.$cc_form.toggle(! this.list_mode) - this.$address_list.toggle(this.list_mode) + this.address_list_mode = typeof state == "boolean" ? state : ! this.list_mode + this.address.disabled = this.address_list_mode + this.$address_form.toggle(! this.address_list_mode) + this.$address_list.toggle(this.address_list_mode) + }, + + toggle_cc: function(state){ + if (! app.account.ccs.length) { + state = false + } + this.cc_list_mode = typeof state == "boolean" ? state : ! this.cc_list_mode + this.cc.disabled = this.cc_list_mode + this.$cc_form.toggle(! this.cc_list_mode) + this.$cc_list.toggle(this.cc_list_mode) }, populate: function(){ app.account.ccs.forEach(function(cc){ + console.log(cc) + + var address_t = this.address_template.replace(/{{id}}/g, cc.Id) + .replace(/{{checked}}/g, cc.IsDefault ? "checked" : "") + .replace(/{{name}}/g, cc.Name + " " + cc.Surname) + .replace(/{{address}}/g, cc.Address.replace(/\n$/,"").replace("\n", "<br>")) + .replace(/{{city}}/g, cc.City) + .replace(/{{state}}/g, cc.Province) + .replace(/{{zip}}/g, cc.ZipCode) + + var cc_t = this.cc_template.replace(/{{id}}/g, cc.Id) + .replace(/{{checked}}/g, cc.IsDefault ? "checked" : "") + .replace(/{{last4}}/g, cc.Last4) + .replace(/{{type}}/g, cc.Type) + .replace(/{{exp}}/g, cc.ExpirationMonth + "/" + cc.ExpirationYear) + + this.$address_list.append(address_t) + this.$cc_list.append(cc_t) }) }, - save: function(){ - // use stored credit card - return + success: function(){ + app.router.go('cart/confirm') }, cancel: function(){ + app.router.go('cart/shipping') }, + })
\ No newline at end of file diff --git a/StoneIsland/www/js/sdk/_sdk.js b/StoneIsland/www/js/sdk/_sdk.js index 27773310..43f539a3 100644 --- a/StoneIsland/www/js/sdk/_sdk.js +++ b/StoneIsland/www/js/sdk/_sdk.js @@ -13,7 +13,7 @@ var sdk = (function(){ break default: case 'development': - endpoint = "http://api.yoox.biz/" + endpoint = "http://stone.sup.land:9090/" break case 'production': endpoint = "https://secure.api.yoox.biz/" |
