demarches-normaliennes/app/controllers/new_user/commencer_controller.rb

44 lines
1.1 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module NewUser
class CommencerController < ApplicationController
layout 'procedure_context'
def commencer
@procedure = Procedure.publiees.find_by(path: params[:path])
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
end
render 'commencer/show'
end
def commencer_test
@procedure = Procedure.brouillons.find_by(path: params[:path])
if @procedure.blank?
flash.alert = "La démarche est inconnue, ou cette démarche nest maintenant plus en test."
return redirect_to root_path
end
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
private
def store_user_location!
procedure = Procedure.find_by(path: params[:path])
store_location_for(:user, commencer_path(path: procedure.path))
end
end
end