2017-11-24 19:25:29 +01:00
|
|
|
module DossierHelper
|
2017-11-24 19:26:24 +01:00
|
|
|
def button_or_label_class(dossier)
|
2017-12-04 18:00:12 +01:00
|
|
|
if dossier.accepte?
|
2017-11-24 19:25:29 +01:00
|
|
|
'accepted'
|
2017-12-04 20:23:57 +01:00
|
|
|
elsif dossier.sans_suite?
|
2017-11-24 19:25:29 +01:00
|
|
|
'without-continuation'
|
2017-12-04 18:15:40 +01:00
|
|
|
elsif dossier.refuse?
|
|
|
|
'refuse'
|
2017-11-24 19:25:29 +01:00
|
|
|
end
|
|
|
|
end
|
2017-12-05 16:07:05 +01:00
|
|
|
|
|
|
|
def highlight_if_unseen_class(seen_at, updated_at)
|
|
|
|
if seen_at&.<(updated_at)
|
|
|
|
"highlighted"
|
|
|
|
end
|
|
|
|
end
|
2018-06-25 18:07:16 +02:00
|
|
|
|
2018-06-28 17:19:22 +02:00
|
|
|
def url_for_dossier(dossier)
|
2018-07-04 09:59:35 +02:00
|
|
|
if dossier.brouillon?
|
2018-09-06 09:09:23 +02:00
|
|
|
brouillon_dossier_path(dossier)
|
2018-06-28 17:19:22 +02:00
|
|
|
else
|
2018-10-02 12:23:53 +02:00
|
|
|
dossier_path(dossier)
|
2018-06-28 17:19:22 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-06-25 18:07:16 +02:00
|
|
|
def dossier_submission_is_closed?(dossier)
|
|
|
|
dossier.brouillon? && dossier.procedure.archivee?
|
|
|
|
end
|
2018-11-06 18:44:32 +01:00
|
|
|
|
|
|
|
def dossier_display_state(dossier, lower: false)
|
|
|
|
state = I18n.t(dossier.state, scope: [:activerecord, :attributes, :dossier, :state])
|
|
|
|
lower ? state.downcase : state
|
|
|
|
end
|
2017-11-24 19:25:29 +01:00
|
|
|
end
|