]> _ Git - fluidbook-html5.git/commitdiff
wip #2208 @5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 26 Sep 2018 15:53:51 +0000 (17:53 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 26 Sep 2018 15:53:51 +0000 (17:53 +0200)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/forms/fluidbook.form.avery.js

index 3052da2d2bcfaaaf1d5784046d928a4a9e7f9cf2..e994c88ee03340f92acad5319b1614b58087db61 100644 (file)
@@ -65,7 +65,9 @@ Fluidbook.prototype = {
             this.form = new FluidbookBulleForm(this);
         } else if (this.datas.form == 'bourbon') {
             this.form = new FluidbookBourbonForm(this);
-        } else {
+        }  else if(this.datas.form=='avery'){
+            this.form = new FluidbookAveryForm(this);
+        }else{
             this.form == false;
         }
         this.privacy = new FluidbookPrivacy(this);
index 24f95d870933ecc7ec03646591a2fd1b773d3253..4d443b3bf924e400bbc49f9277421aff037045fc 100644 (file)
@@ -3,6 +3,26 @@ function FluidbookAveryForm(fluidbook) {
 
     this.locales = {
         en: {
+            title: 'Discover what our full Avery Dennison portfolio can do for you',
+            subtitle: 'Register using this form for access to our current and future digital catalogues.',
+            company: 'Company',
+            country: 'Country',
+            activity: 'Activity',
+            printer: 'Printer',
+            installer: 'Installer',
+            designer: 'Designer / Agency',
+            brandowner: 'Brand owner',
+            other: 'Other',
+            email_address: 'E-mail address',
+            receive: 'Do you want to receive our free monthly e-newsletter',
+            yes: 'Yes',
+            no: 'No',
+            consent: 'I have read and agree to the Avery Dennison Legal and Privacy Notices',
+            submit: 'Submit',
+            nothanks: 'No, thanks',
+            choose_country: 'Please choose a country',
+        },
+        fr: {
             title: 'Discover what our full Avery Dennison portfolio can do for you',
             subtitle: 'Register using this form for access to our current and future digital catalogues.',
             company: 'Company',
@@ -23,8 +43,7 @@ function FluidbookAveryForm(fluidbook) {
         }
     };
 
-    this.locale = this.locales[this.fluidbook.datas.lang];
-
+    this.locale = this.locales[this.fluidbook.l10n.getActiveLang()];
 
     this.formInstance;
     this.init();
@@ -34,6 +53,12 @@ FluidbookAveryForm.prototype = {
     init: function () {
         var $this = this;
 
+        $(this.fluidbook).on('fluidbook.splash.hide', function () {
+            $this.openForm('', '', function () {
+
+            });
+        });
+
         $(document).on('click', '.avery-form .submit', function () {
             $this.formInstance = $(".avery-form").parsley();
             if ($this.formInstance.validate()) {
@@ -44,40 +69,50 @@ FluidbookAveryForm.prototype = {
 
     },
 
-    openSuggest: function (p1, p2, callback) {
-        var view = '<div class="caption">' + this.closeButton() + '<h2>' + this.locale.title + '</h2></div>';
+    openForm: function (p1, p2, callback) {
+        var $this = this;
+        var view = '<div class="caption">' + $this.fluidbook.menu.closeButton() + '<h2>' + $this.locale.title + '</h2></div>';
         view += '<div class="content">';
         view += '<form class="avery-form" action="" method="post">';
         view += '<div>';
-        view += '<label>'.this.locale.company;
+        view += '<label>' + $this.locale.company;
         view += '<input type="text" required name="company">';
         view += '</label>';
-        view += '<label>' + this.locale.country;
-        view += '<select name="country"><option>TYPO / WORDING</option><option>CLARIFICATION REQUEST</option><option>IMPROVEMENT SUGGESTION (Gaps, Ideas, etc)</option></select>';
+        view += '<label>' + $this.locale.country;
+        view += '<select name="country"></select>';
         view += '</label>';
-        view += '<label>' + this.locale.activity;
-        view += '<select name="activity"><option value="printer">' + this.locale.printer + '</option>' +
-            '<option value="printer">' + this.locale.installer + '</option>' +
-            '<option value="designers / agency">' + this.locale.designer + '</option>' +
-            '<option value="brand owner">' + this.locale.brandowner + '</option>' +
-            '<option value="other">'+this.locale.other+'</option></select>';
+        view += '<label>' + $this.locale.activity;
+        view += '<select name="activity"><option value="printer">' + $this.locale.printer + '</option>' +
+            '<option value="printer">' + $this.locale.installer + '</option>' +
+            '<option value="designers / agency">' + $this.locale.designer + '</option>' +
+            '<option value="brand owner">' + $this.locale.brandowner + '</option>' +
+            '<option value="other">' + $this.locale.other + '</option></select>';
         view += '</label>';
-        view += '<label>'+this.locale.email_address;
+        view += '<label>' + $this.locale.email_address;
         view += '<input type="email" name="email" required>';
         view += '</label>';
         view += '<div class="line">';
-        view += this.locale.receive;
-        view += '<label class="radio"><input type="radio" name="subscribe" value="0" required>'+this.locale.yes+'</label>';
-        view += '<label class="radio"><input type="radio" name="subscribe" value="1" required>'+this.locale.no+'</label>';
+        view += $this.locale.receive;
+        view += '<label class="radio"><input type="radio" name="subscribe" value="0" required>' + $this.locale.yes + '</label>';
+        view += '<label class="radio"><input type="radio" name="subscribe" value="1" required>' + $this.locale.no + '</label>';
         view += '</div>';
         view += '</div>';
-        view += '<div class="fonctions"><a href="#" class="close">' + this.locale.nothanks + '</a><a href="#" class="submit">' + this.locale.submit + '</a></div>';
+        view += '<div class="fonctions"><a href="#" class="close">' + $this.locale.nothanks + '</a><a href="#" class="submit">' + $this.locale.submit + '</a></div>';
         view += '</form>';
         view += '</div>';
 
-        $("#view").append('<div class="mview" data-menu="suggest">' + view + '</div>');
+        $("#view").append('<div class="mview" data-menu="form">' + view + '</div>');
+
+        var options = ['<option value=""> -- ' + this.locale.choose_country + ' -- </option>'];
+        $.each(this.fluidbook.datas.countries, function (code, name) {
+            options.push('<option value="' + code + '">' + name + '</option>');
+        });
+        $(".mview select[name='country']").html(options.join(''));
+
+        this.fluidbook.menu.openingView(function () {
+            callback();
+        });
 
-        callback();
     },
     submitForm: function () {
         var $this = this;