a littel more routing

This commit is contained in:
Mark Moser 2016-07-28 08:47:34 -05:00
parent 8623fe0d93
commit 0950b7eb2a
4 changed files with 25 additions and 10 deletions

View File

@ -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

View File

@ -6,6 +6,7 @@
%>
<form method="post" action="/question">
<%= form_tag(post_question_path) do %>
<main class="questions_tpl">
<h2 class="question-text"><%= @question.question %></h2>
<%= render partial: "questions/#{@question.input_type}" %>
@ -27,7 +28,7 @@
<% end %>
</main>
</form>
<% end %>
<% unless @status.on_summary %>
<div class="progress ignore-margin">

View File

@ -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.
</p>
<a href="questions"><button>Continue Test</button></a>
<a href="<%= question_path %>"><button>Continue Test</button></a>
</main>
<!-- <?php } else { ?> -->
@ -33,11 +34,11 @@
answers, we will review your assessment and your recruiter will be in touch.
</p>
<form method="POST" action="assets/validate_candidate.php">
<%= form_tag(validate_candidate_path) do %>
<div class="form-group">
<label for="userid">What's your User ID?</label>
<input type="text" id="userId" name="userId" required/>
</div>
<button type="submit">Begin</button>
</form>
<% end %>
</main>

View File

@ -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