Avis: add sign_up logic for new tps gestionnaire
This commit is contained in:
parent
4e064dbaed
commit
aaf155df72
7 changed files with 183 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
class Backoffice::AvisController < ApplicationController
|
||||
|
||||
before_action :authenticate_gestionnaire!
|
||||
before_action :authenticate_gestionnaire!, except: [:sign_up]
|
||||
before_action :check_avis_exists_and_email_belongs_to_avis, only: [:sign_up]
|
||||
|
||||
def create
|
||||
avis = Avis.new(create_params)
|
||||
|
@ -25,6 +26,13 @@ class Backoffice::AvisController < ApplicationController
|
|||
redirect_to backoffice_dossier_path(avis.dossier_id)
|
||||
end
|
||||
|
||||
def sign_up
|
||||
@email = params[:email]
|
||||
@dossier = Avis.includes(:dossier).find(params[:id]).dossier
|
||||
|
||||
render layout: 'new_application'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def dossier
|
||||
|
@ -43,4 +51,9 @@ class Backoffice::AvisController < ApplicationController
|
|||
params.require(:avis).permit(:answer)
|
||||
end
|
||||
|
||||
def check_avis_exists_and_email_belongs_to_avis
|
||||
if !Avis.avis_exists_and_email_belongs_to_avis?(params[:id], params[:email])
|
||||
redirect_to url_for(root_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue