From 28553fe863564b44f810eacc0ce3f45608346297 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 24 Jul 2018 18:41:15 +0200 Subject: build the thing.... --- .../ios/www/js/lib/account/ConsentModal.js | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js (limited to 'StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js') diff --git a/StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js b/StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js new file mode 100644 index 00000000..c4fe0b53 --- /dev/null +++ b/StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js @@ -0,0 +1,76 @@ +var ConsentModal = View.extend({ + + el: "#consent_modal", + + events: { + "change [name=AccountTermsConsent]": "changeConsent", + "click #consent_proceed": "proceed", + "click #consent_logout": "logout", + "click a": "navigate", + }, + + initialize: function(){ + this.$form = this.$(".form") + this.$msg = this.$(".msg") + this.$checkbox = this.$("[name=AccountTermsConsent]") + }, + + check: function(){ + var status = localStorage.getItem('account_terms.consent') + if (status !== 'true') { + this.show() + } else { + this.hide() + } + }, + + show: function(){ + this.$el.show() + setTimeout(function(){ + this.$el.addClass('visible') + }.bind(this), 20) + app.curtain.show() + app.curtain.classList.add('opaque') + }, + + hide: function(){ + app.curtain.hide() + this.$el.removeClass('visible') + setTimeout(function(){ + this.$el.hide() + app.curtain.classList.remove('opaque') + }.bind(this), 300) + }, + + navigate: function(e){ + var href = $(e.currentTarget).attr('href').replace('#', '') + console.log(href) + this.hide() + app.router.go(href) + }, + + 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') + // } + }, + + proceed: function(){ + var state = this.$checkbox.prop("checked") + if (!state) { + return + } + this.hide() + localStorage.setItem('account_terms.consent', 'true') + }, + + logout: function(){ + this.hide() + localStorage.setItem('account_terms.consent', 'false') + app.router.go("account/logout") + }, + +}) \ No newline at end of file -- cgit v1.2.3-70-g09d2