From fcc5d3d3494e790b4c25e4ac315052603f9d4ab6 Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 8 Mar 2022 15:41:03 +0100 Subject: [PATCH 1/4] Activity: small fixes on displaying social Issues and social Actions hidden fields --- .../ChillActivityBundle/Resources/views/Activity/edit.html.twig | 2 +- .../ChillActivityBundle/Resources/views/Activity/new.html.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig index 3da97efd6..218dc37b0 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig @@ -35,7 +35,7 @@ {{ form_row(edit_form.socialActions) }} {% endif %} -{%- if edit_form.socialIssues is defined or edit_form.socialIssues is defined -%} +{%- if edit_form.socialIssues is defined or edit_form.socialActions is defined -%}
{% endif %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig index 755e2e151..a7751cd5a 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig @@ -35,7 +35,7 @@ {{ form_row(form.socialActions) }} {% endif %} -{%- if form.socialIssues is defined or form.socialIssues is defined -%} +{%- if form.socialIssues is defined or form.socialActions is defined -%}
{% endif %} From efcc602d5310dddb7f3cef293c527a206ecbae90 Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 8 Mar 2022 16:09:22 +0100 Subject: [PATCH 2/4] Activity form: add required class name on required field built with vue --- src/Bundle/ChillActivityBundle/Form/ActivityType.php | 12 +++++++++--- .../public/vuejs/Activity/components/Location.vue | 8 +++++++- .../vuejs/Activity/components/SocialIssuesAcc.vue | 8 ++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 6f935ad99..020955851 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -125,7 +125,9 @@ class ActivityType extends AbstractType } if ($activityType->isVisible('socialIssues') && $accompanyingPeriod) { - $builder->add('socialIssues', HiddenType::class); + $builder->add('socialIssues', HiddenType::class, [ + 'required' => $activityType->getSocialIssuesVisible() === 2 + ]); $builder->get('socialIssues') ->addModelTransformer(new CallbackTransformer( static function (iterable $socialIssuesAsIterable): string { @@ -151,7 +153,9 @@ class ActivityType extends AbstractType } if ($activityType->isVisible('socialActions') && $accompanyingPeriod) { - $builder->add('socialActions', HiddenType::class); + $builder->add('socialActions', HiddenType::class, [ + 'required' => $activityType->getSocialActionsVisible() === 2 + ]); $builder->get('socialActions') ->addModelTransformer(new CallbackTransformer( static function (iterable $socialActionsAsIterable): string { @@ -338,7 +342,9 @@ class ActivityType extends AbstractType } if ($activityType->isVisible('location')) { - $builder->add('location', HiddenType::class) + $builder->add('location', HiddenType::class, [ + 'required' => $activityType->getLocationVisible() === 2 + ]) ->get('location') ->addModelTransformer(new CallbackTransformer( static function (?Location $location): string { diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue index 91c5db839..42a69e4c5 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue @@ -1,7 +1,7 @@