diff options
Diffstat (limited to 'StoneIsland/platforms/ios/www/js')
| -rwxr-xr-x | StoneIsland/platforms/ios/www/js/lib/_router.js | 23 | ||||
| -rw-r--r-- | StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js | 13 | ||||
| -rwxr-xr-x | StoneIsland/platforms/ios/www/js/lib/auth/LogoutView.js | 2 |
3 files changed, 28 insertions, 10 deletions
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() }, |
