demarches-normaliennes/app/views/users/dossiers/_dossier_actions.html.haml

55 lines
2.4 KiB
Text
Raw Normal View History

- has_edit_action = !dossier.read_only?
2019-03-26 17:55:40 +01:00
- 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
2019-03-26 17:55:40 +01:00
2019-03-26 17:55:40 +01:00
- if has_actions
= 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'}) do |menu|
- menu.with_button_inner_html do
2021-04-17 18:49:00 +02:00
= t('views.users.dossiers.dossier_action.actions')
2021-11-24 10:35:34 +01:00
- 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_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_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(dossier_path(dossier), role: 'menuitem', method: :delete, data: { disable: true, confirm: "En continuant, vous allez supprimer ce dossier ainsi que les informations quil contient. Toute suppression entraîne lannulation de la démarche en cours.\n\nConfirmer la suppression ?" }) do
%span.icon.delete
.dropdown-description
= t('views.users.dossiers.dossier_action.delete_dossier')