2021-09-07 10:37:42 +02:00
- has_edit_action = !dossier.read_only?
2019-03-26 17:55:40 +01:00
- has_delete_action = dossier.can_be_deleted_by_user?
2019-07-09 14:30:05 +02:00
- has_new_dossier_action = dossier.procedure.accepts_new_dossiers?
2021-09-07 10:37:42 +02:00
- has_transfer_action = dossier.user == current_user
2021-12-07 15:38:37 +01:00
- has_actions = has_edit_action || has_delete_action || has_new_dossier_action || has_transfer_action
2019-03-26 17:55:40 +01:00
- if has_actions
2022-05-11 16:08:48 +02:00
.dropdown.user-dossier-actions{ data: { controller: 'menu-button' } }
%button.button.dropdown-button{ data: { menu_button_target: 'button' } }
2021-04-17 18:49:00 +02:00
= t('views.users.dossiers.dossier_action.actions')
2022-07-07 13:28:12 +02:00
.dropdown-content.fade-in-down{ data: { menu_button_target: 'menu' }, id: dom_id(dossier, :actions_menu) }
2019-03-26 17:55:40 +01:00
%ul.dropdown-items
2021-09-07 10:37:42 +02:00
- if has_edit_action
2019-07-17 17:39:45 +02:00
- if dossier.brouillon?
%li
= link_to(url_for_dossier(dossier)) do
%span.icon.edit
.dropdown-description
2021-04-17 18:49:00 +02:00
= t('views.users.dossiers.dossier_action.edit_draft')
2019-07-17 17:39:45 +02:00
- else
%li
= link_to modifier_dossier_path(dossier) do
%span.icon.edit
.dropdown-description
2021-04-17 18:49:00 +02:00
= t('views.users.dossiers.dossier_action.edit_dossier')
2019-07-17 17:39:45 +02:00
2021-09-07 10:37:42 +02:00
- 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')
2019-03-27 11:43:04 +01:00
- if has_new_dossier_action
%li
= link_to procedure_lien(dossier.procedure) do
%span.icon.new-folder
.dropdown-description
2021-04-17 18:49:00 +02:00
= t('views.users.dossiers.dossier_action.start_other_dossier')
2022-11-08 16:26:03 +01:00
%li
= link_to clone_dossier_path(dossier), method: :post do
%span.icon.new-folder
.dropdown-description
= t('views.users.dossiers.dossier_action.clone')
2019-03-27 11:43:04 +01:00
2019-03-26 17:55:40 +01:00
- if has_delete_action
%li.danger
2021-12-07 15:38:37 +01:00
= 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
2019-03-26 17:55:40 +01:00
%span.icon.delete
.dropdown-description
2021-04-17 18:49:00 +02:00
= t('views.users.dossiers.dossier_action.delete_dossier')
2021-11-24 10:35:34 +01:00