From 189eccc46edd09e78c9683580ccf078c28d5b34e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 15 Aug 2018 13:50:35 +0200 Subject: consent modal stuff --- StoneIsland/config.xml | 2 +- .../UserInterfaceState.xcuserstate | Bin 26741 -> 26788 bytes .../ios/Stone Island/Stone Island-Info.plist | 4 ++-- StoneIsland/platforms/ios/Stone Island/config.xml | 2 +- StoneIsland/platforms/ios/www/css/nav.css | 9 +++++++- StoneIsland/platforms/ios/www/index.html | 4 ++-- StoneIsland/platforms/ios/www/js/lib/_router.js | 23 ++++++++++++++++----- .../ios/www/js/lib/account/ConsentModal.js | 13 +++++++----- .../platforms/ios/www/js/lib/auth/LogoutView.js | 2 ++ StoneIsland/www/css/nav.css | 9 +++++++- StoneIsland/www/index.html | 4 ++-- StoneIsland/www/js/lib/_router.js | 23 ++++++++++++++++----- StoneIsland/www/js/lib/account/ConsentModal.js | 13 +++++++----- StoneIsland/www/js/lib/auth/LogoutView.js | 2 ++ 14 files changed, 80 insertions(+), 30 deletions(-) diff --git a/StoneIsland/config.xml b/StoneIsland/config.xml index de7094c3..293c2416 100755 --- a/StoneIsland/config.xml +++ b/StoneIsland/config.xml @@ -1,5 +1,5 @@ - + Stone Island Stone Island 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 index 863ea504..21f93f3d 100644 Binary files a/StoneIsland/platforms/ios/Stone Island.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate and b/StoneIsland/platforms/ios/Stone Island.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist b/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist index 61399d17..578dfe3e 100644 --- a/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist +++ b/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist @@ -21,11 +21,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.5 + 1.0.6 CFBundleSignature ???? CFBundleVersion - 1.0.5 + 1.0.6 LSRequiresIPhoneOS NSMainNibFile diff --git a/StoneIsland/platforms/ios/Stone Island/config.xml b/StoneIsland/platforms/ios/Stone Island/config.xml index 4d2f9418..3b86f48b 100755 --- a/StoneIsland/platforms/ios/Stone Island/config.xml +++ b/StoneIsland/platforms/ios/Stone Island/config.xml @@ -1,5 +1,5 @@ - + diff --git a/StoneIsland/platforms/ios/www/css/nav.css b/StoneIsland/platforms/ios/www/css/nav.css index 77bc5487..b7002f20 100755 --- a/StoneIsland/platforms/ios/www/css/nav.css +++ b/StoneIsland/platforms/ios/www/css/nav.css @@ -368,7 +368,14 @@ padding-bottom:0px; color: white; border-color: black; } - +#consent_error { + opacity: 0; + color: red; + transition: 0.3s all; +} +#consent_error.visible { + opacity: 1; +} /* SELECTOR */ #selector { diff --git a/StoneIsland/platforms/ios/www/index.html b/StoneIsland/platforms/ios/www/index.html index e8816830..bdad67c8 100755 --- a/StoneIsland/platforms/ios/www/index.html +++ b/StoneIsland/platforms/ios/www/index.html @@ -1027,14 +1027,14 @@ - -

For more information, please consult our Privacy Policy or visit Customer Care.

To continue to My Account we invite you to click accept. Otherwise you can continue to navigate as an unregistered user.

+ +

