From c75de60a2ea066e45e6a19564fde424b58f070f9 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 27 Sep 2018 18:26:57 +0200 Subject: [PATCH] wip #2208 @5 --- js/libs/fluidbook/fluidbook.menu.js | 5 +++ .../fluidbook/forms/fluidbook.form.avery.js | 33 +++++++++++++-- style/form/avery.less | 41 +++++++++++++++++++ 3 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 style/form/avery.less diff --git a/js/libs/fluidbook/fluidbook.menu.js b/js/libs/fluidbook/fluidbook.menu.js index b7eca1e4..8fd2b5f5 100644 --- a/js/libs/fluidbook/fluidbook.menu.js +++ b/js/libs/fluidbook/fluidbook.menu.js @@ -744,6 +744,11 @@ FluidbookMenu.prototype = { }); break; default: + var maxWidth = 10000; + if (m.data('maxwidth') !== null) { + maxWidth = parseInt(m.data('maxwidth')); + } + w = Math.min(w, maxWidth); break; } diff --git a/js/libs/fluidbook/forms/fluidbook.form.avery.js b/js/libs/fluidbook/forms/fluidbook.form.avery.js index 4d443b3b..0efab23c 100644 --- a/js/libs/fluidbook/forms/fluidbook.form.avery.js +++ b/js/libs/fluidbook/forms/fluidbook.form.avery.js @@ -17,10 +17,11 @@ function FluidbookAveryForm(fluidbook) { 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', + 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', + choose_activity: 'Please an activity', }, fr: { title: 'Discover what our full Avery Dennison portfolio can do for you', @@ -67,6 +68,14 @@ FluidbookAveryForm.prototype = { return false; }); + $(document).on('click', '.avery-form .submit', function () { + $this.formInstance = $(".avery-form").parsley(); + if ($this.formInstance.validate()) { + $this.sendSuggestion(); + } + return false; + }); + }, openForm: function (p1, p2, callback) { @@ -75,33 +84,49 @@ FluidbookAveryForm.prototype = { view += '
'; view += '
'; view += '
'; + view += '

' + this.locale.subtitle + '

'; + view += '
'; view += ''; + view += '
'; + view += '
'; view += ''; + view += '
'; + view += '
'; view += ''; + view += '
'; + view += '
'; view += ''; + view += '
'; view += '
'; view += $this.locale.receive; + view += '
'; view += ''; view += ''; view += '
'; view += '
'; - view += ''; + view += '
'; + view += ''; + view += '
'; + view += '
'; + view += '
'; + view += '
' + $this.locale.nothanks + '' + $this.locale.submit + '
'; view += ''; view += ''; - $("#view").append('
' + view + '
'); + $("#view").append('
' + view + '
'); var options = ['']; $.each(this.fluidbook.datas.countries, function (code, name) { diff --git a/style/form/avery.less b/style/form/avery.less new file mode 100644 index 00000000..76bfe665 --- /dev/null +++ b/style/form/avery.less @@ -0,0 +1,41 @@ +.avery-form { + h3 { + font-style: italic; + font-size: 1em; + margin-bottom: 20px; + font-weight: 400; + } + + padding: 20px 30px; + text-align: left; + + .line { + margin-bottom: 20px; + } + + input[type="text"], input[type="email"], select { + display: block; + width: 100%; + border: 0; + padding: 10px; + } + + label { + a { + text-decoration: underline; + } + } + + input[type="checkbox"] { + margin-right: 20px; + } + + .radios { + label { + margin-right: 30px; + } + input[type="radio"] { + margin-right: 20px; + } + } +} -- 2.39.5