demarches-normaliennes/app/controllers/new_gestionnaire/avis_controller.rb

23 lines
593 B
Ruby
Raw Normal View History

2017-09-06 11:21:29 +02:00
module NewGestionnaire
class AvisController < ApplicationController
layout 'new_application'
A_DONNER_STATUS = 'a-donner'
DONNES_STATUS = 'donnes'
def index
gestionnaire_avis = current_gestionnaire.avis.includes(dossier: [:procedure, :user])
@avis_a_donner, @avis_donnes = gestionnaire_avis.partition { |avis| avis.answer.nil? }
@statut = params[:statut].present? ? params[:statut] : A_DONNER_STATUS
@avis = case @statut
when A_DONNER_STATUS
@avis_a_donner
when DONNES_STATUS
@avis_donnes
end
end
end
end