From c2842148c6b28cb075f693a5e214cad4de15d4ec Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 17 Jun 2025 19:26:23 +0200 Subject: [PATCH] Improve UX with better labeling in person resource form --- .changes/unreleased/UX-20250617-192650.yaml | 6 ++++++ .../ChillPersonBundle/Form/PersonResourceType.php | 10 ++++------ .../Resources/views/PersonResource/form.html.twig | 12 ++++++------ .../ChillPersonBundle/translations/messages.fr.yml | 4 ++++ 4 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 .changes/unreleased/UX-20250617-192650.yaml diff --git a/.changes/unreleased/UX-20250617-192650.yaml b/.changes/unreleased/UX-20250617-192650.yaml new file mode 100644 index 000000000..810758b10 --- /dev/null +++ b/.changes/unreleased/UX-20250617-192650.yaml @@ -0,0 +1,6 @@ +kind: UX +body: Improve labeling of fields in person resource creation form +time: 2025-06-17T19:26:50.599703116+02:00 +custom: + Issue: "" + SchemaChange: No schema change diff --git a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php index 2063b0e21..1412733bc 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php @@ -16,10 +16,8 @@ use Chill\MainBundle\Form\Type\CommentType; use Chill\PersonBundle\Entity\Person\PersonResource; use Chill\PersonBundle\Entity\Person\PersonResourceKind; use Chill\PersonBundle\Form\Type\PickPersonDynamicType; -use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Chill\PersonBundle\Templating\Entity\ResourceKindRender; use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType; -use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; use Doctrine\ORM\EntityRepository; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; @@ -29,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceType extends AbstractType { - public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly TranslatorInterface $translator) {} public function buildForm(FormBuilderInterface $builder, array $options) { @@ -52,13 +50,13 @@ final class PersonResourceType extends AbstractType }, ]) ->add('person', PickPersonDynamicType::class, [ - 'label' => 'Usager', + 'label' => $this->translator->trans('person_resource.person_non_prof'), ]) ->add('thirdparty', PickThirdpartyDynamicType::class, [ - 'label' => 'Tiers', + 'label' => $this->translator->trans('person_resource.thirdparty_prof'), ]) ->add('freetext', ChillTextareaType::class, [ - 'label' => 'Description libre', + 'label' => $this->translator->trans('person_resource.freetext'), 'required' => false, ]) ->add('comment', CommentType::class, [ diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig index 9bda2856b..5542074fa 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig @@ -10,28 +10,28 @@
{% if resource is defined and resource.person is not null %} - + {% else %} - + {% endif %}
{% if resource is defined and resource.thirdparty is not null %} - + {% else %} - + {% endif %}
{% if resource is defined and resource.freeText is not null %} - + {% else %} - + {% endif %}
diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 9bce912a0..94e6083ca 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -265,6 +265,10 @@ no comment found: "Aucun commentaire" Select a type: "Choisissez un type" Select a person: "Choisissez un usager" Kind: "Type" +person_resource: + person_non_prof: "Usager/ Tiers non-professionnel" + thirdparty_prof: "Tiers professionnel" + freetext: "Description libre" # pickAPersonType