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 @answer = @question.answers.order("RAND()").first
end end
def update_question
redirect_to saved_path if params[:submit] == 'Save'
redirect_to :question
end
def summary def summary
end end
@ -16,4 +22,8 @@ class CandidateController < ApplicationController
def saved def saved
end end
def validate
redirect_to :question
end
end end

View File

@ -6,6 +6,7 @@
%> %>
<form method="post" action="/question"> <form method="post" action="/question">
<%= form_tag(post_question_path) do %>
<main class="questions_tpl"> <main class="questions_tpl">
<h2 class="question-text"><%= @question.question %></h2> <h2 class="question-text"><%= @question.question %></h2>
<%= render partial: "questions/#{@question.input_type}" %> <%= render partial: "questions/#{@question.input_type}" %>
@ -27,7 +28,7 @@
<% end %> <% end %>
</main> </main>
</form> <% end %>
<% unless @status.on_summary %> <% unless @status.on_summary %>
<div class="progress ignore-margin"> <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, 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. but you'll have a chance at the end to review your answers and make changes.
</p> </p>
<a href="questions"><button>Continue Test</button></a>
<a href="<%= question_path %>"><button>Continue Test</button></a>
</main> </main>
<!-- <?php } else { ?> --> <!-- <?php } else { ?> -->
@ -33,11 +34,11 @@
answers, we will review your assessment and your recruiter will be in touch. answers, we will review your assessment and your recruiter will be in touch.
</p> </p>
<form method="POST" action="assets/validate_candidate.php"> <%= form_tag(validate_candidate_path) do %>
<div class="form-group"> <div class="form-group">
<label for="userid">What's your User ID?</label> <label for="userid">What's your User ID?</label>
<input type="text" id="userId" name="userId" required/> <input type="text" id="userId" name="userId" required/>
</div> </div>
<button type="submit">Begin</button> <button type="submit">Begin</button>
</form> <% end %>
</main> </main>

View File

@ -1,10 +1,13 @@
Rails.application.routes.draw do Rails.application.routes.draw do
get "/welcome", to: 'candidate#welcome', as: :welcome get "/welcome", to: "candidate#welcome", as: :welcome
get "/thankyou", to: 'candidate#thankyou', as: :thankyou get "/thankyou", to: "candidate#thankyou", as: :thankyou
get "/saved", to: 'candidate#saved', as: :saved get "/saved", to: "candidate#saved", as: :saved
get "/summary", to: 'candidate#summary', as: :summary get "/summary", to: "candidate#summary", as: :summary
get "/question", to: 'candidate#question', as: :question 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 # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end end