updated live coder for attributes

This commit is contained in:
Mark Moser 2016-08-01 15:16:20 -05:00
parent 8751a04669
commit bc003eecd1
2 changed files with 17 additions and 8 deletions

View File

@ -1,3 +1,12 @@
<%
option_id = "#{question.question_id}_finish-later"
checkbox_html = {class: 'checkbox',
id: "answer_#{option_id}",
name: "answer[live_code][later]",
checked: Array(question.answer).include?('finish-later')
}
%>
<div class="js-error">
Please revisit this page with JavaScript enabled to modify your answer.
</div>
@ -10,8 +19,8 @@
to acknowledge that you agree to come back at a later time to finish answering this question
before you can submit the test.
</p>
<input type="checkbox" class="checkbox" name="live-coder-later" value="check_1" id="check_1" />
<label for="check_1">I will come back later to finish this live coding question</label>
<%= form.check_box(:answer, checkbox_html, true, '') %>
<%= form.label(option_id, 'I will come back later to finish this live coding question.') %>
</div>
<% end %>

View File

@ -1,16 +1,16 @@
<div class="code-input">
<label for="code-html">HTML</label>
<textarea data-id="code-html" name="code-html" class="code-answer code-html"><%= @answer['html'] unless @answer.nil? %></textarea>
<label for="answer_live_code_html">HTML</label>
<%= text_area_tag 'answer[live_code][html]', (@answer['html'] unless @answer.nil?), { 'data-id' => 'code-html', class: 'code-answer code-html' } %>
</div>
<div class="code-input">
<label for="code-css">CSS</label>
<textarea data-id="code-css" name="code-css" class="code-answer code-css"><%= @answer['css'] unless @answer.nil? %></textarea>
<label for="answer_live_code_css">CSS</label>
<%= text_area_tag 'answer[live_code][css]', (@answer['css'] unless @answer.nil?), { 'data-id' => 'code-css', class: 'code-answer code-css' } %>
</div>
<div class="code-input">
<label for="code-js">JS</label>
<textarea data-id="code-js" name="code-js" class="code-answer code-js"><%= @answer['js'] unless @answer.nil? %></textarea>
<label for="answer_live_code_js">JS</label>
<%= text_area_tag 'answer[live_code][js]', (@answer['js'] unless @answer.nil?), { 'data-id' => 'code-js', class: 'code-answer code-js' } %>
</div>
<%= render partial: "candidate/answer_errors", locals: {question: @question, answer: @answer} %>