diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2022-07-12 16:38:05 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2022-07-12 16:38:05 +0200 |
| commit | 1362cb624b4187d64de858ae0c59defc1e9ec262 (patch) | |
| tree | e6d148e5dd1b775ccda11e43d33986ddfbcd6af0 | |
| parent | c6fa2d5f07da89d987ce1c57f636cd34457b2d11 (diff) | |
destroy account view cssandroid
| -rwxr-xr-x | StoneIsland/config.xml | 2 | ||||
| -rw-r--r-- | StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist | 4 | ||||
| -rw-r--r-- | StoneIsland/platforms/ios/Stone Island.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate | bin | 22618 -> 22410 bytes | |||
| -rw-r--r-- | StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist | 4 | ||||
| -rw-r--r-- | StoneIsland/platforms/ios/Stone Island/config.xml | 2 | ||||
| -rwxr-xr-x | StoneIsland/platforms/ios/www/js/lib/_router.js | 198 | ||||
| -rwxr-xr-x | StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js | 377 | ||||
| -rwxr-xr-x | StoneIsland/platforms/ios/www/js/lib/cart/CartView.js | 100 | ||||
| -rwxr-xr-x | StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js | 48 | ||||
| -rwxr-xr-x | StoneIsland/platforms/ios/www/js/lib/products/ProductView.js | 774 | ||||
| -rwxr-xr-x | StoneIsland/platforms/ios/www/js/sdk/auth.js | 237 | ||||
| -rwxr-xr-x | StoneIsland/www/css/account.css | 16 | ||||
| -rwxr-xr-x | StoneIsland/www/index.html | 25 |
13 files changed, 951 insertions, 836 deletions
diff --git a/StoneIsland/config.xml b/StoneIsland/config.xml index 6e3862e2..39c60a65 100755 --- a/StoneIsland/config.xml +++ b/StoneIsland/config.xml @@ -1,5 +1,5 @@ <?xml version='1.0' encoding='utf-8'?> -<widget id="us.okfoc.stoneisland" version="1.5.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> +<widget id="us.okfoc.stoneisland" version="1.5.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>Stone Island</name> <description> Stone Island diff --git a/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist b/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist index 6408f0cb..ca81e886 100644 --- a/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,12 +7,12 @@ <key>Cordova.xcscheme_^#shared#^_</key> <dict> <key>orderHint</key> - <integer>26</integer> + <integer>27</integer> </dict> <key>CordovaLib.xcscheme_^#shared#^_</key> <dict> <key>orderHint</key> - <integer>27</integer> + <integer>26</integer> </dict> </dict> </dict> diff --git a/StoneIsland/platforms/ios/Stone Island.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate b/StoneIsland/platforms/ios/Stone Island.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate Binary files differindex 7fc0e7dd..0f9c287f 100644 --- a/StoneIsland/platforms/ios/Stone Island.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate +++ b/StoneIsland/platforms/ios/Stone Island.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist b/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist index 702ea7b4..68fdfe2a 100644 --- a/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist +++ b/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist @@ -17,11 +17,11 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>1.5.0</string> + <string>1.5.2</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>1.5.0</string> + <string>1.5.2</string> <key>LSRequiresIPhoneOS</key> <true/> <key>NSMainNibFile</key> diff --git a/StoneIsland/platforms/ios/Stone Island/config.xml b/StoneIsland/platforms/ios/Stone Island/config.xml index 26870a5c..212e66e0 100644 --- a/StoneIsland/platforms/ios/Stone Island/config.xml +++ b/StoneIsland/platforms/ios/Stone Island/config.xml @@ -1,5 +1,5 @@ <?xml version='1.0' encoding='utf-8'?> -<widget id="us.okfoc.stoneisland" version="1.5.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> +<widget id="us.okfoc.stoneisland" version="1.5.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <feature name="CDVWebViewEngine"> <param name="ios-package" value="CDVWebViewEngine" /> </feature> diff --git a/StoneIsland/platforms/ios/www/js/lib/_router.js b/StoneIsland/platforms/ios/www/js/lib/_router.js index 7d487689..42909963 100755 --- a/StoneIsland/platforms/ios/www/js/lib/_router.js +++ b/StoneIsland/platforms/ios/www/js/lib/_router.js @@ -1,110 +1,107 @@ var SiteRouter = Router.extend({ + el: "body", + routeByHash: true, - el: 'body', - routeByHash: true, - - routes: { - '/': 'intro', - '/intro': 'intro', - '/hub': 'hub', - '/story': 'story', - '/archive': 'archive', + routes: { + "/": "intro", + "/intro": "intro", + "/hub": "hub", + "/story": "story", + "/archive": "archive", - '/store': 'collection', - '/store/closed': 'closed', - '/store/:code': 'product', + "/store": "collection", + "/store/closed": "closed", + "/store/:code": "product", - '/account/login': 'login', - '/account/logout': 'logout', - '/account/signup': 'signup', - '/account/profile': 'profile', - '/account/payment': 'payment', - '/account/shipping': 'shipping', - '/account/orders': 'orders', - '/account/settings': 'settings', + "/account/login": "login", + "/account/logout": "logout", + "/account/signup": "signup", + "/account/profile": "profile", + "/account/payment": "payment", + "/account/shipping": "shipping", + "/account/orders": "orders", + "/account/settings": "settings", - '/page/terms': 'terms', - '/page/account_terms': 'account_terms', - '/page/privacy': 'privacy', - '/page/returns': 'returns', - '/page/care': 'care', - - '/search': 'search', + "/page/terms": "terms", + "/page/account_terms": "account_terms", + "/page/privacy": "privacy", + "/page/returns": "returns", + "/page/care": "care", - '/cart': 'cart.summary', - '/cart/summary': 'cart.summary', - '/cart/payment': 'cart.payment', - '/cart/shipping': 'cart.shipping', - '/cart/confirm': 'cart.confirm', - '/cart/thanks': 'cart.thanks', - '/cart/error': 'cart.error', - }, + "/search": "search", + + "/cart": "cart.summary", + "/cart/summary": "cart.summary", + "/cart/payment": "cart.payment", + "/cart/shipping": "cart.shipping", + "/cart/confirm": "cart.confirm", + "/cart/thanks": "cart.thanks", + "/cart/error": "cart.error", + }, terms_routes: [ - 'terms', - 'account_terms', - 'privacy', - 'returns', - 'care', - 'logout', + "terms", + "account_terms", + "privacy", + "returns", + "care", + "logout", ], - initialize: function(){ - var fn + initialize: function () { + var fn; for (var route in this.routes) { - fn = this.routes[route] - if (! this[fn]) { - this[fn] = this.default_view(fn) + fn = this.routes[route]; + if (!this[fn]) { + this[fn] = this.default_view(fn); } } - }, - + }, + initial_route: null, - launch: function(){ - console.log("LAUNCH!") - if (this.initial_route) { - this.parseRoute( this.initial_route ) - } - else { - this.route() - } - this.initial_route = null + launch: function () { + console.log("LAUNCH!"); + if (this.initial_route) { + this.parseRoute(this.initial_route); + } else { + this.route(); + } + this.initial_route = null; - app.finished_launching() - }, + app.finished_launching(); + }, - go: function(url){ + go: function (url) { if (app.view && app.view.hide) { - app.view.hide() + app.view.hide(); } - window.location.href = "#/" + url - this.parseRoute(url) + window.location.href = "#/" + url; + this.parseRoute(url); }, - - default_view: function(name){ - var fn = function(){ - console.log(name) - var n = [name] + + default_view: function (name) { + var fn = function () { + console.log(name); + var n = [name]; if (app.view != app.login && app.view != app.signin) { - app.last_view = app.view + app.last_view = app.view; } if (app.view && app.view.hide) { - app.view.hide() + app.view.hide(); } if (name.match(/\./)) { - n = name.split(".") - console.log(name, n) - app.view = app[n[0]][n[1]] - } - else { - app.view = app[name] + n = name.split("."); + console.log(name, n); + app.view = app[n[0]][n[1]]; + } else { + app.view = app[name]; } // window.FirebasePlugin && window.FirebasePlugin.setScreenName(name) - analytics.sendPageView(name) - console.log("view >>", app.view) - app.header.set_back( !! app.view.back ) - app.view.show() + analytics.sendPageView(name); + console.log("view >>", app.view); + app.header.set_back(!!app.view.back); + app.view.show(); // var isTermsRoute = this.terms_routes.indexOf(name) !== -1 // var isCartRoute = n[0] === 'cart' @@ -113,28 +110,29 @@ var SiteRouter = Router.extend({ // return // } - var isNotTermsRoute = this.terms_routes.indexOf(name) === -1 - var isCartRoute = n[0] === 'cart' - var userMightActuallyViewCart = isCartRoute && auth.logged_in() - var demandingConsent = app.demand_consent && isNotTermsRoute - if ((userMightActuallyViewCart || demandingConsent) && app.account.consent.check()) { - console.log('showed consent modal') - return + var isNotTermsRoute = this.terms_routes.indexOf(name) === -1; + var isCartRoute = n[0] === "cart"; + var userMightActuallyViewCart = isCartRoute && auth.logged_in(); + var demandingConsent = app.demand_consent && isNotTermsRoute; + if ( + (userMightActuallyViewCart || demandingConsent) && + app.account.consent.check() + ) { + // console.log('showed consent modal') + return; } - }.bind(this) - return fn + }.bind(this); + return fn; }, - product: function(code){ + product: function (code) { if (app.view && app.view.hide) { - app.view.hide() + app.view.hide(); } - analytics.sendPageView('store/' + code) - app.view = app.product - app.header.set_back( true ) - app.product.load(code) - app.product.show() - }, - -}) - + analytics.sendPageView("store/" + code); + app.view = app.product; + app.header.set_back(true); + app.product.load(code); + app.product.show(); + }, +}); diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js index 8ae11c0d..2e572730 100755 --- a/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js +++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartSummary.js @@ -1,218 +1,241 @@ var CartSummary = ScrollableView.extend({ - el: "#cart_summary", - + template: $("#cart_summary .template").html(), - + events: { "click .remove": "remove_item", }, - + data: null, - - 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 = ScrollFactory('#cart_summary', app.iscroll_options) - this.$rows = this.$(".rows") - this.$subtotal = this.$(".subtotal") - this.$shipping = this.$(".shipping") - this.$tax = this.$(".tax") - this.$total = this.$(".total") + 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 = ScrollFactory("#cart_summary", app.iscroll_options); + + this.$rows = this.$(".rows"); + this.$subtotal = this.$(".subtotal"); + this.$shipping = this.$(".shipping"); + this.$tax = this.$(".tax"); + this.$total = this.$(".total"); }, - - show: function(){ - document.body.className = "cart" - app.cart.el.className = "summary" - window.location.hash = "#/cart/summary" - app.view = this - app.footer.hide() + + show: function () { + document.body.className = "cart"; + app.cart.el.className = "summary"; + window.location.hash = "#/cart/summary"; + app.view = this; + app.footer.hide(); + console.log("cart show"); if (auth.has_cart()) { - this.load() - } - else { - this.empty() + this.load(); + } else { + this.empty(); } }, - - load: function(){ - this.el.className = "loading" - app.footer.show("SHIPPING >") - app.curtain.show("loading") + + load: function () { + this.el.className = "loading"; + app.footer.show("SHIPPING >"); + app.curtain.show("loading"); + console.log("load cart"); + setTimeout(function () { + app.curtain.show("loading"); + }); sdk.cart.get_status({ success: this.populate.bind(this), error: this.empty.bind(this), - }) + }); }, - - populate: function(data){ - this.data = data - console.log("CART", data) - - if (! data.Cart.Items || data.Cart.Items.length == 0) { - return this.empty() + populate: function (data) { + this.data = data; + + console.log("CART", data); + + if (!data.Cart.Items || data.Cart.Items.length == 0) { + return this.empty(); } - this.parent.$steps.show() - this.updateCounts() - - this.$rows.empty() - - data.Cart.Items.forEach(function(item){ - var code_ten = item['Code10'] - var code = code_ten.substr(0, 8) - var size_id = item['Size'] + this.parent.$steps.show(); + this.updateCounts(); + + this.$rows.empty(); + + data.Cart.Items.forEach( + function (item) { + var code_ten = item["Code10"]; + var code = code_ten.substr(0, 8); + var size_id = item["Size"]; - var $el = $("<div>").addClass("cart_item_row") - $el.html("<img src='img/spinner.gif'>") - $el.data({ - code: code_ten, - size: size_id, - }) - this.$rows.append($el) - app.product.find(code, function(data, details){ - // console.log(data, details) - var descriptions = app.product.get_descriptions( details ) - // console.log(descriptions) + var $el = $("<div>").addClass("cart_item_row"); + $el.html("<img src='img/spinner.gif'>"); + $el.data({ + code: code_ten, + size: size_id, + }); + this.$rows.append($el); + app.product.find( + code, + function (data, details) { + console.log(data, details); + var descriptions = app.product.get_descriptions(details); + // console.log(descriptions) - var name_partz = descriptions['ModelNames'].split(' ') - var num = name_partz.shift() - var title = name_partz.join(' ') - var type = title_case( descriptions['MicroCategory'] ) - - var color_name, size_name - // console.log(code) - details.Item.ModelColors.some(function(color){ - if (color['Code10'] == code_ten) { - color_name = color['ColorDescription'] - // console.log(color) - return true - } - return false - }) - details.Item.ModelSizes.some(function(size){ - if (size['SizeId'] == size_id) { - // console.log(size) - size_name = size['Default']['Text'] - size_name = SIZE_LOOKUP[ size_name ] || size_name - if (! size_name && ! size['Default']['Labeled']) { - size_name = size['Default']['Text'] + " " + size['Default']['ClassFamily'] - } + var name_partz = (descriptions["ModelNames"] || "").split(" "); + var num = name_partz.shift(); + var title = name_partz.join(" "); + var type = title_case(descriptions["MicroCategory"]); - return true - } - return false - }) + var color_name, size_name; + // console.log(code) + details.Item.ModelColors.some(function (color) { + if (color["Code10"] == code_ten) { + color_name = color["ColorDescription"]; + // console.log(color) + return true; + } + return false; + }); + details.Item.ModelSizes.some(function (size) { + if (size["SizeId"] == size_id) { + // console.log(size) + size_name = size["Default"]["Text"]; + size_name = SIZE_LOOKUP[size_name] || size_name; + if (!size_name && !size["Default"]["Labeled"]) { + size_name = + size["Default"]["Text"] + + " " + + size["Default"]["ClassFamily"]; + } + + return true; + } + return false; + }); + + var t = this.template + .replace(/{{image}}/, sdk.image(item["Code10"], "11_f")) + .replace(/{{sku}}/g, num) + .replace(/{{code8}}/g, data["Code8"]) + .replace(/{{title}}/g, title) + .replace( + /{{cleantitle}}/g, + num + + " " + + stonewash(title) + + " " + + (descriptions["MicroCategory"] || "") + ) + .replace(/{{type}}/, type) + .replace(/{{size}}/g, size_name) + .replace(/{{color}}/g, color_name) + .replace(/{{quantity}}/g, 1) + .replace( + /{{price}}/, + as_cash(details.Item.Price.DiscountedPrice) + ); + $el.html(t); + this.refreshScroller(); + }.bind(this) + ); + }.bind(this) + ); - var t = this.template - .replace(/{{image}}/, sdk.image(item['Code10'], '11_f')) - .replace(/{{sku}}/g, num) - .replace(/{{code8}}/g, data['Code8']) - .replace(/{{title}}/g, title) - .replace(/{{cleantitle}}/g, num + ' ' + stonewash(title) + ' ' + descriptions['MicroCategory']) - .replace(/{{type}}/, type) - .replace(/{{size}}/g, size_name) - .replace(/{{color}}/g, color_name) - .replace(/{{quantity}}/g, 1) - .replace(/{{price}}/, as_cash(details.Item.Price.DiscountedPrice)) - $el.html(t) - this.refreshScroller() - }.bind(this)) - }.bind(this)) - if (data.Cart.Receiver && data.Cart.Receiver.City) { - app.cart.shipping.load_form( data ) + app.cart.shipping.load_form(data); } - - this.updateTotals() - this.$cart_empty.hide() - this.el.className = "full" - this.refreshScroller() - app.curtain.hide("loading") + this.updateTotals(); + + this.$cart_empty.hide(); + this.el.className = "full"; + this.refreshScroller(); + app.curtain.hide("loading"); }, - - updateCounts: function(){ - app.header.set_cart_count( this.data.Cart.Items.length ) - this.parent.setHeaderCount( this.data.Cart.Items.length ) + + updateCounts: function () { + app.header.set_cart_count(this.data.Cart.Items.length); + this.parent.setHeaderCount(this.data.Cart.Items.length); }, - - updateTotals: function(){ - var subtotal = this.data.Cart.Totals.TotalWithoutPromotions - var shipping_cost = this.data.Cart.DeliveryMethod.Selected.Amount.Total - var tax = this.data.Cart.Totals.TotalSalesTax - var total = this.data.Cart.Totals.TotalToPay - - this.$subtotal.html( as_cash(subtotal) ) - this.$shipping.html( as_cash(shipping_cost) ) - this.$tax.html( as_cash(tax) ) - this.$total.html( as_cash(total) ) - this.$(".subtotal_row").attr('aria-label', "Subtotal " + as_cash(subtotal)) - this.$(".total_row").attr('aria-label', "Total " + as_cash(total)) + + updateTotals: function () { + var subtotal = this.data.Cart.Totals.TotalWithoutPromotions; + var shipping_cost = this.data.Cart.DeliveryMethod.Selected.Amount.Total; + var tax = this.data.Cart.Totals.TotalSalesTax; + var total = this.data.Cart.Totals.TotalToPay; + + this.$subtotal.html(as_cash(subtotal)); + this.$shipping.html(as_cash(shipping_cost)); + this.$tax.html(as_cash(tax)); + this.$total.html(as_cash(total)); + this.$(".subtotal_row").attr("aria-label", "Subtotal " + as_cash(subtotal)); + this.$(".total_row").attr("aria-label", "Total " + as_cash(total)); }, - - empty: function(){ - app.footer.hide() - app.header.set_cart_count(0) - this.parent.setHeaderCount( 0 ) - this.parent.$itemcount.html("0 ITEMS") - this.el.className = "empty" - this.parent.$steps.hide() - this.$cart_empty.show() - app.curtain.hide("loading") + + empty: function () { + console.log("cart empty"); + app.footer.hide(); + app.header.set_cart_count(0); + this.parent.setHeaderCount(0); + this.parent.$itemcount.html("0 ITEMS"); + this.el.className = "empty"; + this.parent.$steps.hide(); + this.$cart_empty.show(); + app.curtain.hide("loading"); }, - save: function(){ - app.router.go('cart/shipping') + save: function () { + app.router.go("cart/shipping"); }, - - cancel: function(){ - app.router.go('intro') + + cancel: function () { + app.router.go("intro"); }, - - remove_item: function(e){ - var $el = $( e.currentTarget ).closest(".cart_item_row") - var data = $el.data() - - console.log("REMOVE FROM CART") - console.log(data.size + " " + data.code) - console.log(this.data.Cart) + remove_item: function (e) { + var $el = $(e.currentTarget).closest(".cart_item_row"); + var data = $el.data(); - this.data.Cart.Totals.TotalWithoutPromotions -= data.price - this.data.Cart.Totals.TotalToPay -= data.price - this.data.Cart.Items = this.data.Cart.Items.filter(function(item){ - return ( item['Code10'] !== data.code || item['Size'] !== data.size) - }) - - this.updateTotals() - this.updateCounts() - $el.remove() - this.refreshScroller() - - if (this.data.Cart.Items.length == 0) { - this.empty() - } - - app.curtain.show("loading") - console.log("loading") + console.log("REMOVE FROM CART"); + console.log(data.size + " " + data.code); + + console.log(this.data.Cart); + + // this.data.Cart.Totals.TotalWithoutPromotions -= data.price + // this.data.Cart.Totals.TotalToPay -= data.price + // this.data.Cart.Items = this.data.Cart.Items.filter(function(item){ + // return ( item['Code10'] !== data.code || item['Size'] !== data.size) + // }) + + // this.updateTotals() + // this.updateCounts() + // $el.remove() + // this.refreshScroller() + + // if (this.data.Cart.Items.length == 0) { + // this.empty() + // } + + app.curtain.show("loading"); + console.log("loading"); sdk.cart.delete_item({ data: { Code10: data.code, Size: data.size, }, - success: function(){ - console.log("success") - app.curtain.hide("loading") - }, - error: function(){ - app.curtain.hide("loading") - }, - }) + success: function () { + console.log("success"); + // app.curtain.hide("loading") + this.load(); + }.bind(this), + error: function () { + // app.curtain.hide("loading") + this.load(); + }.bind(this), + }); }, - -})
\ No newline at end of file +}); diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartView.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartView.js index 6ed8238f..e1ee355d 100755 --- a/StoneIsland/platforms/ios/www/js/lib/cart/CartView.js +++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartView.js @@ -1,72 +1,72 @@ var CartView = View.extend({ - el: "#cart", - + events: { "click .summary_step": "show_summary", "click .shipping_step": "show_shipping", "click .payment_step": "show_payment", }, - - initialize: function(){ - 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.error = new CartError ({ parent: this }) - - this.$steps = this.$(".steps") - this.$full_msg = this.$(".full_msg") - this.$empty_msg = this.$(".empty_msg") - this.$itemcount = this.$(".itemcount") + + initialize: function () { + 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.error = new CartError({ parent: this }); + + this.$steps = this.$(".steps"); + this.$full_msg = this.$(".full_msg"); + this.$empty_msg = this.$(".empty_msg"); + this.$itemcount = this.$(".itemcount"); }, - - load: function(){ + + load: function () { + app.curtain.show("loading"); sdk.cart.get_status({ - success: function(data){ - this.summary.data = data - this.summary.updateCounts() + success: function (data) { + this.summary.data = data; + this.summary.updateCounts(); + app.curtain.hide("loading"); }.bind(this), - error: function(data){ - console.log(data) - auth.clear_cart() + error: function (data) { + console.log(data); + auth.clear_cart(); + app.curtain.hide("loading"); }, - }) + }); }, - show: function(){ - if (! navigator.onLine) { - app.closed.showElement() - app.closed.setMessage("PLEASE GO ONLINE TO<br>VIEW YOUR CART.", "") - return + show: function () { + if (!navigator.onLine) { + app.closed.showElement(); + app.closed.setMessage("PLEASE GO ONLINE TO<br>VIEW YOUR CART.", ""); + return; } - document.body.className = "cart" - this.show_summary() + document.body.className = "cart"; + this.show_summary(); }, - - show_summary: function(){ - this.summary.show() + + show_summary: function () { + this.summary.show(); }, - - show_shipping: function(){ - this.shipping.show() + + show_shipping: function () { + this.shipping.show(); }, - - show_payment: function(){ - this.payment.show() + + show_payment: function () { + this.payment.show(); }, - setHeaderCount: function(n){ + setHeaderCount: function (n) { if (n) { - this.$itemcount.html(pluralize(n, "ITEM", "S")) - this.$full_msg.show() - this.$empty_msg.hide() - } - else { - this.$full_msg.hide() - this.$empty_msg.show() + this.$itemcount.html(pluralize(n, "ITEM", "S")); + this.$full_msg.show(); + this.$empty_msg.hide(); + } else { + this.$full_msg.hide(); + this.$empty_msg.show(); } }, - -})
\ No newline at end of file +}); diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js b/StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js index d444fd60..ccef9479 100755 --- a/StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js +++ b/StoneIsland/platforms/ios/www/js/lib/nav/CurtainView.js @@ -1,39 +1,41 @@ var CurtainView = View.extend({ - el: "#curtain", - + events: { - "click": "click", - }, - - initialize: function(){ + click: "click", }, - + + initialize: function () {}, + klass: null, - show: function(klass){ - this.$el.addClass("visible") + show: function (klass) { + console.log("show curtain"); + this.$el.addClass("visible"); if (klass) { - this.klass = klass - this.$el.addClass(klass) + this.klass = klass; + this.$el.addClass(klass); } }, - - hide: function(k){ - this.$el.removeClass("visible") + + hide: function (k) { + console.log("hide curtain"); + this.$el.removeClass("visible"); if (this.klass) { - setTimeout( function(){ - this.$el.removeClass(this.klass) - }.bind(this), 200 ) + setTimeout( + function () { + this.$el.removeClass(this.klass); + }.bind(this), + 200 + ); } }, - - click: function(){ + + click: function () { if (document.body.classList.contains("nav")) { - app.nav.hide() + app.nav.hide(); } if (app.selector.visible) { - app.selector.hide() + app.selector.hide(); } }, - -})
\ No newline at end of file +}); diff --git a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js index d467fbdd..a6c97e6b 100755 --- a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js +++ b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js @@ -1,7 +1,6 @@ var ProductView = ScrollableView.extend({ - el: "#product", - + events: { "click .fit": "scroll_to_bottom", "click .notAvailableInCanada": "scroll_to_bottom", @@ -14,54 +13,61 @@ var ProductView = ScrollableView.extend({ "click .gallery-left": "gallery_left", "click .gallery-right": "gallery_right", }, - - initialize: function(){ - this.gallery = new GalleryView () - this.scroller = ScrollFactory('#product', app.iscroll_options) - - this.$productHeader = this.$(".product-header") - this.$title = this.$(".title") - this.$type = this.$(".type") - this.$price = this.$(".price") - this.$size = this.$(".size") - this.$sizeSelect = this.$(".size select") - this.$sizeLabel = this.$(".size .label") - this.$color = this.$(".color") - this.$colorSelect = this.$(".color select") - this.$colorLabel = this.$(".color .label") - this.$share = this.$(".share") - this.$body = this.$(".body") - this.$fit = this.$(".fit") - this.$fitHeader = this.$('.fitHeader') - this.$notAvailableInCanada = this.$(".notAvailableInCanada") - this.$extraMessage = this.$(".extraMessage") - this.$sizing = this.$(".sizing") - this.$style = this.$(".style") + + initialize: function () { + this.gallery = new GalleryView(); + this.scroller = ScrollFactory("#product", app.iscroll_options); + + this.$productHeader = this.$(".product-header"); + this.$title = this.$(".title"); + this.$type = this.$(".type"); + this.$price = this.$(".price"); + this.$size = this.$(".size"); + this.$sizeSelect = this.$(".size select"); + this.$sizeLabel = this.$(".size .label"); + this.$color = this.$(".color"); + this.$colorSelect = this.$(".color select"); + this.$colorLabel = this.$(".color .label"); + this.$share = this.$(".share"); + this.$body = this.$(".body"); + this.$fit = this.$(".fit"); + this.$fitHeader = this.$(".fitHeader"); + this.$notAvailableInCanada = this.$(".notAvailableInCanada"); + this.$extraMessage = this.$(".extraMessage"); + this.$sizing = this.$(".sizing"); + this.$style = this.$(".style"); }, - show: function(){ - this.showFooter() - document.body.className = "product" + show: function () { + this.showFooter(); + document.body.className = "product"; }, - - hide: function(){ - app.footer.hide() + + hide: function () { + app.footer.hide(); }, - - showFooter: function(){ - if (this.sold_out) { - console.log("FOOTER: SOLD OUT") - app.footer.show("SOLD OUT") - } - else if (this.isNotAvailable) { - console.log("FOOTER: NOT AVAILABLE") - app.footer.show("NOT AVAILABLE") - } - else { - app.footer.show("ADD TO CART", "BUY NOW") + + showFooter: function () { + var descriptions = this.details ? this.get_descriptions(this.details) : {}; + if ( + (this.sold_out || this.isNotAvailable) && + descriptions["Limited_Edition"] + ) { + // this.$extraMessage.html(stripHTML( descriptions['Limited_Edition'] )) + // this.$extraMessage.show() + console.log("FOOTER: LIMITED EDITION"); + app.footer.show(stripHTML(descriptions["Limited_Edition"])); + } else if (this.sold_out) { + console.log("FOOTER: SOLD OUT"); + app.footer.show("SOLD OUT"); + } else if (this.isNotAvailable) { + console.log("FOOTER: NOT AVAILABLE"); + app.footer.show("NOT AVAILABLE"); + } else { + app.footer.show("ADD TO CART", "BUY NOW"); } }, - + item: null, details: null, size: null, @@ -72,445 +78,489 @@ var ProductView = ScrollableView.extend({ sizes: null, colors: null, - + cache: {}, - - gallery_left: function(){ - app.product.gallery.previous() + + gallery_left: function () { + app.product.gallery.previous(); }, - gallery_right: function(){ - app.product.gallery.next() + gallery_right: function () { + app.product.gallery.next(); }, - - find: function(code, cb){ - data = app.collection.items[code] || {} + + find: function (code, cb) { + data = app.collection.items[code] || {}; if (code in this.cache) { - return cb(data, this.cache[code]) + return cb(data, this.cache[code]); } sdk.product.item({ code: code, - success: function(details){ - this.cache[code] = details - cb(data, details) - }.bind(this) - }) + success: function (details) { + this.cache[code] = details; + cb(data, details); + }.bind(this), + }); }, - load: function(code, data){ - this.gallery.reset() - this.show() + load: function (code, data) { + this.gallery.reset(); + this.show(); if (app.view && app.view.hide) { - app.view.hide() - } - app.view = this - app.header.set_back(true) - - if (! app.collection.loaded) { - this.el.className = "loading" - app.collection.afterFetchCallback = this.load.bind(this, code, data) - app.collection.fetch() - return + app.view.hide(); } - else { - app.collection.afterFetchCallback = null + app.view = this; + app.header.set_back(true); + + if (!app.collection.loaded) { + this.el.className = "loading"; + app.collection.afterFetchCallback = this.load.bind(this, code, data); + app.collection.fetch(); + return; + } else { + app.collection.afterFetchCallback = null; } - window.location.href = "#/store/" + code - + window.location.href = "#/store/" + code; + if (data) { - app.collection.items[code] = data + app.collection.items[code] = data; } - - this.el.className = "loading" - this.find(code, this.populate.bind(this)) + + this.el.className = "loading"; + this.find(code, this.populate.bind(this)); }, - populate: function(data, details){ - this.el.className = "" + populate: function (data, details) { + this.el.className = ""; - console.log(data, details) + console.log(data, details); - var descriptions = this.get_descriptions(details) + var descriptions = this.get_descriptions(details["Item"]); - var title = data['ModelNames'] || "" - var type = title_case( data['MicroCategory'] ) - var price = "$" + data['DiscountedPrice'] + ".00" - var details_description = descriptions['Details'] || "" - var editorial = descriptions['EditorialDescription'] || "" - var body = details_description + " " + editorial + var title = data["ModelNames"] || ""; + var type = title_case(data["MicroCategory"]); + var price = "$" + data["DiscountedPrice"] + ".00"; + var details_description = descriptions["Details"] || ""; + var editorial = descriptions["EditorialDescription"] || ""; + var body = details_description + " " + editorial; // body = body.replace(/<br>/g, "<br><br>").replace(/(<br>)+$/, "") - var default_color_id = this.populate_selectors(data, details) + var default_color_id = this.populate_selectors(data, details); - var notAvailableInCanada = !! app.store.NotAvailableInCanada - app.product.$notAvailableInCanada.toggle( notAvailableInCanada ) + var notAvailableInCanada = !!app.store.NotAvailableInCanada; + app.product.$notAvailableInCanada.toggle(notAvailableInCanada); - if (! ('Price' in details['Item'])) { - console.log("NO PRICE, IS NOT AVAILABLE") - this.isNotAvailable = true - } - else { - console.log("FOUND PRICE, IS AVAILABLE") - this.isNotAvailable = false + if (!("Price" in details["Item"])) { + console.log("NO PRICE, IS NOT AVAILABLE"); + this.isNotAvailable = true; + } else { + console.log("FOUND PRICE, IS AVAILABLE"); + this.isNotAvailable = false; } + this.$extraMessage.hide(); + if (this.sold_out || this.isNotAvailable) { - this.$style.css("opacity", 0) - this.$color.html("NOT AVAILABLE") - this.$size.hide() - this.gallery.populate( data['Code8'], details['Item']['ImageTypes'] ) - } - else { - this.$style.css("opacity", 1) + this.$style.css("opacity", 0); + this.$color.html("NOT AVAILABLE"); + this.$size.hide(); + this.gallery.populate(data["Code8"], details["Item"]["ImageTypes"]); + } else { + this.$style.css("opacity", 1); - var color = this.colors[default_color_id] - var color_label = color.label - var sizes = this.find_sizes_for_color(default_color_id) - var size = sizes[0] - var size_label = this.sizes[size].label + var color = this.colors[default_color_id]; + var color_label = color.label; + var sizes = this.find_sizes_for_color(default_color_id); + var size = sizes[0]; + var size_label = this.sizes[size].label; - this.gallery.populate( color.code, details['Item']['ImageTypes'] ) + this.gallery.populate(color.code, details["Item"]["ImageTypes"]); - this.color = color - this.size = size + this.color = color; + this.size = size; - this.is_onesize = !! this.sizes[1] - this.set_size_label(size_label) - this.set_color_label(color_label) + this.is_onesize = !!this.sizes[1]; + this.set_size_label(size_label); + this.set_color_label(color_label); } - + // console.log(color, color_label, size, size_label) - this.item = data - this.details = details['Item'] - this.code = data['DefaultCode10'] - - console.log( data['DefaultCode10'] ) + this.item = data; + this.details = details["Item"]; + this.code = data["DefaultCode10"]; + + console.log(data["DefaultCode10"]); // title += "<br>EXTREME COMPACTING ON NYLON BASE<br>LIMITED EDITION - NUMBERED 01 TO 100" - if (title.indexOf('<br>') !== -1) { - var title_lines = title.split('<br>').map(function(s){ - if (s.indexOf("LIMITED EDITION") !== -1) { - return "<span class='red'>" + s + "</span>" - } - return s - }.bind(this)) - title = title_lines.join('<br><br>') + '<br>' + if (title.indexOf("<br>") !== -1) { + var title_lines = title.split("<br>").map( + function (s) { + if (s.indexOf("LIMITED EDITION") !== -1) { + return "<span class='red'>" + s + "</span>"; + } + return s; + }.bind(this) + ); + title = title_lines.join("<br><br>") + "<br>"; } - this.$title.html(title) - this.$type.html(type) - this.$price.html(price) - this.$body.html(body) - + this.$title.html(title); + this.$type.html(type); + this.$price.html(price); + this.$body.html(body); + // window.FirebasePlugin && window.FirebasePlugin.setScreenName('product:' + code) - - this.$productHeader.toggleClass("wide", title.length > 48) - var fits_large = !!(this.fitLargeCodes[this.code]) + this.$productHeader.toggleClass("wide", title.length > 48); + + var fits_large = !!this.fitLargeCodes[this.code]; - this.showFooter() + this.showFooter(); - console.log(app.store.FitsLarge, app.store.fitsLargeText) + console.log(app.store.FitsLarge, app.store.fitsLargeText); if (fits_large) { - if (app.store.FitsLarge === 'use_alt_text' && (app.store.FitsLargeText || "").length) { - var fit_lines = app.store.FitsLargeText.replace(/</g, "<").replace(/>/g, "&rt;").split('\n').join("<br>") - this.$fitHeader.html(fit_lines) - this.$fitHeader.show() - } - else { - this.$fitHeader.hide() + if ( + app.store.FitsLarge === "use_alt_text" && + (app.store.FitsLargeText || "").length + ) { + var fit_lines = app.store.FitsLargeText.replace(/</g, "<") + .replace(/>/g, "&rt;") + .split("\n") + .join("<br>"); + this.$fitHeader.html(fit_lines); + this.$fitHeader.show(); + } else { + this.$fitHeader.hide(); } - this.$fit.show() + this.$fit.show(); - if (app.store.SizingFooter === 'use_alt_text' && (app.store.SizingFooterText || "").length) { - var sizing_lines = app.store.SizingFooterText.replace(/</g, "<").replace(/>/g, "&rt;").split('\n').join("<br>") - this.$sizing.html(sizing_lines) - this.$sizing.show() - } else if (app.store.SizingFooter === 'true') { - this.$sizing.show() + if ( + app.store.SizingFooter === "use_alt_text" && + (app.store.SizingFooterText || "").length + ) { + var sizing_lines = app.store.SizingFooterText.replace(/</g, "<") + .replace(/>/g, "&rt;") + .split("\n") + .join("<br>"); + this.$sizing.html(sizing_lines); + this.$sizing.show(); + } else if (app.store.SizingFooter === "true") { + this.$sizing.show(); } } else { - this.$fitHeader.hide() - this.$fit.hide() - this.$sizing.hide() - } - - this.$extraMessage.hide() - if (descriptions['Limited_Edition']) { - this.$extraMessage.html(stripHTML( descriptions['Limited_Edition'] )) - this.$extraMessage.show() - app.footer.show(stripHTML( descriptions['Limited_Edition'] )) + this.$fitHeader.hide(); + this.$fit.hide(); + this.$sizing.hide(); } - this.populate_sizes() - this.populate_colors() + this.populate_sizes(); + this.populate_colors(); - this.deferScrollToTop() + this.deferScrollToTop(); }, - get_descriptions: function (details){ - var descriptions = {} - details['Item']['Descriptions'].forEach(function(pair){ - descriptions[pair.Key] = pair.Value - }) - return descriptions + get_descriptions: function (details) { + var descriptions = {}; + (details["Descriptions"] || []).forEach(function (pair) { + descriptions[pair.Key] = pair.Value; + }); + return descriptions; }, - find_sizes_for_color: function(color_id){ - return Object.keys( this.colors[color_id].sizes ).sort(function(a,b){ - var ao = SIZE_ORDER[ a.label ], bo = SIZE_ORDER[ b.label ] - return ao<bo?-1:ao==bo?0:1 - }) + find_sizes_for_color: function (color_id) { + return Object.keys(this.colors[color_id].sizes).sort(function (a, b) { + var ao = SIZE_ORDER[a.label], + bo = SIZE_ORDER[b.label]; + return ao < bo ? -1 : ao == bo ? 0 : 1; + }); }, - find_colors_for_size: function(size_id){ - return Object.keys( this.sizes[size_id].colors ) + find_colors_for_size: function (size_id) { + return Object.keys(this.sizes[size_id].colors); }, - - populate_selectors: function(data, details){ - var sizes = {}, colors = {}, size_lookup = {}, default_color - var modelColors = details['Item']['ModelColors'] || [] - console.log('colors:', modelColors.length || "none") + populate_selectors: function (data, details) { + var sizes = {}, + colors = {}, + size_lookup = {}, + default_color; - if (! modelColors.length) { - this.sold_out = true - return - } - else { - this.sold_out = false + var modelColors = details["Item"]["ModelColors"] || []; + console.log("colors:", modelColors.length || "none"); + + if (!modelColors.length) { + this.sold_out = true; + return; + } else { + this.sold_out = false; } - - modelColors.forEach(function(color, index){ - if (! default_color || color['Code10'] == data['DefaultCode10']) { - default_color = color['ColorId'] + + modelColors.forEach(function (color, index) { + if (!default_color || color["Code10"] == data["DefaultCode10"]) { + default_color = color["ColorId"]; } - colors[ color['ColorId'] ] = { - id: color['Code10'], - code: color['Code10'], - label: color['ColorDescription'].toUpperCase(), + colors[color["ColorId"]] = { + id: color["Code10"], + code: color["Code10"], + label: color["ColorDescription"].toUpperCase(), sizes: {}, - } - }) + }; + }); - details['Item']['ModelSizes'].forEach(function(size){ - var label = "" - if (details['Item']['SizeTypeId'] == 412) { // shoes - label = size['Default']['Text'] + " " + size['Default']['ClassFamily'] - console.log("shoes?", label) - } - else { // everything else - label = SIZE_LOOKUP[ size['Default']['Text'] ] + details["Item"]["ModelSizes"].forEach(function (size) { + var label = ""; + if (details["Item"]["SizeTypeId"] == 412) { + // shoes + label = size["Default"]["Text"] + " " + size["Default"]["ClassFamily"]; + console.log("shoes?", label); + } else { + // everything else + label = SIZE_LOOKUP[size["Default"]["Text"]]; } - if (! label) { - label = size['Default']['Text'] - if (size['Default']['Labeled']) { - label += " " + size['Default']['ClassFamily'] + if (!label) { + label = size["Default"]["Text"]; + if (size["Default"]["Labeled"]) { + label += " " + size["Default"]["ClassFamily"]; } } - console.log(size) - size_lookup[ label ] = size['SizeId'] - console.log( label ) - sizes[ size['SizeId'] ] = { + console.log(size); + size_lookup[label] = size["SizeId"]; + console.log(label); + sizes[size["SizeId"]] = { id: label, label: label.toUpperCase(), - value: size['SizeId'], + value: size["SizeId"], colors: {}, - } - }) - details['Item']['ModelColorSize'].forEach(function(cs){ - colors[ cs['IdColor'] ].sizes[ cs['IdSize'] ] = true - sizes[ cs['IdSize'] ].colors[ cs['IdColor'] ] = true - }) - - this.sizes = sizes - this.colors = colors + }; + }); + details["Item"]["ModelColorSize"].forEach(function (cs) { + colors[cs["IdColor"]].sizes[cs["IdSize"]] = true; + sizes[cs["IdSize"]].colors[cs["IdColor"]] = true; + }); + + this.sizes = sizes; + this.colors = colors; // console.log('populated colors', sizes, colors, default_color) - return default_color + return default_color; }, - populate_sizes: function() { - console.log(this.sold_out, this.notAvailable, this.is_onesize, this.item) - if (this.sold_out) { return } - if (this.notAvailable) { return } + populate_sizes: function () { + console.log(this.sold_out, this.notAvailable, this.is_onesize, this.item); + if (this.sold_out) { + return; + } + if (this.notAvailable) { + return; + } // if (this.is_onesize) { return this.select_color() } - if (this.details['ModelSizes'].length == 0) { return } + if (this.details["ModelSizes"].length == 0) { + return; + } - this.$sizeSelect.empty() - var sizes = Object.keys(this.sizes).forEach(function(key){ - var size = this.sizes[key] - var option = document.createElement('option') - option.value = size.value - option.innerHTML = size.label - if (this.size && size.id === this.size.id) { - option.selected = true - } - this.$sizeSelect.append(option) - }.bind(this)) + this.$sizeSelect.empty(); + var sizes = Object.keys(this.sizes).forEach( + function (key) { + var size = this.sizes[key]; + var option = document.createElement("option"); + option.value = size.value; + option.innerHTML = size.label; + if (this.size && size.id === this.size.id) { + option.selected = true; + } + this.$sizeSelect.append(option); + }.bind(this) + ); }, - populate_colors: function() { - if (this.sold_out) { return } - if (this.notAvailable) { return } - if (this.details['ModelColors'].length == 0) { return } - console.log('populate colors', this.color) + populate_colors: function () { + if (this.sold_out) { + return; + } + if (this.notAvailable) { + return; + } + if (this.details["ModelColors"].length == 0) { + return; + } + console.log("populate colors", this.color); - this.$colorSelect.empty() - Object.keys(this.colors).forEach(function(key){ - var color = this.colors[key] - console.log(color) - var option = document.createElement('option') - option.value = key - option.innerHTML = color.label - if (this.color && color.id === this.color.id) { - option.selected = true - } - this.$colorSelect.append(option) - }.bind(this)) + this.$colorSelect.empty(); + Object.keys(this.colors).forEach( + function (key) { + var color = this.colors[key]; + console.log(color); + var option = document.createElement("option"); + option.value = key; + option.innerHTML = color.label; + if (this.color && color.id === this.color.id) { + option.selected = true; + } + this.$colorSelect.append(option); + }.bind(this) + ); }, - select_size: function(){ - console.log(this.colors) - var value = this.$sizeSelect.val() - var size = this.sizes[value] - console.log('size', size) - this.set_size_label(size.label) - this.size = size.value + select_size: function () { + console.log(this.colors); + var value = this.$sizeSelect.val(); + var size = this.sizes[value]; + console.log("size", size); + this.set_size_label(size.label); + this.size = size.value; }, - - select_color: function(){ - var value = this.$colorSelect.val() - var color = this.colors[value] - console.log('color', color) - this.code = color.code - this.set_color_label(color.label) - this.gallery.populate( color.code, this.details['ImageTypes'] ) - this.gallery_right() + + select_color: function () { + var value = this.$colorSelect.val(); + var color = this.colors[value]; + console.log("color", color); + this.code = color.code; + this.set_color_label(color.label); + this.gallery.populate(color.code, this.details["ImageTypes"]); + this.gallery_right(); }, - set_size_label: function(size_label){ - this.$size.show() - this.$sizeLabel.html(size_label) - this.$size.attr('aria-label', 'Tap to select size. Current size: ' + size_label) + set_size_label: function (size_label) { + this.$size.show(); + this.$sizeLabel.html(size_label); + this.$size.attr( + "aria-label", + "Tap to select size. Current size: " + size_label + ); }, - set_color_label: function(color_label){ + set_color_label: function (color_label) { if (color_label) { - this.$color.show() - this.$colorLabel.html(color_label) - this.$color.attr('aria-label', 'Tap to select color. Current color: ' + color_label) - } - else { - this.$color.hide() + this.$color.show(); + this.$colorLabel.html(color_label); + this.$color.attr( + "aria-label", + "Tap to select color. Current color: " + color_label + ); + } else { + this.$color.hide(); } }, // ADD TO CART - save: function(){ - if (this.sold_out) { return } - if (this.notAvailable) { return } - this.add_to_cart({ route: false }) + save: function () { + if (this.sold_out) { + return; + } + if (this.notAvailable) { + return; + } + this.add_to_cart({ route: false }); }, // BUY NOW - cancel: function(){ - if (this.sold_out) { return } - if (this.notAvailable) { return } - this.add_to_cart({ route: true }) + cancel: function () { + if (this.sold_out) { + return; + } + if (this.notAvailable) { + return; + } + this.add_to_cart({ route: true }); }, - - add_to_cart: function(opt){ - var deferred_product = auth.deferred_product = { Size: this.size, Code10: this.code } - console.log("ADDING " + this.size + " " + this.code ) + + add_to_cart: function (opt) { + var deferred_product = (auth.deferred_product = { + Size: this.size, + Code10: this.code, + }); + console.log("ADDING " + this.size + " " + this.code); // if we are not logged in... - if ( ! auth.logged_in() ) { - app.router.go("account/login") - app.last_view = app.cart + if (!auth.logged_in()) { + app.router.go("account/login"); + app.last_view = app.cart; } // if we don't have a cart setup... - else if ( ! auth.has_cart() ) { - this.create_cart_and_add_product() - } - else { - app.curtain.show("loading") + else if (!auth.has_cart()) { + this.create_cart_and_add_product(); + } else { + app.curtain.show("loading"); auth.add_deferred_product_to_cart({ - success: function(){ - app.curtain.hide("loading") + success: function () { if (opt.route) { - app.router.go("cart") + app.router.go("cart"); + } else { + app.curtain.hide("loading"); } }, - error: function(err){ - console.log("CART MIGHT BE OLD") - this.create_cart_and_add_product() + error: function (err) { + console.log("CART MIGHT BE OLD"); + this.create_cart_and_add_product(); // console.log(err) - // + // // // TODO - CART MIGHT BE OLD // app.curtain.hide("loading") // app.router.go("account/login") // auth.deferred_product = deferred_product // app.last_view = app.cart }.bind(this), - }) + }); } }, - - create_cart_and_add_product: function() { - app.curtain.show("loading") + + create_cart_and_add_product: function () { + app.curtain.show("loading"); auth.create_cart({ - success: function(){ + success: function () { auth.add_deferred_product_to_cart({ - success: function(){ - app.curtain.hide("loading") - app.router.go("cart") + success: function () { + // app.curtain.hide("loading") + app.router.go("cart"); }, - error: function(){ + error: function () { // SHOULD NOT BE A PROBLEM - console.log("ERROR ADDING PRODUCT TO NEW CART SIMPLE ADD TO CART") - app.curtain.hide("loading") - app.router.go("account/login") - auth.deferred_product = deferred_product - app.last_view = app.cart + console.log("ERROR ADDING PRODUCT TO NEW CART SIMPLE ADD TO CART"); + app.curtain.hide("loading"); + app.router.go("account/login"); + auth.deferred_product = deferred_product; + app.last_view = app.cart; }, - }) + }); }, - error: function(){ + error: function () { // ERROR CREATING CART? - console.log("ERROR CREATING CART") - auth.log_out() - app.account.logged_out() - app.curtain.hide("loading") - app.router.go("account/login") - auth.deferred_product = deferred_product - app.last_view = app.cart + console.log("ERROR CREATING CART"); + auth.log_out(); + app.account.logged_out(); + app.curtain.hide("loading"); + app.router.go("account/login"); + auth.deferred_product = deferred_product; + app.last_view = app.cart; }, - }) - }, - - back: function(){ - app.router.go('store') + }); }, - - scroll_to_bottom: function(){ + + back: function () { + app.router.go("store"); }, - - share: function(){ - if (window.plugins && 'socialsharing' in window.plugins) { - window.plugins.socialsharing.share( this.item['ModelNames'], null, null, "http://deeplink.me/www.stoneisland.com/store/" + this.code) + + scroll_to_bottom: function () {}, + + share: function () { + if (window.plugins && "socialsharing" in window.plugins) { + window.plugins.socialsharing.share( + this.item["ModelNames"], + null, + null, + "http://deeplink.me/www.stoneisland.com/store/" + this.code + ); } }, - -}) +}); var SIZE_LOOKUP = { - "XS": "X-SMALL", - "S": "SMALL", - "M": "MEDIUM", - "L": "LARGE", - "XL": "X-LARGE", - "XXL": "XX-LARGE", + XS: "X-SMALL", + S: "SMALL", + M: "MEDIUM", + L: "LARGE", + XL: "X-LARGE", + XXL: "XX-LARGE", "3XL": "3X-LARGE", - "OneSize": "ONESIZE", -} + OneSize: "ONESIZE", +}; -var SIZE_ORDER = "XS S M L XL XXL 3XL".split(" ") +var SIZE_ORDER = "XS S M L XL XXL 3XL".split(" "); /* { diff --git a/StoneIsland/platforms/ios/www/js/sdk/auth.js b/StoneIsland/platforms/ios/www/js/sdk/auth.js index bcfb2d3a..55b3afdc 100755 --- a/StoneIsland/platforms/ios/www/js/sdk/auth.js +++ b/StoneIsland/platforms/ios/www/js/sdk/auth.js @@ -7,146 +7,149 @@ }, */ -var auth = sdk.auth = (function(){ - var auth = {} +var auth = (sdk.auth = (function () { + var auth = {}; - auth.appname = is_iphone ? "native-iphone-stoneisland/1.0.0" : "native-android-stoneisland/1.0.0" - auth.apikey = "U2FsdGVkX18fThqg9bF0/ZgE9Jg948hn8O9EXli4B2729nAESCQaexv//M5+7+za" - auth.device = "smartphone" + auth.appname = is_iphone + ? "native-iphone-stoneisland/1.0.0" + : "native-android-stoneisland/1.0.0"; + auth.apikey = + "U2FsdGVkX18fThqg9bF0/ZgE9Jg948hn8O9EXli4B2729nAESCQaexv//M5+7+za"; + auth.device = "smartphone"; - auth.access_token = "" - auth.user_id = -1 - - auth.next_view = null - auth.deferred_product = null + auth.access_token = ""; + auth.user_id = -1; + + auth.next_view = null; + auth.deferred_product = null; // ios: integrate keychain api // android: cordova.file.externalRootDirectory api - - auth.init = function(fn){ - console.log("AUTH INIT") - auth.get_user(function(){ + + auth.init = function (fn) { + console.log("AUTH INIT"); + auth.get_user(function () { if (auth.logged_in()) { sdk.account.checkin({ - success: function(data){ - fn && fn( auth.logged_in() ) + success: function (data) { + fn && fn(auth.logged_in()); }, - error: function(){ - auth.log_out() - fn && fn( false ) - // + error: function () { + auth.log_out(); + fn && fn(false); + // }, - }) - auth.get_cart() - } - else { - fn && fn( auth.logged_in() ) + }); + auth.get_cart(); + } else { + fn && fn(auth.logged_in()); } - }) - } - - auth.set_user = function(user_id, access_token, cb){ - auth.access_token = access_token - auth.user_id = user_id - - localStorage.setItem("yoox.access_token", access_token) - localStorage.setItem("yoox.user_id", user_id) - - window.FirebasePlugin && window.FirebasePlugin.setUserId(user_id) + }); + }; + + auth.set_user = function (user_id, access_token, cb) { + auth.access_token = access_token; + auth.user_id = user_id; + + localStorage.setItem("yoox.access_token", access_token); + localStorage.setItem("yoox.user_id", user_id); + + window.FirebasePlugin && window.FirebasePlugin.setUserId(user_id); - cb && cb() - } - auth.get_user = function(cb){ - auth.access_token = localStorage.getItem("yoox.access_token") || "" - auth.user_id = localStorage.getItem("yoox.user_id") || -1 - cb && cb() - } - auth.clear_user = function(cb){ - auth.access_token = "" - auth.user_id = -1 - localStorage.removeItem("yoox.access_token") - localStorage.removeItem("yoox.user_id") + cb && cb(); + }; + auth.get_user = function (cb) { + auth.access_token = localStorage.getItem("yoox.access_token") || ""; + auth.user_id = localStorage.getItem("yoox.user_id") || -1; + cb && cb(); + }; + auth.clear_user = function (cb) { + auth.access_token = ""; + auth.user_id = -1; + localStorage.removeItem("yoox.access_token"); + localStorage.removeItem("yoox.user_id"); - cb && cb() - } + cb && cb(); + }; - auth.set_cart = function(cart_id, cart_token, cb){ - localStorage.setItem("yoox.cart_token", cart_token) - localStorage.setItem("yoox.cart_id", cart_id) - cb && cb() - } - auth.get_cart = function(cb){ - sdk.cart.token = localStorage.getItem("yoox.cart_token") || "" - sdk.cart.id = localStorage.getItem("yoox.cart_id") || -1 - cb && cb() - } - auth.clear_cart = function(cb){ - sdk.cart.token = "" - sdk.cart.id = -1 - localStorage.removeItem("yoox.cart_token") - localStorage.removeItem("yoox.cart_id") - cb && cb() - } - auth.create_cart = function(opt){ - opt = opt || {} + auth.set_cart = function (cart_id, cart_token, cb) { + localStorage.setItem("yoox.cart_token", cart_token); + localStorage.setItem("yoox.cart_id", cart_id); + cb && cb(); + }; + auth.get_cart = function (cb) { + sdk.cart.token = localStorage.getItem("yoox.cart_token") || ""; + sdk.cart.id = localStorage.getItem("yoox.cart_id") || -1; + cb && cb(); + }; + auth.clear_cart = function (cb) { + sdk.cart.token = ""; + sdk.cart.id = -1; + localStorage.removeItem("yoox.cart_token"); + localStorage.removeItem("yoox.cart_id"); + cb && cb(); + }; + auth.create_cart = function (opt) { + opt = opt || {}; if (auth.has_cart()) { - opt.success && opt.success() - return + opt.success && opt.success(); + return; } sdk.cart.initialize({ - success: function(data){ + success: function (data) { sdk.cart.set_user({ - success: function(){ - auth.set_cart(sdk.cart.id, sdk.cart.token, function(){ - opt.success && opt.success() - }) + success: function () { + auth.set_cart(sdk.cart.id, sdk.cart.token, function () { + opt.success && opt.success(); + }); }, - error: function(){ - opt.clear_cart() - opt.error && opt.error() + error: function () { + opt.clear_cart(); + opt.error && opt.error(); }, - }) + }); }, - error: function(){ - opt.clear_cart() - opt.error && opt.error() - } - }) - } - - auth.add_deferred_product_to_cart = function(opt){ - opt = opt || {} + error: function () { + opt.clear_cart(); + opt.error && opt.error(); + }, + }); + }; + + auth.add_deferred_product_to_cart = function (opt) { + opt = opt || {}; // auth.deferred_product - if (! auth.deferred_product) { - console.log("VV NO DEFERRED PROD") - opt.success && opt.success() - return + if (!auth.deferred_product) { + console.log("VV NO DEFERRED PROD"); + opt.success && opt.success(); + return; } + console.log("ADD DEFERRED PROD"); sdk.cart.add_item({ data: auth.deferred_product, - success: function(){ - console.log("ADDED ITEM") - app.header.increment_cart_count() - opt.success && opt.success() + success: function () { + console.log("ADDED ITEM"); + app.header.increment_cart_count(); + opt.success && opt.success(); }, - error: function(data){ - console.log("ERROR ADDING ITEM") - opt.error && opt.error() + error: function (data) { + console.log("ERROR ADDING ITEM"); + opt.error && opt.error(); }, - }) - auth.deferred_product = null - } - - auth.log_out = function(){ - auth.clear_user() - auth.clear_cart() - } - auth.logged_in = function(){ - return (auth.user_id && auth.user_id !== -1 && auth.user_id !== "undefined") - } - auth.has_cart = function(){ - return (sdk.cart.id && sdk.cart.id !== -1 && sdk.cart.id !== "undefined") - } - - return auth -})()
\ No newline at end of file + }); + auth.deferred_product = null; + }; + + auth.log_out = function () { + auth.clear_user(); + auth.clear_cart(); + }; + auth.logged_in = function () { + return auth.user_id && auth.user_id !== -1 && auth.user_id !== "undefined"; + }; + auth.has_cart = function () { + return sdk.cart.id && sdk.cart.id !== -1 && sdk.cart.id !== "undefined"; + }; + + return auth; +})()); diff --git a/StoneIsland/www/css/account.css b/StoneIsland/www/css/account.css index 6ea72423..aaba77da 100755 --- a/StoneIsland/www/css/account.css +++ b/StoneIsland/www/css/account.css @@ -33,6 +33,22 @@ display: none; } +.destroy_account_view #destroy_account_view { display: block } +#destroy_account_view { + display: none; +} +#destroy_account_view button { + font-family: pfd, sans-serif; + font-size: 0.875rem; + padding: 10px; + box-sizing: border-box; + margin: 0; + border: 1px solid; + color: black; + background: white; + margin-top: 20px; +} + .orders #orders { display: block } #orders { diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index e154ee9a..18ad56ba 100755 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -54,6 +54,7 @@ <span role="menuitem" class="return_link_us">RETURNS (US)</span> <span role="menuitem" class="return_link_ca">RETURNS (CANADA)</span> <span role="menuitem" class="settings">NOTIFICATIONS</span> + <span role="menuitem" class="destroy_account">CANCEL MY ACCOUNT</span> </div> <div role="menu" aria-label="FAQ Menu" class="faq_menu"> <span role="menuitem" aria-label="Back to main menu" class="faq_back menu-emphasis">< FAQ</span> @@ -737,7 +738,28 @@ </div> </div> </div> - + + <div id="destroy_account_view" role="region" aria-label="Cancel My Account" class="page"> + <div class="scroll"> + <h1 role="menuitem" aria-label="Current section: Cancel my account">CANCEL MY ACCOUNT</h1> + <div class="content"> + <p> + We're sorry to see you go! + </p> + <p> + If you want to cancel your account, simply contact us using the form on the STONE ISLAND website. + We will delete your account within 1-3 business days. + </p> + <p> + This button will also log you out. + </p> + <p style="text-align: center"> + <button role="menuitem" class="go_destroy_account">CONTACT US</button> + </p> + </div> + </div> + </div> + <!-- CART ================================================ --> <div id="cart" role="region" aria-label="Your Cart"> @@ -1380,6 +1402,7 @@ <script src="js/lib/account/ShippingView.js"></script> <script src="js/lib/account/SettingsView.js"></script> <script src="js/lib/account/OrdersView.js"></script> +<script src="js/lib/account/DestroyAccountView.js"></script> <script src="js/lib/products/CollectionView.js"></script> <script src="js/lib/products/filters/CategoryFilter.js"></script> |
