From 1095957fb98be6db82c63e1c6faf14201571eebc Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 6 Jan 2023 14:26:59 +0100 Subject: [PATCH] amelioration(views/instructeurs/procedures/_dossier_actions.html.haml): passe le popover de gestion d'un dossier sur la vue des dossiers sur le nouveau menu --- .../procedures/_dossier_actions.html.haml | 55 +++++++------ .../users/dossiers/_dossier_actions.html.haml | 82 ++++++++++--------- 2 files changed, 71 insertions(+), 66 deletions(-) diff --git a/app/views/instructeurs/procedures/_dossier_actions.html.haml b/app/views/instructeurs/procedures/_dossier_actions.html.haml index 582af3ab6..3c9bf64d4 100644 --- a/app/views/instructeurs/procedures/_dossier_actions.html.haml +++ b/app/views/instructeurs/procedures/_dossier_actions.html.haml @@ -2,33 +2,36 @@ = link_to restore_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: "fr-btn fr-btn--secondary" do = t('views.instructeurs.dossiers.restore') - elsif close_to_expiration || Dossier::TERMINE.include?(state) - %li.dropdown.user-dossier-actions{ data: { controller: 'menu-button' } } - %button.fr-btn.fr-mb-0.dropdown-button{ data: { menu_button_target: 'button' } } + = render Dropdown::MenuComponent.new(wrapper: :li, button_options: { class: ['fr-mb-0']}, menu_options: { id: "dossier_#{dossier_id}_actions_menu", class: 'user-dossier-actions' }) do |menu| + - menu.with_button_inner_html do Actions - .dropdown-content.fade-in-down{ data: { menu_button_target: 'menu' }, id: "dossier_#{dossier_id}_actions_menu" } - %ul.dropdown-items - - if close_to_expiration - %li - = link_to repousser_expiration_instructeur_dossier_path(procedure_id, dossier_id), method: :post do - %span.icon.standby - %span.dropdown-description= t('instructeurs.dossiers.header.banner.button_delay_expiration') - - if archived - %li - = link_to unarchive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch do - %span.icon.unarchive - %span.dropdown-description - Désarchiver le dossier - - else - %li - = link_to archive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch do - %span.icon.archive - %span.dropdown-description - Archiver le dossier - %li.danger - = link_to instructeur_dossier_path(procedure_id, dossier_id), method: :delete do - %span.icon.delete - %span.dropdown-description - = t('views.instructeurs.dossiers.delete_dossier') + + - if close_to_expiration + - menu.with_item do + = link_to(repousser_expiration_instructeur_dossier_path(procedure_id, dossier_id), method: :post, role: 'menuitem') do + %span.icon.standby + %span.dropdown-description= t('instructeurs.dossiers.header.banner.button_delay_expiration') + + - if archived + - menu.with_item do + = link_to( unarchive_instructeur_dossier_path(procedure_id, dossier_id), role: 'menuitem', method: :patch) do + %span.icon.unarchive + %span.dropdown-description + Désarchiver le dossier + + - else + - menu.with_item do + = link_to( archive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, role: 'menuitem') do + %span.icon.archive + %span.dropdown-description + Archiver le dossier + + - menu.with_item(class: 'danger') do + = link_to(instructeur_dossier_path(procedure_id, dossier_id), method: :delete, role: 'menuitem') do + %span.icon.delete + %span.dropdown-description + = t('views.instructeurs.dossiers.delete_dossier') + - elsif Dossier::EN_CONSTRUCTION_OU_INSTRUCTION.include?(state) - if dossier_is_followed diff --git a/app/views/users/dossiers/_dossier_actions.html.haml b/app/views/users/dossiers/_dossier_actions.html.haml index 52a89f4f3..4ca3f6118 100644 --- a/app/views/users/dossiers/_dossier_actions.html.haml +++ b/app/views/users/dossiers/_dossier_actions.html.haml @@ -4,49 +4,51 @@ - has_transfer_action = dossier.user == current_user - has_actions = has_edit_action || has_delete_action || has_new_dossier_action || has_transfer_action + + - if has_actions - .dropdown.user-dossier-actions{ data: { controller: 'menu-button' } } - %button.fr-btn.fr-btn--secondary.dropdown-button{ data: { menu_button_target: 'button' } } + = render Dropdown::MenuComponent.new(wrapper: :div, wrapper_options: {class: 'invite-user-actions'}, menu_options: {id: dom_id(dossier, :actions_menu)}, button_options: {class: 'fr-btn--sm fr-btn--secondary'}) do |menu| + - menu.with_button_inner_html do = t('views.users.dossiers.dossier_action.actions') - .dropdown-content.fade-in-down{ data: { menu_button_target: 'menu' }, id: dom_id(dossier, :actions_menu) } - %ul.dropdown-items - - if has_edit_action - - if dossier.brouillon? - %li - = link_to(url_for_dossier(dossier)) do - %span.icon.edit - .dropdown-description - = t('views.users.dossiers.dossier_action.edit_draft') - - else - %li - = link_to modifier_dossier_path(dossier) do - %span.icon.edit - .dropdown-description - = t('views.users.dossiers.dossier_action.edit_dossier') - - if has_transfer_action - %li - = link_to transferer_dossier_path(dossier) do - %span.icon.person - .dropdown-description - = t('views.users.dossiers.dossier_action.transfer_dossier') + - if has_edit_action + - if dossier.brouillon? + - menu.with_item do + = link_to(url_for_dossier(dossier), role: 'menuitem') do + %span.icon.edit + .dropdown-description + = t('views.users.dossiers.dossier_action.edit_draft') + - else + - menu.with_item do + = link_to(modifier_dossier_path(dossier), role: 'menuitem') do + %span.icon.edit + .dropdown-description + = t('views.users.dossiers.dossier_action.edit_dossier') - - if has_new_dossier_action - %li - = link_to procedure_lien(dossier.procedure) do - %span.icon.new-folder - .dropdown-description - = t('views.users.dossiers.dossier_action.start_other_dossier') - %li - = link_to clone_dossier_path(dossier), method: :post do - %span.icon.new-folder - .dropdown-description - = t('views.users.dossiers.dossier_action.clone') + - if has_transfer_action + - menu.with_item do + = link_to(transferer_dossier_path(dossier), role: 'menuitem') do + %span.icon.person + .dropdown-description + = t('views.users.dossiers.dossier_action.transfer_dossier') - - if has_delete_action - %li.danger - = link_to delete_dossier_dossier_path(dossier), method: :patch, data: { disable: true, confirm: "En continuant, vous allez supprimer ce dossier ainsi que les informations qu’il contient. Toute suppression entraîne l’annulation de la démarche en cours.\n\nConfirmer la suppression ?" } do - %span.icon.delete - .dropdown-description - = t('views.users.dossiers.dossier_action.delete_dossier') + - if has_new_dossier_action + - menu.with_item do + = link_to(procedure_lien(dossier.procedure), role: 'menuitem') do + %span.icon.new-folder + .dropdown-description + = t('views.users.dossiers.dossier_action.start_other_dossier') + - menu.with_item do + = link_to(clone_dossier_path(dossier), method: :post, role: 'menuitem') do + %span.icon.new-folder + .dropdown-description + = t('views.users.dossiers.dossier_action.clone') + + - if has_delete_action + - menu.with_item(class: 'danger') do + = link_to(delete_dossier_dossier_path(dossier), role: 'menuitem', method: :patch, data: { disable: true, confirm: "En continuant, vous allez supprimer ce dossier ainsi que les informations qu’il contient. Toute suppression entraîne l’annulation de la démarche en cours.\n\nConfirmer la suppression ?" }) do + + %span.icon.delete + .dropdown-description + = t('views.users.dossiers.dossier_action.delete_dossier')