fix actions rules for archived and expirant dossiers

This commit is contained in:
Lisa Durand 2023-02-23 16:55:46 +01:00
parent 76947a5ccf
commit b03748d3dd
2 changed files with 6 additions and 7 deletions

View file

@ -8,10 +8,12 @@
= link_to(repousser_expiration_instructeur_dossier_path(procedure_id, dossier_id), method: :post, class: "fr-btn") do
= t('instructeurs.dossiers.header.banner.button_delay_expiration')
- if archived
- elsif archived
= link_to( unarchive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: "fr-btn fr-icon-upload-2-line") do
Désarchiver le dossier
= link_to('', instructeur_dossier_path(procedure_id, dossier_id), method: :delete, class: 'fr-btn fr-btn--secondary fr-icon-delete-line icon-only danger', title: t('views.instructeurs.dossiers.delete_dossier'))
- else
= link_to(repasser_en_instruction_instructeur_dossier_path(procedure_id, dossier_id), method: :post, class: 'fr-btn fr-btn--secondary fr-icon-edit-line') do
Repasser en instruction
@ -21,7 +23,6 @@
= link_to('', instructeur_dossier_path(procedure_id, dossier_id), method: :delete, class: 'fr-btn fr-btn--secondary fr-icon-delete-line icon-only danger', title: t('views.instructeurs.dossiers.delete_dossier'))
- elsif Dossier::EN_CONSTRUCTION_OU_INSTRUCTION.include?(state)
- if Dossier.states[:en_construction] == state
%li

View file

@ -108,10 +108,7 @@ describe 'instructeurs/dossiers/show.html.haml', type: :view do
it 'displays the correct actions' do
expect(subject).to have_text('Conserver un mois de plus')
expect(subject).to have_link('Repasser en instruction', href: repasser_en_instruction_instructeur_dossier_path(dossier.procedure, dossier))
expect(subject).to have_link('Archiver le dossier', href: archive_instructeur_dossier_path(dossier.procedure, dossier))
expect(subject).to have_selector('[title^="Supprimer le dossier"]')
expect(subject).to have_selector('.header-actions ul:first-child .fr-btn', count: 4)
expect(subject).to have_selector('.header-actions ul:first-child .fr-btn', count: 1)
end
end
@ -120,7 +117,8 @@ describe 'instructeurs/dossiers/show.html.haml', type: :view do
it 'displays the correct actions' do
expect(subject).to have_link('Désarchiver le dossier', href: unarchive_instructeur_dossier_path(dossier.procedure, dossier))
expect(subject).to have_selector('.header-actions ul:first-child .fr-btn', count: 1)
expect(subject).to have_selector('[title^="Supprimer le dossier"]')
expect(subject).to have_selector('.header-actions ul:first-child .fr-btn', count: 2)
end
end