Show the reason on deleted dossiers

This commit is contained in:
Paul Chavard 2020-03-25 10:58:26 +01:00
parent 7a8936eacb
commit ec1cd989ab
3 changed files with 30 additions and 2 deletions

View file

@ -89,6 +89,18 @@ module DossierHelper
content_tag(:span, status_text, class: "label #{status_class} ")
end
def deletion_reason_badge(reason)
if reason.present?
status_text = I18n.t(reason, scope: [:activerecord, :attributes, :deleted_dossier, :reason])
status_class = reason.tr('_', '-')
else
status_text = I18n.t(:unknown, scope: [:activerecord, :attributes, :deleted_dossier, :reason])
status_class = 'unknown'
end
content_tag(:span, status_text, class: "label #{status_class} ")
end
private
def dinum_instance?

View file

@ -53,16 +53,21 @@
%th.notification-col
%th.number-col N° dossier
%th.status-col Etat
%th.status-col Raison de suppression
%th.status-col Date de suppression
%tbody
- @deleted_dossiers.each do |deleted_dossier|
%tr
%td.folder-col
%span.icon.folder
%td.number-col= deleted_dossier.dossier_id
%td.number-col
= deleted_dossier.dossier_id
%td.status-col
= status_badge(deleted_dossier.state)
%td.date-col.deleted-cell= l(deleted_dossier.deleted_at, format: '%d/%m/%y')
%td.reason-col
= deletion_reason_badge(deleted_dossier.reason)
%td.date-col.deleted-cell
= l(deleted_dossier.deleted_at, format: '%d/%m/%y')
= paginate @deleted_dossiers
- else
Aucun dossier supprimé

View file

@ -0,0 +1,11 @@
fr:
activerecord:
attributes:
deleted_dossier:
reason:
user_request: Demande dusager
manager_request: Demande dadministration
user_removed: Suppression d'un compte usager
expired: Expiration
unknown: Inconnue