small refacto with hidden_by_expired? method
This commit is contained in:
parent
df13e53815
commit
5c26073af7
4 changed files with 8 additions and 4 deletions
|
@ -687,7 +687,7 @@ class Dossier < ApplicationRecord
|
||||||
en_construction_close_to_expiration_notice_sent_at: nil,
|
en_construction_close_to_expiration_notice_sent_at: nil,
|
||||||
termine_close_to_expiration_notice_sent_at: nil)
|
termine_close_to_expiration_notice_sent_at: nil)
|
||||||
|
|
||||||
if hidden_by_reason == 'expired'
|
if hidden_by_expired?
|
||||||
update(hidden_by_expired_at: nil, hidden_by_reason: nil)
|
update(hidden_by_expired_at: nil, hidden_by_reason: nil)
|
||||||
restore(author)
|
restore(author)
|
||||||
end
|
end
|
||||||
|
@ -782,6 +782,10 @@ class Dossier < ApplicationRecord
|
||||||
!procedure.brouillon? && !brouillon?
|
!procedure.brouillon? && !brouillon?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def hidden_by_expired?
|
||||||
|
hidden_by_expired_at.present?
|
||||||
|
end
|
||||||
|
|
||||||
def hidden_by_user?
|
def hidden_by_user?
|
||||||
hidden_by_user_at.present?
|
hidden_by_user_at.present?
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
dossier_is_followed: current_instructeur&.follow?(dossier),
|
dossier_is_followed: current_instructeur&.follow?(dossier),
|
||||||
close_to_expiration: dossier.close_to_expiration?,
|
close_to_expiration: dossier.close_to_expiration?,
|
||||||
hidden_by_administration: dossier.hidden_by_administration?,
|
hidden_by_administration: dossier.hidden_by_administration?,
|
||||||
hidden_by_expired: dossier.hidden_by_reason == 'expired',
|
hidden_by_expired: dossier.hidden_by_expired?,
|
||||||
has_pending_correction: dossier.pending_correction?,
|
has_pending_correction: dossier.pending_correction?,
|
||||||
has_blocking_pending_correction: dossier.procedure.feature_enabled?(:blocking_pending_correction) && dossier.pending_correction?,
|
has_blocking_pending_correction: dossier.procedure.feature_enabled?(:blocking_pending_correction) && dossier.pending_correction?,
|
||||||
turbo: true,
|
turbo: true,
|
||||||
|
|
|
@ -173,7 +173,7 @@
|
||||||
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
|
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
|
||||||
close_to_expiration: @statut == 'expirant',
|
close_to_expiration: @statut == 'expirant',
|
||||||
hidden_by_administration: @statut == 'supprimes_recemment',
|
hidden_by_administration: @statut == 'supprimes_recemment',
|
||||||
hidden_by_expired: p.hidden_by_reason == 'expired',
|
hidden_by_expired: p.hidden_by_expired?,
|
||||||
sva_svr: @procedure.sva_svr_enabled?,
|
sva_svr: @procedure.sva_svr_enabled?,
|
||||||
has_blocking_pending_correction: @procedure.feature_enabled?(:blocking_pending_correction) && p.pending_correction?,
|
has_blocking_pending_correction: @procedure.feature_enabled?(:blocking_pending_correction) && p.pending_correction?,
|
||||||
turbo: false,
|
turbo: false,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
%p.fr-icon--sm.fr-icon-user-line
|
%p.fr-icon--sm.fr-icon-user-line
|
||||||
= demandeur_dossier(dossier)
|
= demandeur_dossier(dossier)
|
||||||
|
|
||||||
- if dossier.hidden_by_reason == 'expired'
|
- if dossier.hidden_by_expired?
|
||||||
%p.fr-icon--sm.fr-icon-delete-line
|
%p.fr-icon--sm.fr-icon-delete-line
|
||||||
= t('views.users.dossiers.dossiers_list.deleted_by_automatic', date: l(dossier.hidden_by_expired_at.to_date))
|
= t('views.users.dossiers.dossiers_list.deleted_by_automatic', date: l(dossier.hidden_by_expired_at.to_date))
|
||||||
- elsif dossier.hidden_by_user?
|
- elsif dossier.hidden_by_user?
|
||||||
|
|
Loading…
Reference in a new issue