Show the reason on deleted dossiers
This commit is contained in:
parent
7a8936eacb
commit
ec1cd989ab
3 changed files with 30 additions and 2 deletions
|
@ -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?
|
||||
|
|
|
@ -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é
|
||||
|
|
11
config/locales/models/deleted_dossier/fr.yml
Normal file
11
config/locales/models/deleted_dossier/fr.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
fr:
|
||||
activerecord:
|
||||
attributes:
|
||||
deleted_dossier:
|
||||
reason:
|
||||
user_request: Demande d’usager
|
||||
manager_request: Demande d’administration
|
||||
user_removed: Suppression d'un compte usager
|
||||
expired: Expiration
|
||||
unknown: Inconnue
|
||||
|
Loading…
Reference in a new issue