From ba8b05ed6a0a51ca13d1be178601f76bfc879867 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Mon, 27 May 2024 15:32:31 +0200 Subject: [PATCH] page MonAvis --- .../mon_avis_component.fr.yml | 2 +- .../administrateurs/procedures_controller.rb | 3 ++- .../procedures/_monavis.html.haml | 2 +- .../procedures/monavis.html.haml | 21 ++++++++++++------- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/components/procedure/card/mon_avis_component/mon_avis_component.fr.yml b/app/components/procedure/card/mon_avis_component/mon_avis_component.fr.yml index bdf8cabad..ca2c03824 100644 --- a/app/components/procedure/card/mon_avis_component/mon_avis_component.fr.yml +++ b/app/components/procedure/card/mon_avis_component/mon_avis_component.fr.yml @@ -1,3 +1,3 @@ --- fr: - title: MonAvis + title: Bouton « MonAvis » diff --git a/app/controllers/administrateurs/procedures_controller.rb b/app/controllers/administrateurs/procedures_controller.rb index 99a1a946e..1c68058ea 100644 --- a/app/controllers/administrateurs/procedures_controller.rb +++ b/app/controllers/administrateurs/procedures_controller.rb @@ -270,10 +270,11 @@ module Administrateurs def update_monavis if !@procedure.update(procedure_params) flash.now.alert = @procedure.errors.full_messages + render 'monavis' else flash.notice = 'le champ MonAvis a bien été mis à jour' + redirect_to admin_procedure_path(id: @procedure.id) end - render 'monavis' end def accuse_lecture diff --git a/app/views/administrateurs/procedures/_monavis.html.haml b/app/views/administrateurs/procedures/_monavis.html.haml index 499f22d0e..62ac9d711 100644 --- a/app/views/administrateurs/procedures/_monavis.html.haml +++ b/app/views/administrateurs/procedures/_monavis.html.haml @@ -14,5 +14,5 @@ Une fois en possession du code généré sur le site MonAvis, vous pouvez le coller dans le champ ci-dessous : .fr-input-group - = f.label :monavis_embed, "Mon avis", class: "fr-label" + = f.label :monavis_embed, "Code généré sur le site MonAvis", 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/monavis.html.haml b/app/views/administrateurs/procedures/monavis.html.haml index 2cbc3cce3..1b8189d6b 100644 --- a/app/views/administrateurs/procedures/monavis.html.haml +++ b/app/views/administrateurs/procedures/monavis.html.haml @@ -3,12 +3,19 @@ [@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)], ['MonAvis']] } -.container - %h1.page-title - Insérer un lien vers « MonAvis » +.fr-container + %h1.fr-h2 + Bouton « MonAvis » -.container - %h1 - = form_for @procedure, url: url_for({ controller: 'administrateurs/procedures', action: :update_monavis }), html: { class: 'form', multipart: true } do |f| += form_for @procedure, url: url_for({ controller: 'administrateurs/procedures', action: :update_monavis }), html: { class: 'form', multipart: true } do |f| + .fr-container = render partial: 'monavis', locals: { f: f } - = f.button 'Enregistrer', class: 'fr-btn' + + .padded-fixed-footer + .fixed-footer + .fr-container + %ul.fr-btns-group.fr-btns-group--inline-md + %li + = link_to "Annuler et revenir à l'écran de gestion", admin_procedure_path(id: @procedure), class: 'fr-btn fr-btn--secondary', data: { confirm: 'Êtes-vous sûr de vouloir annuler les modifications effectuées ?'} + %li + = f.button 'Enregistrer', class: 'fr-btn'