52 lines
2.4 KiB
Text
52 lines
2.4 KiB
Text
- has_edit_action = !dossier.read_only?
|
||
- has_delete_action = dossier.can_be_deleted_by_user?
|
||
- has_new_dossier_action = dossier.procedure.accepts_new_dossiers?
|
||
- 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.button.dropdown-button{ data: { menu_button_target: 'button' } }
|
||
= 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_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_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')
|
||
|