summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-07-24 18:41:15 +0200
committerJules Laplace <julescarbon@gmail.com>2018-07-24 18:41:15 +0200
commit28553fe863564b44f810eacc0ce3f45608346297 (patch)
tree057febb8a68355257048ebb1eae5b5a44b2b6341 /StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js
parentb6774fedca6a535e9f863d4bb72d87f46c47a59b (diff)
build the thing....
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js')
-rw-r--r--StoneIsland/platforms/ios/www/js/lib/account/ConsentModal.js76
1 files changed, 76 insertions, 0 deletions
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