diff --git a/StoneIsland/platforms/ios/www/js/lib/_router.js b/StoneIsland/platforms/ios/www/js/lib/_router.js index bd13c126..91f29b55 100755 --- a/StoneIsland/platforms/ios/www/js/lib/_router.js +++ b/StoneIsland/platforms/ios/www/js/lib/_router.js @@ -39,7 +39,9 @@ var SiteRouter = Router.extend({ '/cart/thanks': 'cart.thanks', '/cart/error': 'cart.error', }, - + + terms_routes: ['terms','account_terms','privacy','returns','care','logout'], + initialize: function(){ var fn for (var route in this.routes) { @@ -75,9 +77,7 @@ var SiteRouter = Router.extend({ default_view: function(name){ var fn = function(){ console.log(name) - if (app.demand_consent && app.consent.check()) { - return - } + var n = [name] if (app.view != app.login && app.view != app.signin) { app.last_view = app.view } @@ -85,7 +85,7 @@ var SiteRouter = Router.extend({ app.view.hide() } if (name.match(/\./)) { - var n = name.split(".") + n = name.split(".") console.log(name, n) app.view = app[n[0]][n[1]] } @@ -97,6 +97,19 @@ var SiteRouter = Router.extend({ 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' + // if ( (isCartRoute || app.demand_consent && !isTermsRoute) && app.account.consent.check()) { + // console.log('showed consent modal') + // return + // } + + var isTermsRoute = this.terms_routes.indexOf(name) !== -1 + if (app.demand_consent && !isTermsRoute && app.account.consent.check()) { + console.log('showed consent modal') + return + } }.bind(this) return fn }, diff --git a/StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js b/StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js index 22f63c53..dfeb4fac 100644 --- a/StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js +++ b/StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js @@ -13,11 +13,13 @@ var ConsentModal = View.extend({ this.$form = this.$(".form") this.$msg = this.$(".msg") this.$checkbox = this.$("[name=AccountTermsConsent]") + this.$consentError = this.$("#consent_error") }, check: function(){ var status = localStorage.getItem('account_terms.consent') if (status !== 'true') { + app.demand_consent = true this.show() return true } else { @@ -55,16 +57,17 @@ var ConsentModal = View.extend({ changeConsent: function(){ var state = this.$checkbox.prop("checked") - // if (state) { - // this.$el.addClass('consent-yes').removeClass('consent-no') - // } else { - // this.$el.addClass('consent-no').removeClass('consent-yes') - // } + if (state) { + this.$consentError.removeClass('visible') + } else { + this.$consentError.addClass('visible') + } }, proceed: function(){ var state = this.$checkbox.prop("checked") if (!state) { + this.$consentError.addClass('visible') return } app.demand_consent = false diff --git a/StoneIsland/platforms/ios/www/js/lib/auth/LogoutView.js b/StoneIsland/platforms/ios/www/js/lib/auth/LogoutView.js index 481dcb8d..89091473 100755 --- a/StoneIsland/platforms/ios/www/js/lib/auth/LogoutView.js +++ b/StoneIsland/platforms/ios/www/js/lib/auth/LogoutView.js @@ -10,6 +10,8 @@ var LogoutView = View.extend({ app.header.set_cart_count(0) app.footer.hide() auth.log_out() + app.demand_consent = false + app.account.consent.hide() app.account.logged_out() }, diff --git a/StoneIsland/www/css/nav.css b/StoneIsland/www/css/nav.css index 77bc5487..b7002f20 100755 --- a/StoneIsland/www/css/nav.css +++ b/StoneIsland/www/css/nav.css @@ -368,7 +368,14 @@ padding-bottom:0px; color: white; border-color: black; } - +#consent_error { + opacity: 0; + color: red; + transition: 0.3s all; +} +#consent_error.visible { + opacity: 1; +} /* SELECTOR */ #selector { diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index e8816830..bdad67c8 100755 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -1027,14 +1027,14 @@ - -

For more information, please consult our Privacy Policy or visit Customer Care.

To continue to My Account we invite you to click accept. Otherwise you can continue to navigate as an unregistered user.

+ +

diff --git a/StoneIsland/www/js/lib/_router.js b/StoneIsland/www/js/lib/_router.js index 1d9010ff..91f29b55 100755 --- a/StoneIsland/www/js/lib/_router.js +++ b/StoneIsland/www/js/lib/_router.js @@ -39,7 +39,9 @@ var SiteRouter = Router.extend({ '/cart/thanks': 'cart.thanks', '/cart/error': 'cart.error', }, - + + terms_routes: ['terms','account_terms','privacy','returns','care','logout'], + initialize: function(){ var fn for (var route in this.routes) { @@ -75,9 +77,7 @@ var SiteRouter = Router.extend({ default_view: function(name){ var fn = function(){ console.log(name) - if (app.demand_consent && app.account.consent.check()) { - return - } + var n = [name] if (app.view != app.login && app.view != app.signin) { app.last_view = app.view } @@ -85,7 +85,7 @@ var SiteRouter = Router.extend({ app.view.hide() } if (name.match(/\./)) { - var n = name.split(".") + n = name.split(".") console.log(name, n) app.view = app[n[0]][n[1]] } @@ -97,6 +97,19 @@ var SiteRouter = Router.extend({ 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' + // if ( (isCartRoute || app.demand_consent && !isTermsRoute) && app.account.consent.check()) { + // console.log('showed consent modal') + // return + // } + + var isTermsRoute = this.terms_routes.indexOf(name) !== -1 + if (app.demand_consent && !isTermsRoute && app.account.consent.check()) { + console.log('showed consent modal') + return + } }.bind(this) return fn }, diff --git a/StoneIsland/www/js/lib/account/ConsentModal.js b/StoneIsland/www/js/lib/account/ConsentModal.js index 22f63c53..dfeb4fac 100644 --- a/StoneIsland/www/js/lib/account/ConsentModal.js +++ b/StoneIsland/www/js/lib/account/ConsentModal.js @@ -13,11 +13,13 @@ var ConsentModal = View.extend({ this.$form = this.$(".form") this.$msg = this.$(".msg") this.$checkbox = this.$("[name=AccountTermsConsent]") + this.$consentError = this.$("#consent_error") }, check: function(){ var status = localStorage.getItem('account_terms.consent') if (status !== 'true') { + app.demand_consent = true this.show() return true } else { @@ -55,16 +57,17 @@ var ConsentModal = View.extend({ changeConsent: function(){ var state = this.$checkbox.prop("checked") - // if (state) { - // this.$el.addClass('consent-yes').removeClass('consent-no') - // } else { - // this.$el.addClass('consent-no').removeClass('consent-yes') - // } + if (state) { + this.$consentError.removeClass('visible') + } else { + this.$consentError.addClass('visible') + } }, proceed: function(){ var state = this.$checkbox.prop("checked") if (!state) { + this.$consentError.addClass('visible') return } app.demand_consent = false diff --git a/StoneIsland/www/js/lib/auth/LogoutView.js b/StoneIsland/www/js/lib/auth/LogoutView.js index 481dcb8d..89091473 100755 --- a/StoneIsland/www/js/lib/auth/LogoutView.js +++ b/StoneIsland/www/js/lib/auth/LogoutView.js @@ -10,6 +10,8 @@ var LogoutView = View.extend({ app.header.set_cart_count(0) app.footer.hide() auth.log_out() + app.demand_consent = false + app.account.consent.hide() app.account.logged_out() }, -- cgit v1.2.3-70-g09d2