summary roughed in

This commit is contained in:
Mark Moser
2016-07-28 20:54:08 -05:00
parent f9930ce531
commit 3a1c7de698
10 changed files with 102 additions and 61 deletions

View File

@ -1,20 +1,17 @@
<div class="content-well">
<%
question.input_options.each do | option |
option_id = "#{option.parameterize}_#{question.to_i}"
%>
<div class="form-group-multiples">
<input type="checkbox" class="checkbox"
name="input_checkbox_<%= question.to_i %>[]"
id="check_<%= option_id %>"
value="<%= option %>"
<%= "checked=\"checked\"" if Array(answer).include?(option) %>
>
<label for="check_<%= option_id %>"><%= option %></label>
</div>
<% end %>
<%
@question.input_options.each do | option |
option_id = "#{option.parameterize}_#{@question.to_i}"
%>
<div class="form-group-multiples">
<input type="checkbox" class="checkbox"
name="input_checkbox_<%= @question.to_i %>[]"
id="check_<%= option_id %>"
value="<%= option %>"
<%= "checked=\"checked\"" if Array(@answer.answer).include?(option) %>
>
<label for="check_<%= option_id %>"><%= option %></label>
</div>
<% end %>
-- MOVE TO FLASH HASH --
<div class="error">Please select or enter an answer.</div>
</div>
-- MOVE TO FLASH HASH --
<div class="error">Please select or enter an answer.</div>

View File

@ -21,17 +21,17 @@
<div class="code-input">
<label for="code-html">HTML</label>
<textarea data-id="code-html" name="code-html"><%= @answer.answer.try(:[], ['html']) %></textarea>
<textarea data-id="code-html" name="code-html"><%= answer['html'] unless answer.nil? %></textarea>
</div>
<div class="code-input">
<label for="code-css">CSS</label>
<textarea data-id="code-css" name="code-css"><%= @answer.answer.try(:[], ['css']) %></textarea>
<textarea data-id="code-css" name="code-css"><%= answer['css'] unless answer.nil? %></textarea>
</div>
<div class="code-input">
<label for="code-js">JS</label>
<textarea data-id="code-js" name="code-js"><%= @answer.answer.try(:[], ['js']) %></textarea>
<textarea data-id="code-js" name="code-js"><%= answer['js'] unless answer.nil? %></textarea>
</div>
-- MOVE TO FLASH HASH --

View File

@ -1,20 +1,17 @@
<div class="content-well">
<%
question.input_options.each do | option |
option_id = "#{option.parameterize}_#{question.to_i}"
%>
<div class="form-group-multiples">
<input type="radio" class="radio"
name="input_radio_<%= question.to_i %>"
id="radio_<%= option_id %>"
value="<%= option %>"
<%= "checked=\"checked\"" if answer == option %>
>
<label for="radio_<%= option_id %>"><%= option %></label>
</div>
<% end %>
<%
@question.input_options.each do | option |
option_id = "#{option.parameterize}_#{@question.to_i}"
%>
<div class="form-group-multiples">
<input type="radio" class="radio"
name="input_radio_<%= @question.to_i %>"
id="radio_<%= option_id %>"
value="<%= option %>"
<%= "checked=\"checked\"" if @answer.answer == option %>
>
<label for="radio_<%= option_id %>"><%= option %></label>
</div>
<% end %>
-- MOVE TO FLASH HASH --
<div class="error">Please select or enter an answer. (The character limit for a textarea answer is 1000)</div>
</div>
-- MOVE TO FLASH HASH --
<div class="error">Please select or enter an answer. (The character limit for a textarea answer is 1000)</div>

View File

@ -1,11 +1,7 @@
<div class="form-group">
<label for="textArea">Enter answer here</label>
<textarea id="textArea" name="textarea" rows="10"><%= answer %></textarea>
<label for="textArea">Enter answer here</label>
<textarea id="textArea" name="textarea" rows="10"><%= @answer.answer %></textarea>
<div class="chars">Characters remaining: <span></span></div>
<div class="chars">Characters remaining: <span></span></div>
-- MOVE TO FLASH HASH --
<div class="error">Please select or enter an answer. (The character limit for a textarea answer is 1000)</div>
</div>
-- MOVE TO FLASH HASH --
<div class="error">Please select or enter an answer. (The character limit for a textarea answer is 1000)</div>

View File

@ -8,7 +8,10 @@
<%= form_tag(post_question_path) do %>
<main class="questions_tpl">
<h2 class="question-text"><%= @question.question %></h2>
<%= render partial: @question.input_type %>
<div class="content-well">
<%= render partial: @question.input_type, locals: {question: @question, answer: @answer.answer } %>
</div>
<% if @status.on_summary %>

View File

@ -1,2 +1,41 @@
<h1>Candidate#summary</h1>
<p>Find me in app/views/candidate/summary.html.erb</p>
<main class="summary_tpl">
<h2 class="prft-heading">Almost done!</h2>
<p>
Now's the time to review your answers and go back and change any, if you need to.
Once you're done, hit the button at the bottom of the page to submit your answers.
</p>
<%= form_tag(post_summary_path) do %>
<% @candidate.quiz.questions.each do |question| %>
<article class="answer-sec">
<div class="question-heading">
<div class="question-title">
<h3><%= question.question %></h3>
</div>
<div class="answer-buttons">
<a href="<%= question_path(question.to_i) %>" class="tertiary-btn button-edit" data-questionId="<%= question.to_i %>">Edit</a>
<button class="tertiary-btn button-save">Save</button>
<button class="tertiary-btn button-cancel">Cancel</button>
</div>
</div>
<div class="answer-container">
<fieldset disabled class="answer-block">
<%= render partial: question.input_type, locals: {question: question, answer: @answers.where(question_id: question.id).first.answer } %>
</fieldset>
</div>
</article>
<% end #questions loop %>
<% if @status.can_submit %>
<div class="btn-container-right">
<input type="submit" class="submit-button" value="Submit all answers" name="submit" />
</div>
<% else %>
<div class="error">Sorry, you must answer all questions before you can submit.</div>
<% end %>
<% end #form_tag %>
</main>