2019-03-25 10:53:45 +01:00
|
|
|
|
module Users
|
2018-11-01 13:00:35 +01:00
|
|
|
|
class CommencerController < ApplicationController
|
2019-01-16 11:57:58 +01:00
|
|
|
|
layout 'procedure_context'
|
|
|
|
|
|
|
|
|
|
def commencer
|
|
|
|
|
@procedure = Procedure.publiees.find_by(path: params[:path])
|
2018-11-01 13:00:35 +01:00
|
|
|
|
|
2019-01-16 11:57:58 +01:00
|
|
|
|
if @procedure.blank?
|
|
|
|
|
flash.alert = "La démarche est inconnue, ou la création de nouveaux dossiers pour cette démarche est terminée."
|
|
|
|
|
return redirect_to root_path
|
2018-11-01 13:00:35 +01:00
|
|
|
|
end
|
2019-01-16 11:57:58 +01:00
|
|
|
|
|
|
|
|
|
render 'commencer/show'
|
2018-11-01 13:00:35 +01:00
|
|
|
|
end
|
|
|
|
|
|
2019-01-16 11:57:58 +01:00
|
|
|
|
def commencer_test
|
|
|
|
|
@procedure = Procedure.brouillons.find_by(path: params[:path])
|
2018-11-01 13:00:35 +01:00
|
|
|
|
|
2019-01-16 11:57:58 +01:00
|
|
|
|
if @procedure.blank?
|
|
|
|
|
flash.alert = "La démarche est inconnue, ou cette démarche n’est maintenant plus en test."
|
|
|
|
|
return redirect_to root_path
|
2018-11-01 13:00:35 +01:00
|
|
|
|
end
|
2019-01-16 11:57:58 +01:00
|
|
|
|
|
|
|
|
|
render 'commencer/show'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def sign_in
|
|
|
|
|
store_user_location!
|
|
|
|
|
redirect_to new_user_session_path
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def sign_up
|
|
|
|
|
store_user_location!
|
|
|
|
|
redirect_to new_user_registration_path
|
|
|
|
|
end
|
|
|
|
|
|
2019-03-28 11:14:01 +01:00
|
|
|
|
def procedure_for_help
|
|
|
|
|
Procedure.publiees.find_by(path: params[:path]) || Procedure.brouillons.find_by(path: params[:path])
|
|
|
|
|
end
|
|
|
|
|
|
2019-01-16 11:57:58 +01:00
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def store_user_location!
|
|
|
|
|
procedure = Procedure.find_by(path: params[:path])
|
2019-03-27 17:46:35 +01:00
|
|
|
|
store_location_for(:user, helpers.procedure_lien(procedure))
|
2018-11-01 13:00:35 +01:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|