style(demande): modification date as badge

This commit is contained in:
Colin Darie 2023-06-29 00:33:27 +02:00
parent 9811d666b2
commit 25015a8b8b
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
3 changed files with 11 additions and 4 deletions

View file

@ -11,7 +11,7 @@
- if updated_after_deposer?(champ)
%p.fr-mb-0.fr-text--sm
%span{ class: highlight_if_unseen_class(@demande_seen_at, champ.updated_at) }
%span.fr-badge.fr-badge--sm{ class: badge_class_if_unseen(@demande_seen_at, champ.updated_at) }
= t(:updated_at, scope: [:views, :shared, :dossiers, :form], datetime: try_format_datetime(champ.updated_at))
- if champ.blank?

View file

@ -17,6 +17,13 @@ module DossierHelper
end
end
def badge_class_if_unseen(seen_at, updated_at)
return if updated_at.blank? || seen_at.blank?
return if seen_at > updated_at
"fr-badge--new"
end
def url_for_dossier(dossier)
if dossier.brouillon?
brouillon_dossier_path(dossier)

View file

@ -4,9 +4,9 @@
%p.champ-label.flex-grow= dossier.procedure.routing_criteria_name
%p.fr-mb-0.fr-text--xs
- if demande_seen_at&.<(dossier.groupe_instructeur_updated_at)
%span{ class: highlight_if_unseen_class(demande_seen_at, dossier.groupe_instructeur_updated_at) }
= t(:updated_at, scope: [:views, :shared, :dossiers, :form], datetime: try_format_datetime(dossier.updated_at))
- if demande_seen_at && dossier.groupe_instructeur_updated_at && dossier.groupe_instructeur_updated_at > dossier.depose_at
%span.fr-badge.fr-badge--sm{ class: badge_class_if_unseen(demande_seen_at, dossier.groupe_instructeur_updated_at) }
= t(:updated_at, scope: [:views, :shared, :dossiers, :form], datetime: try_format_datetime(dossier.groupe_instructeur_updated_at))
.champ-content{ class: highlight_if_unseen_class(demande_seen_at, dossier.groupe_instructeur_updated_at) }
%p= dossier.groupe_instructeur.label