demarches-normaliennes/app/controllers/users/recapitulatif_controller.rb

36 lines
762 B
Ruby
Raw Normal View History

2015-09-23 19:20:03 +02:00
class Users::RecapitulatifController < UsersController
2015-08-10 11:05:06 +02:00
def show
create_dossier_facade
2015-08-10 11:05:06 +02:00
end
def initiate
create_dossier_facade
@facade.dossier.next_step! 'user', 'initiate'
flash.notice = 'Dossier soumis avec succès.'
render 'show'
end
def submit
create_dossier_facade
@facade.dossier.next_step! 'user', 'submit'
flash.notice = 'Dossier déposé avec succès.'
NotificationMailer.dossier_submitted(@facade.dossier).deliver_now!
render 'show'
end
private
def create_dossier_facade
@facade = DossierFacades.new current_user_dossier.id, current_user.email
rescue ActiveRecord::RecordNotFound
flash.alert = t('errors.messages.dossier_not_found')
redirect_to url_for(root_path)
end
2015-08-10 11:05:06 +02:00
end