From 1c7bad2f5b70f13c84d9cccc36ac7c8740721f27 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Mon, 31 Jul 2023 23:42:01 +0200 Subject: [PATCH] style(forms): convert various legacy admin forms to dsfr --- .../search_component/search_component.html.haml | 13 ++++++------- .../_add_admin_form.html.haml | 16 ++++++++++------ .../procedure_administrateurs/index.html.haml | 7 +++---- .../procedures/_monavis.html.haml | 5 +++-- .../administrateurs/procedures/jeton.html.haml | 10 +++++----- .../administrateurs/procedures/monavis.html.haml | 3 +-- config/locales/fr.yml | 1 + 7 files changed, 29 insertions(+), 26 deletions(-) diff --git a/app/components/procedure/search_component/search_component.html.haml b/app/components/procedure/search_component/search_component.html.haml index 323a7665f..3ef7acbbe 100644 --- a/app/components/procedure/search_component/search_component.html.haml +++ b/app/components/procedure/search_component/search_component.html.haml @@ -1,11 +1,10 @@ -= form_tag(search_admin_procedures_path, data: { turbo: true }, method: :post, class: 'form') do - = label_tag :query, 'Rechercher une procédure' += form_tag(search_admin_procedures_path, data: { turbo: true }, method: :post) do + .fr-input-group + = label_tag :query, class: "fr-label" do + Rechercher une démarche + %span.fr-hint-text Saisissez au moins 3 lettres - .notice - %p Entrez au minimum 3 lettres - - - = text_field_tag :query, params[:query], required: true, placeholder: 'politique de la ville', minlength: "3" + = text_field_tag :query, params[:query], required: true, placeholder: 'politique de la ville', minlength: "3", class: "fr-input" = submit_tag 'Rechercher', class: 'fr-btn' diff --git a/app/views/administrateurs/procedure_administrateurs/_add_admin_form.html.haml b/app/views/administrateurs/procedure_administrateurs/_add_admin_form.html.haml index c469adade..ff8f3b5ae 100644 --- a/app/views/administrateurs/procedure_administrateurs/_add_admin_form.html.haml +++ b/app/views/administrateurs/procedure_administrateurs/_add_admin_form.html.haml @@ -1,9 +1,13 @@ = form_for procedure.administrateurs.new(user: User.new), url: { controller: 'procedure_administrateurs' }, - html: { class: 'form', id: "new_administrateur" }, + html: { id: "new_administrateur" }, data: { turbo: true, turbo_force: :server } do |f| - = f.label :email do - Ajouter un administrateur - %p.notice Renseignez l’email d’un administrateur déjà enregistré sur #{APPLICATION_NAME} pour lui permettre de modifier « #{procedure.libelle} ». - = f.email_field :email, placeholder: 'marie.dupont@exemple.fr', autofocus: true, required: true, disabled: disabled_as_super_admin - = f.submit 'Ajouter comme administrateur', class: 'button primary send', disabled: disabled_as_super_admin + .fr-input-group + = f.label :email, class: "fr-label" do + Ajouter un administrateur + %span.fr-hint-text + = "Renseignez l’email d’un administrateur déjà enregistré sur #{APPLICATION_NAME} pour lui permettre de modifier « #{procedure.libelle} ». Exemple : marie.dupont@exemple.fr" + + = f.email_field :email, required: true, class: "fr-input", autofocus: true, disabled: disabled_as_super_admin + + = f.submit 'Ajouter comme administrateur', class: 'fr-btn', disabled: disabled_as_super_admin diff --git a/app/views/administrateurs/procedure_administrateurs/index.html.haml b/app/views/administrateurs/procedure_administrateurs/index.html.haml index 26f43982a..0029eae3f 100644 --- a/app/views/administrateurs/procedure_administrateurs/index.html.haml +++ b/app/views/administrateurs/procedure_administrateurs/index.html.haml @@ -13,7 +13,6 @@ %th= 'État' %tbody#administrateurs = render(Procedure::ProcedureAdministrateurs::AdministrateurComponent.with_collection(@procedure.administrateurs.order('users.email'), procedure: @procedure)) - %tfoot - %tr - %th{ colspan: 4 } - = render 'add_admin_form', procedure: @procedure, disabled_as_super_admin: administrateur_as_manager? + + .fr-mt-4w + = render 'add_admin_form', procedure: @procedure, disabled_as_super_admin: administrateur_as_manager? diff --git a/app/views/administrateurs/procedures/_monavis.html.haml b/app/views/administrateurs/procedures/_monavis.html.haml index 2edd5a8d7..11d1f9ec7 100644 --- a/app/views/administrateurs/procedures/_monavis.html.haml +++ b/app/views/administrateurs/procedures/_monavis.html.haml @@ -11,5 +11,6 @@ %br Une fois en possession du code généré sur le site MonAvis, vous pouvez le coller dans le champ ci-dessous : -= f.label :monavis_embed, "Mon avis" -= f.text_area :monavis_embed, rows: '6', placeholder: 'Je donne mon avis', class: 'form-control' +.fr-input-group + = f.label :monavis_embed, "Mon avis", class: "fr-label" + = f.text_area :monavis_embed, rows: '6', placeholder: 'Je donne mon avis', class: 'fr-input' diff --git a/app/views/administrateurs/procedures/jeton.html.haml b/app/views/administrateurs/procedures/jeton.html.haml index 3a59e0be3..5f86e9817 100644 --- a/app/views/administrateurs/procedures/jeton.html.haml +++ b/app/views/administrateurs/procedures/jeton.html.haml @@ -9,7 +9,7 @@ .container %h1 - = form_with model: @procedure, url: url_for({ controller: 'administrateurs/procedures', action: :update_jeton }), html: { class: 'form' } do |f| + = form_with model: @procedure, url: url_for({ controller: 'administrateurs/procedures', action: :update_jeton }) do |f| %p.explication Démarches Simplifiées utilise = link_to 'API Entreprise', "https://entreprise.api.gouv.fr/" @@ -18,7 +18,7 @@ = link_to 'API Entreprise', "https://api.gouv.fr/les-api/api-entreprise/demande-acces" propre à votre démarche. - = f.label :api_entreprise_token, "Jeton" - = f.password_field :api_entreprise_token, value: @procedure.read_attribute(:api_entreprise_token), class: 'form-control' - .text-right - = f.button 'Enregistrer', class: 'button primary send' + .fr-input-group + = f.label :api_entreprise_token, "Jeton", class: 'fr-label' + = f.password_field :api_entreprise_token, value: @procedure.read_attribute(:api_entreprise_token), class: 'fr-input' + = f.button 'Enregistrer', class: 'fr-btn' diff --git a/app/views/administrateurs/procedures/monavis.html.haml b/app/views/administrateurs/procedures/monavis.html.haml index a48024209..2cbc3cce3 100644 --- a/app/views/administrateurs/procedures/monavis.html.haml +++ b/app/views/administrateurs/procedures/monavis.html.haml @@ -11,5 +11,4 @@ %h1 = form_for @procedure, url: url_for({ controller: 'administrateurs/procedures', action: :update_monavis }), html: { class: 'form', multipart: true } do |f| = render partial: 'monavis', locals: { f: f } - .text-right - = f.button 'Enregistrer', class: 'button primary send' + = f.button 'Enregistrer', class: 'fr-btn' diff --git a/config/locales/fr.yml b/config/locales/fr.yml index fea2eceff..09baf5997 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -309,6 +309,7 @@ fr: invite_to_edit_line1: Vous pouvez inviter quelqu’un à remplir ce dossier avec vous. invite_to_edit_line2: Cette personne aura le droit de modifier votre dossier. email: Adresse mail + email_hint: "Exemple : camilya.martin@exemple.fr" invite_message: Ajouter un message à la personne invitée (optionnel) send_invitation: Envoyer une invitation invite_to_participate: "Personnes invitées à participer à ce dossier"