diff --git a/app/controllers/candidate_controller.rb b/app/controllers/candidate_controller.rb index fb7df1c..f7ee689 100644 --- a/app/controllers/candidate_controller.rb +++ b/app/controllers/candidate_controller.rb @@ -8,6 +8,12 @@ class CandidateController < ApplicationController @answer = @question.answers.order("RAND()").first end + def update_question + + redirect_to saved_path if params[:submit] == 'Save' + redirect_to :question + end + def summary end @@ -16,4 +22,8 @@ class CandidateController < ApplicationController def saved end + + def validate + redirect_to :question + end end diff --git a/app/views/candidate/question.html.erb b/app/views/candidate/question.html.erb index 081201b..b8a1bed 100644 --- a/app/views/candidate/question.html.erb +++ b/app/views/candidate/question.html.erb @@ -6,6 +6,7 @@ %>
+<%= form_tag(post_question_path) do %>

<%= @question.question %>

<%= render partial: "questions/#{@question.input_type}" %> @@ -27,7 +28,7 @@ <% end %>
-
+<% end %> <% unless @status.on_summary %>
diff --git a/app/views/candidate/welcome.html.erb b/app/views/candidate/welcome.html.erb index db8866f..f1f4e75 100644 --- a/app/views/candidate/welcome.html.erb +++ b/app/views/candidate/welcome.html.erb @@ -8,7 +8,8 @@ Looks like you hit the browser's Back button. You can't go backwards in the test, but you'll have a chance at the end to review your answers and make changes.

- + + @@ -33,11 +34,11 @@ answers, we will review your assessment and your recruiter will be in touch.

-
+ <%= form_tag(validate_candidate_path) do %>
-
+ <% end %> diff --git a/config/routes.rb b/config/routes.rb index fdf912c..36bef86 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,10 +1,13 @@ Rails.application.routes.draw do - get "/welcome", to: 'candidate#welcome', as: :welcome - get "/thankyou", to: 'candidate#thankyou', as: :thankyou - get "/saved", to: 'candidate#saved', as: :saved - get "/summary", to: 'candidate#summary', as: :summary - get "/question", to: 'candidate#question', as: :question + get "/welcome", to: "candidate#welcome", as: :welcome + get "/thankyou", to: "candidate#thankyou", as: :thankyou + get "/saved", to: "candidate#saved", as: :saved + get "/summary", to: "candidate#summary", as: :summary + get "/question", to: "candidate#question", as: :question + post "/question", to: "candidate#update_question", as: :post_question + post "/validate", to: "candidate#validate", as: :validate_candidate - root to: 'candidate#welcome' + + root to: "candidate#welcome" # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end