From 1de9130ab579cf0cd67bb74003bdfd381b178018 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Mon, 30 Oct 2023 15:02:26 +0100 Subject: [PATCH] fix not displaying select on page close procedure and make the 2 buttons redirect to this page --- .../administrateurs/procedures_controller.rb | 1 + .../procedures/close.html.haml | 27 ++++++++++++------- .../administrateurs/procedures/show.html.haml | 3 +-- config/locales/models/procedure/en.yml | 1 + config/locales/models/procedure/fr.yml | 1 + .../views/administrateurs/procedures/en.yml | 1 + .../views/administrateurs/procedures/fr.yml | 1 + 7 files changed, 24 insertions(+), 11 deletions(-) diff --git a/app/controllers/administrateurs/procedures_controller.rb b/app/controllers/administrateurs/procedures_controller.rb index f7e8c44ac..0c947ea3c 100644 --- a/app/controllers/administrateurs/procedures_controller.rb +++ b/app/controllers/administrateurs/procedures_controller.rb @@ -316,6 +316,7 @@ module Administrateurs end def close + @published_procedures = current_administrateur.procedures.publiees.map { |p| ["#{p.libelle} (#{p.id})", p.id] }.to_h end def allow_expert_review diff --git a/app/views/administrateurs/procedures/close.html.haml b/app/views/administrateurs/procedures/close.html.haml index 52ed9aaa2..7e94bcb59 100644 --- a/app/views/administrateurs/procedures/close.html.haml +++ b/app/views/administrateurs/procedures/close.html.haml @@ -1,13 +1,22 @@ = render partial: 'administrateurs/breadcrumbs', locals: { steps: [['Démarches', admin_procedures_back_path(@procedure)], - ["#{@procedure.libelle.truncate_words(10)} - archiver"]], + [@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],[t('administrateurs.procedures.close.page_title')]], metadatas: true } -.container - .card - %h2.card-title - = t('administrateurs.procedures.close.replacement_procedure_title') - = form_tag admin_procedure_archive_path(@procedure), method: :put, class: "form" do - - options_from_collection_for_select = current_administrateur.procedures.publiees.map { |p| ["#{p.libelle} (#{p.id})", p.id] }.to_h - = select_tag :new_procedure, options_for_select(options_from_collection_for_select), include_blank: true - = submit_tag t('administrateurs.procedures.close.actions.close_procedure'), { class: "button primary", id: 'publish', data: { confirm: "Voulez-vous vraiment clore la démarche ? \nLes dossiers en cours pourront être instruits, mais aucun nouveau dossier ne pourra plus être déposé.", disable_with: "Archivage..."} } +.fr-container + .fr-grid-row + .fr-col-12.fr-col-offset-md-2.fr-col-md-8 + %h1= t('administrateurs.procedures.close.page_title') + + %p= t('administrateurs.procedures.close.replacement_procedure_title') + + = form_tag admin_procedure_archive_path(@procedure), method: :put, class: "form" do + - if @published_procedures.present? + .fr-select-group + = label_tag :new_procedure, class: 'fr-label' do + = t('activerecord.attributes.procedure.new_procedure') + = t('utils.no_mandatory') + + = select_tag :new_procedure, options_for_select(@published_procedures), include_blank: true, class: 'fr-select' + + = submit_tag t('administrateurs.procedures.close.actions.close_procedure'), { class: "fr-btn", id: 'publish', data: { confirm: "Voulez-vous vraiment clore la démarche ? \nLes dossiers en cours pourront être instruits, mais aucun nouveau dossier ne pourra plus être déposé.", disable_with: "Archivage..."} } diff --git a/app/views/administrateurs/procedures/show.html.haml b/app/views/administrateurs/procedures/show.html.haml index 0df9bb013..22155503b 100644 --- a/app/views/administrateurs/procedures/show.html.haml +++ b/app/views/administrateurs/procedures/show.html.haml @@ -24,8 +24,7 @@ = link_to 'Réactiver', admin_procedure_publication_path(@procedure), class: 'fr-btn fr-btn--primary fr-btn--icon-left fr-icon-success-line', id: 'publish-procedure-link', data: { disable_with: "Publication..." } - if @procedure.locked? && !@procedure.close? - = link_to 'Clore', admin_procedure_archive_path(procedure_id: @procedure.id), method: :put, class: 'fr-btn fr-btn--tertiary fr-btn--icon-left fr-icon-archive-line', id: "close-procedure-link", data: { confirm: "Voulez-vous vraiment clore la démarche ? \nLes dossiers en cours pourront être instruits, mais aucun nouveau dossier ne pourra plus être déposé.", disable_with: "Archivage..."} - + = link_to 'Clore', admin_procedure_close_path(procedure_id: @procedure.id), class: 'fr-btn fr-btn--tertiary fr-btn--icon-left fr-icon-archive-line', id: "close-procedure-link" .fr-container = render TypesDeChampEditor::ErrorsSummary.new(revision: @procedure.draft_revision) diff --git a/config/locales/models/procedure/en.yml b/config/locales/models/procedure/en.yml index f27c2c66f..d02ff7c63 100644 --- a/config/locales/models/procedure/en.yml +++ b/config/locales/models/procedure/en.yml @@ -22,6 +22,7 @@ en: description_pj_placeholder: If you leave this field blank and your form contains attachments, an automatically generated list will be displayed on the home page of your procedure. lien_site_web: Where will users find the link to the procedure? old_procedure: Replaced procedure number + new_procedure: New procedure number procedure_path: Procedure link to disseminate to users procedure_path_placeholder: procedure-name cadre_juridique: Link to the legal text diff --git a/config/locales/models/procedure/fr.yml b/config/locales/models/procedure/fr.yml index 5f12e3e9f..3b8a596c5 100644 --- a/config/locales/models/procedure/fr.yml +++ b/config/locales/models/procedure/fr.yml @@ -26,6 +26,7 @@ fr: description_pj_placeholder: Si vous ne renseignez pas ce champ et que votre formulaire contient des pièces jointes, une liste générée automatiquement s'affichera dans la page d'accueil de votre démarche. lien_site_web: Où les usagers trouveront-ils le lien vers la démarche ? old_procedure: Numéro de la démarche remplacée + new_procedure: Numéro de la nouvelle démarche procedure_path: Lien de la démarche à diffuser aux usagers procedure_path_placeholder: nom-de-la-demarche cadre_juridique: Lien vers le texte diff --git a/config/locales/views/administrateurs/procedures/en.yml b/config/locales/views/administrateurs/procedures/en.yml index 31eb2f428..8707500cf 100644 --- a/config/locales/views/administrateurs/procedures/en.yml +++ b/config/locales/views/administrateurs/procedures/en.yml @@ -2,6 +2,7 @@ en: administrateurs: procedures: close: + page_title: Close the procedure replacement_procedure_title: Is this procedure replaced by an existing one? If yes, please indicate the number of the new procedure actions: close_procedure: Close the procedure diff --git a/config/locales/views/administrateurs/procedures/fr.yml b/config/locales/views/administrateurs/procedures/fr.yml index 3442c4370..8ba995ca2 100644 --- a/config/locales/views/administrateurs/procedures/fr.yml +++ b/config/locales/views/administrateurs/procedures/fr.yml @@ -2,6 +2,7 @@ fr: administrateurs: procedures: close: + page_title: Clore la démarche replacement_procedure_title: Cette démarche est-elle remplacée par une existante ? Si oui, veuillez indiquer le n° de la nouvelle démarche actions: close_procedure: Clore la démarche