From 74475127a118af66c20802987528baa30192f2af Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 15 Oct 2025 14:45:01 +0200 Subject: [PATCH 1/2] form styling (edit page) --- assets/styles/app.css | 11 ++++++++--- src/Form/PageType.php | 13 +++++++++++-- templates/page/_form.html.twig | 2 +- templates/page/edit.html.twig | 11 ++++++----- templates/reset_password/request.html.twig | 2 +- templates/security/login.html.twig | 2 +- templates/security/register.html.twig | 2 +- 7 files changed, 29 insertions(+), 14 deletions(-) diff --git a/assets/styles/app.css b/assets/styles/app.css index 7099f06..09537cd 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -29,16 +29,21 @@ details { border-width: 1px; } -.loginPost, .registerPost, .requestPost { +.centerForm { text-align: center; div { margin-bottom: 1rem; } + + label:not([for="registration_form_agreeTerms"], [for="_remember_me"]) { + display: block; + font-size: 15px; + } } -.textLabel, .requestPost label, .registerPost label:not([for="registration_form_agreeTerms"]) { - display: block; +.registerPost label:not([for="registration_form_agreeTerms"]) { + display: inline; font-size: 15px; } diff --git a/src/Form/PageType.php b/src/Form/PageType.php index 08cd46f..77eea3b 100644 --- a/src/Form/PageType.php +++ b/src/Form/PageType.php @@ -5,6 +5,8 @@ use App\Entity\Category; use App\Entity\Page; use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -15,11 +17,18 @@ class PageType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options): void { $builder - ->add('titleJson') - ->add('contentJson') ->add('category', EntityType::class, [ 'class' => Category::class, 'choice_label' => 'titleJson[fr]', + 'label_format' => 'Catégorie' + ]) + ->add('titleJson', TextType::class, [ + 'label_format' => 'Titre' + ]) + ->add('contentJson', TextareaType::class, [ + 'attr' => + ['rows' => 10, 'cols' => 60], + 'label_format' => 'Contenu' ]) ; diff --git a/templates/page/_form.html.twig b/templates/page/_form.html.twig index bf20b98..1f13bbd 100644 --- a/templates/page/_form.html.twig +++ b/templates/page/_form.html.twig @@ -1,4 +1,4 @@ -{{ form_start(form) }} +{{ form_start(form, {'attr': {'class': 'centerForm'}}) }} {{ form_widget(form) }} {{ form_end(form) }} diff --git a/templates/page/edit.html.twig b/templates/page/edit.html.twig index b4fc792..ab16cd7 100644 --- a/templates/page/edit.html.twig +++ b/templates/page/edit.html.twig @@ -1,13 +1,14 @@ {% extends 'base.html.twig' %} -{% block title %}Édition de page{% endblock %} +{% block title %}Modification de page{% endblock %} {% block main %} -

Édition de la page {{page.titleJson.fr}}

+
+

Modification de la page {{page.titleJson.fr}}

- {{ include('page/_form.html.twig', {'button_label': 'Modifier'}) }} + {{ include('page/_form.html.twig', {'button_label': 'Valider'}) }} - Retour à la liste + Retour - {{ include('page/_delete_form.html.twig') }} +
{% endblock %} diff --git a/templates/reset_password/request.html.twig b/templates/reset_password/request.html.twig index 679ff53..2015171 100644 --- a/templates/reset_password/request.html.twig +++ b/templates/reset_password/request.html.twig @@ -6,7 +6,7 @@ {% for flash_error in app.flashes('reset_password_error') %} {% endfor %} -
+

Réinitialiser le mot de passe

{{ form_start(requestForm) }} diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig index e8cd7af..ab7b842 100644 --- a/templates/security/login.html.twig +++ b/templates/security/login.html.twig @@ -3,7 +3,7 @@ {% block title %}Se connecter!{% endblock %} {% block main %} -
+
{% if error %}
{{ error.messageKey|trans(error.messageData, 'security') }}
diff --git a/templates/security/register.html.twig b/templates/security/register.html.twig index 8eff4da..45a7b1e 100644 --- a/templates/security/register.html.twig +++ b/templates/security/register.html.twig @@ -6,7 +6,7 @@ {% for flash_error in app.flashes('verify_email_error') %} {% endfor %} -
+

Inscription

{{ form_errors(registrationForm) }} From fb968e54ea9fe8ada151d1fc959bb1caa0062dcc Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 15 Oct 2025 15:05:06 +0200 Subject: [PATCH 2/2] smaller --- assets/styles/app.css | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/assets/styles/app.css b/assets/styles/app.css index 09537cd..371b876 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -38,15 +38,10 @@ details { label:not([for="registration_form_agreeTerms"], [for="_remember_me"]) { display: block; - font-size: 15px; + font-size: smaller; } } -.registerPost label:not([for="registration_form_agreeTerms"]) { - display: inline; - font-size: 15px; -} - .navbar { font-family: "Germania One", system-ui; font-size: 24px;