From 4fe86f9508db0d25e8db825e0e3d2fb3df0ad0ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Humeau?= Date: Fri, 21 Apr 2017 16:25:45 +0200 Subject: [PATCH 01/10] Update Victoire test suite --- victoire-test-suite | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/victoire-test-suite b/victoire-test-suite index a8ddf89..2f3e4b4 160000 --- a/victoire-test-suite +++ b/victoire-test-suite @@ -1 +1 @@ -Subproject commit a8ddf89e127d362dff2e4c7dc8f0b8ffab81bb06 +Subproject commit 2f3e4b43bae94f4262e158e3c1ce2ba3b2557702 From c92bf8398d9847d2258a2bf6375e5ed7de7d186e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Humeau?= Date: Fri, 21 Apr 2017 16:26:05 +0200 Subject: [PATCH 02/10] Add docker to Circle and launch mailcatcher --- Tests/dependencies.sh | 1 + circle.yml | 1 + 2 files changed, 2 insertions(+) create mode 100644 Tests/dependencies.sh diff --git a/Tests/dependencies.sh b/Tests/dependencies.sh new file mode 100644 index 0000000..b17ee33 --- /dev/null +++ b/Tests/dependencies.sh @@ -0,0 +1 @@ +docker run -d -p 1080:1080 -p 1025:1025 --name mailcatcher schickling/mailcatcher \ No newline at end of file diff --git a/circle.yml b/circle.yml index 662e1d3..a110fea 100644 --- a/circle.yml +++ b/circle.yml @@ -6,6 +6,7 @@ machine: en.victoire.io: 127.0.0.1 services: - redis + - docker php: version: 7.1.0 From 77b3ef5d03e523656cf9ba47f15145d89dcbb992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Humeau?= Date: Fri, 21 Apr 2017 16:26:27 +0200 Subject: [PATCH 03/10] Add swiftmailer and widget_form config --- Tests/config.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Tests/config.yml diff --git a/Tests/config.yml b/Tests/config.yml new file mode 100644 index 0000000..814298c --- /dev/null +++ b/Tests/config.yml @@ -0,0 +1,10 @@ +swiftmailer: + transport: smtp + host: 127.0.0.1 + username: ~ + password: ~ + port: 1025 + +victoire_widget_form: + default_email_address: 'darth.vador@galactic.empire.com' + default_email_label: 'Darth Vador' \ No newline at end of file From 32a84a2710619219f6cfb58d04ecd06ff34c0e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Humeau?= Date: Fri, 21 Apr 2017 16:26:48 +0200 Subject: [PATCH 04/10] Set month properly for view --- Resolver/WidgetFormContentResolver.php | 59 ++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Resolver/WidgetFormContentResolver.php diff --git a/Resolver/WidgetFormContentResolver.php b/Resolver/WidgetFormContentResolver.php new file mode 100644 index 0000000..ef4ce1c --- /dev/null +++ b/Resolver/WidgetFormContentResolver.php @@ -0,0 +1,59 @@ +currentViewHelper = $currentViewHelper; + } + + /** + * Get the static content of the widget. + * + * @param Widget $widget + * + * @return string + */ + public function getWidgetStaticContent(Widget $widget) + { + $parameters = parent::getWidgetStaticContent($widget); + $parameters = self::addMonthParameters($widget, $parameters); + + return $parameters; + } + + protected function addMonthParameters(Widget $widget, $parameters) + { + $currentView = $this->currentViewHelper->getCurrentView(); + $locale = $currentView->getCurrentLocale(); + $formatter = new IntlDateFormatter($locale, 0, 0); + + $months = []; + $date = new \DateTime(); + foreach (range(1, 12) as $monthNumber) { + $date->setDate(2012, $monthNumber, 1); + $formatter->setPattern('MMMM'); + $months[$monthNumber] = $formatter->format($date); + } + + $parameters = array_merge($parameters, [ + 'months' => $months + ]); + + return $parameters; + } +} From 0345acce4538ee11ae86225bf2a1e6f144edcfa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Humeau?= Date: Fri, 21 Apr 2017 16:31:56 +0200 Subject: [PATCH 05/10] Declare ContentResolver --- Resources/config/services.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 76c13e4..5f2604c 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -1,6 +1,9 @@ services: victoire_core.widget_form_content_resolver: - class: Victoire\Bundle\WidgetBundle\Resolver\BaseWidgetContentResolver + parent: victoire_widget.base_widget_content_resolver + class: Victoire\Widget\FormBundle\Resolver\WidgetFormContentResolver + arguments: + - '@victoire_core.current_view' tags: - { name: victoire_widget.widget_content_resolver, alias: Form } From d0d85275e9685cba7646d68b183460841abb2233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Humeau?= Date: Fri, 21 Apr 2017 16:32:15 +0200 Subject: [PATCH 06/10] Use translations for email validation --- Resources/public/js/validator.js | 2 +- Resources/translations/messages.en.xliff | 4 ++++ Resources/translations/messages.es.xliff | 4 ++++ Resources/translations/messages.fr.xliff | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Resources/public/js/validator.js b/Resources/public/js/validator.js index 2e6df32..832a1f0 100644 --- a/Resources/public/js/validator.js +++ b/Resources/public/js/validator.js @@ -6,7 +6,7 @@ $(document).ready(function () { var form_group = $(this).parents('.form-group'); if(re.test($(this).val()) !== true) { form_group.addClass('has-error'); - form_group.find('.help-block').text($(this).val() + ' n\'est pas un email valide').show(); + form_group.find('.help-block').text(Translator.trans('victoire_widget_form.email.not.valid', {'email' : $(this).val()})).show(); event.preventDefault(); } else { form_group.removeClass('has-error'); diff --git a/Resources/translations/messages.en.xliff b/Resources/translations/messages.en.xliff index 4ad6783..5eaacc5 100644 --- a/Resources/translations/messages.en.xliff +++ b/Resources/translations/messages.en.xliff @@ -66,6 +66,10 @@ victoire_widget_form.message.admin.newMessage New message: + + victoire_widget_form.email.not.valid + %email% is not a valid email + diff --git a/Resources/translations/messages.es.xliff b/Resources/translations/messages.es.xliff index f55a774..be14c59 100644 --- a/Resources/translations/messages.es.xliff +++ b/Resources/translations/messages.es.xliff @@ -66,6 +66,10 @@ victoire_widget_form.message.admin.newMessage Nuevo puesto: + + victoire_widget_form.email.not.valid + %email% no es una dirección de e-mail valida + diff --git a/Resources/translations/messages.fr.xliff b/Resources/translations/messages.fr.xliff index 00617d8..247ceaa 100644 --- a/Resources/translations/messages.fr.xliff +++ b/Resources/translations/messages.fr.xliff @@ -66,6 +66,10 @@ victoire_widget_form.message.admin.newMessage Nouveau message: + + victoire_widget_form.email.not.valid + %email% n'est pas un email valide + From 07bca484d1c07d401042a6cabaa301c5fa74981a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Humeau?= Date: Fri, 21 Apr 2017 16:32:31 +0200 Subject: [PATCH 07/10] Inverse translations --- Resources/translations/victoire.en.xliff | 18 +++++++++--------- Resources/translations/victoire.fr.xliff | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Resources/translations/victoire.en.xliff b/Resources/translations/victoire.en.xliff index 405cdfa..8b8ab98 100644 --- a/Resources/translations/victoire.en.xliff +++ b/Resources/translations/victoire.en.xliff @@ -214,23 +214,23 @@ widget_form.form.choice.style.label.default Default - + widget_form.form.choice.style.label.primary - Principal + Primary - + widget_form.form.choice.style.label.success - Succès + Succes - + widget_form.form.choice.style.label.info - Informatif + Informative - + widget_form.form.choice.style.label.warning - Avertissement + Warning - + widget_form.form.choice.style.label.danger Danger diff --git a/Resources/translations/victoire.fr.xliff b/Resources/translations/victoire.fr.xliff index c015d5e..20f5895 100644 --- a/Resources/translations/victoire.fr.xliff +++ b/Resources/translations/victoire.fr.xliff @@ -242,23 +242,23 @@ widget_form.form.choice.style.label.default Par défaut - + widget_form.form.choice.style.label.primary - Primary + Principal - + widget_form.form.choice.style.label.success - Succes + Succès - + widget_form.form.choice.style.label.info - Informative + Informatif - + widget_form.form.choice.style.label.warning - Warning + Avertissement - + widget_form.form.choice.style.label.danger Danger From 8bc2bb0f1cb86a6b1ec31b7db5f950209950c4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Humeau?= Date: Fri, 21 Apr 2017 16:32:56 +0200 Subject: [PATCH 08/10] Fix inputs name after quantum refactoring --- Resources/views/formCreatorQuestion.html.twig | 4 ++-- Resources/views/new.html.twig | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Resources/views/formCreatorQuestion.html.twig b/Resources/views/formCreatorQuestion.html.twig index 9c79ad5..30f6d65 100644 --- a/Resources/views/formCreatorQuestion.html.twig +++ b/Resources/views/formCreatorQuestion.html.twig @@ -72,12 +72,12 @@
{{ form_row(form.successCallback) }} +
+ {{ form_row(form.successMessage) }} +
{{ form_widget(form.link) }}
-
- {{ form_row(form.successMessage) }} -
{{ form_row(form.targetEmail) }} {{ form_row(form.adminSubject) }}
@@ -71,13 +71,13 @@ CKEDITOR.instances[instance].updateElement(); } }); - $vic('#static_widget_form_successCallback').on('change', function() { + $vic('#{{ quantum }}_static_widget_form_successCallback').on('change', function() { $vic('#widget-form-success-notification, #widget-form-success-redirect').addClass('hidden'); $vic('#widget-form-success-' + $vic(this).val()).removeClass('hidden'); }); $vic(document).ready(function() { - $vic('#static_widget_form_errorNotification').on('click', function() { + $vic('#{{ quantum }}_static_widget_form_errorNotification').on('click', function() { $vic('#widget-form-error-messsage').toggleClass('hidden'); }); }); From ffe7a2e49f992df9b159323c7b7e17bf785ea2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Humeau?= Date: Fri, 21 Apr 2017 16:33:31 +0200 Subject: [PATCH 09/10] Remove checkbox label and months in french in twig template --- Resources/views/show.html.twig | 2 -- 1 file changed, 2 deletions(-) diff --git a/Resources/views/show.html.twig b/Resources/views/show.html.twig index 802ee29..ab3a63e 100644 --- a/Resources/views/show.html.twig +++ b/Resources/views/show.html.twig @@ -87,7 +87,6 @@ {% if question.prefix %} {% endif %} - {{ question.type }} {% elseif question.type == "date" %} @@ -102,7 +101,6 @@ {% endfor %}