From 9f8baa8e4052713aae26350399a689cb7a0bcef3 Mon Sep 17 00:00:00 2001 From: Baptiste Date: Tue, 21 Feb 2017 14:21:15 +0100 Subject: [PATCH 1/2] choice for submit button color --- Entity/WidgetForm.php | 25 +++++++++++++++++++++ Form/WidgetFormType.php | 12 ++++++++++ Resources/translations/victoire.en.xliff | 28 ++++++++++++++++++++++++ Resources/translations/victoire.es.xliff | 28 ++++++++++++++++++++++++ Resources/translations/victoire.fr.xliff | 28 ++++++++++++++++++++++++ Resources/views/new.html.twig | 1 + Resources/views/show.html.twig | 2 +- 7 files changed, 123 insertions(+), 1 deletion(-) diff --git a/Entity/WidgetForm.php b/Entity/WidgetForm.php index 04ecc9c..4e609c7 100644 --- a/Entity/WidgetForm.php +++ b/Entity/WidgetForm.php @@ -131,6 +131,14 @@ class WidgetForm extends Widget */ protected $submitLabel; + /** + * @var string + * + * @ORM\Column(name="submit_class", type="string", length=255, nullable=true) + * @Assert\NotBlank() + */ + protected $submitClass; + /** * @ORM\OneToMany(targetEntity="Victoire\Widget\FormBundle\Entity\WidgetFormQuestion", mappedBy="form", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"position" = "ASC"}) @@ -183,6 +191,7 @@ public function __construct() parent::__construct(); $this->questions = new ArrayCollection(); $this->submitIcon = 'fa-location-arrow'; + $this->submitClass = 'primary'; } /** @@ -738,4 +747,20 @@ public function setAdminSubject($adminSubject) { $this->adminSubject = $adminSubject; } + + /** + * @return mixed + */ + public function getSubmitClass() + { + return $this->submitClass; + } + + /** + * @param mixed $submitClass + */ + public function setSubmitClass($submitClass) + { + $this->submitClass = $submitClass; + } } diff --git a/Form/WidgetFormType.php b/Form/WidgetFormType.php index 61b3bd6..2c7a373 100644 --- a/Form/WidgetFormType.php +++ b/Form/WidgetFormType.php @@ -133,6 +133,18 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => 'widget_form.form.submitIcon.label', 'required' => false, ]) + ->add('submitClass', ChoiceType::class, [ + 'label' => 'widget_form.form.submitClass.label', + 'choices' => [ + 'widget_form.form.choice.style.label.default' => 'default', + 'widget_form.form.choice.style.label.primary' => 'primary', + 'widget_form.form.choice.style.label.success' => 'success', + 'widget_form.form.choice.style.label.info' => 'info', + 'widget_form.form.choice.style.label.warning' => 'warning', + 'widget_form.form.choice.style.label.danger' => 'danger', + ], + 'choices_as_values' => true, + ]) ->add('successCallback', ChoiceType::class, [ 'label' => 'widget_form.form.successCallback.label', 'required' => true, diff --git a/Resources/translations/victoire.en.xliff b/Resources/translations/victoire.en.xliff index b1cff92..28e77b2 100644 --- a/Resources/translations/victoire.en.xliff +++ b/Resources/translations/victoire.en.xliff @@ -233,6 +233,34 @@ victoire.widget-form.successCallback.assert.badChoice Please specify an action from the dropdown menu. + + widget_form.form.submitClass.label + Submission button Style: + + + widget_form.form.choice.style.label.default + Default + + + widget_form.form.choice.style.label.primary + Principal + + + widget_form.form.choice.style.label.success + Succès + + + widget_form.form.choice.style.label.info + Informatif + + + widget_form.form.choice.style.label.warning + Avertissement + + + widget_form.form.choice.style.label.danger + Danger + diff --git a/Resources/translations/victoire.es.xliff b/Resources/translations/victoire.es.xliff index c969350..8bd59f4 100644 --- a/Resources/translations/victoire.es.xliff +++ b/Resources/translations/victoire.es.xliff @@ -233,6 +233,34 @@ victoire.widget-form.successCallback.assert.badChoice Por favor especificar una acción en el menú desplegable. + + widget_form.form.submitClass.label + Botón estilo : + + + widget_form.form.choice.style.label.default + Defecto + + + widget_form.form.choice.style.label.primary + Primario + + + widget_form.form.choice.style.label.success + éxito + + + widget_form.form.choice.style.label.info + Informativo + + + widget_form.form.choice.style.label.warning + Advertencia + + + widget_form.form.choice.style.label.danger + Peligro + diff --git a/Resources/translations/victoire.fr.xliff b/Resources/translations/victoire.fr.xliff index b98b3ce..556d2e0 100644 --- a/Resources/translations/victoire.fr.xliff +++ b/Resources/translations/victoire.fr.xliff @@ -261,6 +261,34 @@ widget_form.form.adminSubject.help_block Indiquez le sujet du message que le destinataire verra. + + widget_form.form.submitClass.label + Style du bouton de soumission: + + + widget_form.form.choice.style.label.default + Par défaut + + + widget_form.form.choice.style.label.primary + Primary + + + widget_form.form.choice.style.label.success + Succes + + + widget_form.form.choice.style.label.info + Informative + + + widget_form.form.choice.style.label.warning + Warning + + + widget_form.form.choice.style.label.danger + Danger + diff --git a/Resources/views/new.html.twig b/Resources/views/new.html.twig index 55a2e0d..a751a46 100644 --- a/Resources/views/new.html.twig +++ b/Resources/views/new.html.twig @@ -15,6 +15,7 @@
{{ form_row(form.submitIcon) }} + {{ form_row(form.submitClass) }}
diff --git a/Resources/views/show.html.twig b/Resources/views/show.html.twig index 12189ec..038f540 100644 --- a/Resources/views/show.html.twig +++ b/Resources/views/show.html.twig @@ -131,7 +131,7 @@ {% endfor %}
-