demarches-normaliennes/app/helpers/procedure_helper.rb

23 lines
610 B
Ruby
Raw Normal View History

2018-08-14 15:17:22 +02:00
module ProcedureHelper
def procedure_lien(procedure)
if procedure.path.present?
2018-08-14 15:17:22 +02:00
if procedure.brouillon_avec_lien?
2018-10-30 12:00:58 +01:00
commencer_test_url(path: procedure.path)
2018-08-14 15:17:22 +02:00
else
2018-10-30 12:00:58 +01:00
commencer_url(path: procedure.path)
2018-08-14 15:17:22 +02:00
end
end
end
def procedure_libelle(procedure)
parts = procedure.brouillon? ? [content_tag(:span, 'démarche non publiée', class: 'badge')] : []
parts << procedure.libelle
safe_join(parts, ' ')
2018-08-14 15:17:22 +02:00
end
def procedure_modal_text(procedure, key)
action = procedure.archivee? ? :reopen : :publish
t(action, scope: [:modal, :publish, key])
end
end