demarches-normaliennes/app/helpers/dossier_link_helper.rb
Frederic Merizen 21bb04d74e [fix #1066] Fix links to related dossier for experts
- link to full dossier if gestionnaire is affected on procedure
- link to avis if avis expert requested on related dossier
2017-12-13 10:28:16 +00:00

12 lines
329 B
Ruby

module DossierLinkHelper
def dossier_linked_path(gestionnaire, dossier)
if dossier.procedure.gestionnaires.include?(gestionnaire)
dossier_path(dossier.procedure, dossier)
else
avis = dossier.avis.find_by(gestionnaire: gestionnaire)
if avis.present?
avis_path(avis)
end
end
end
end