2015-08-10 11:05:06 +02:00
|
|
|
class DemandesController < ApplicationController
|
|
|
|
def show
|
|
|
|
@dossier = Dossier.find(params[:dossier_id])
|
2015-08-17 17:08:13 +02:00
|
|
|
@evenements_vie = EvenementVie.for_admi_facile
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
|
2015-08-17 17:08:13 +02:00
|
|
|
def update
|
2015-08-18 15:15:34 +02:00
|
|
|
dossier = Dossier.find(params[:dossier_id])
|
2015-08-20 16:36:08 +02:00
|
|
|
unless dossier.formulaire.nil?
|
2015-08-18 16:30:36 +02:00
|
|
|
# TODO: redirect to start with an error message
|
2015-08-20 16:36:08 +02:00
|
|
|
fail "La modification du formulaire n'est pas possible"
|
2015-08-18 15:15:34 +02:00
|
|
|
end
|
|
|
|
dossier.update_attributes(formulaire_id: params[:formulaire])
|
|
|
|
dossier.build_default_pieces_jointes
|
2015-08-17 17:08:13 +02:00
|
|
|
redirect_to url_for(controller: :carte, action: :show, dossier_id: params[:dossier_id])
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|
|
|
|
end
|