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"> <div class="js-error">
Please revisit this page with JavaScript enabled to modify your answer. Please revisit this page with JavaScript enabled to modify your answer.
</div> </div>
@ -10,8 +19,8 @@
to acknowledge that you agree to come back at a later time to finish answering this question to acknowledge that you agree to come back at a later time to finish answering this question
before you can submit the test. before you can submit the test.
</p> </p>
<input type="checkbox" class="checkbox" name="live-coder-later" value="check_1" id="check_1" /> <%= form.check_box(:answer, checkbox_html, true, '') %>
<label for="check_1">I will come back later to finish this live coding question</label> <%= form.label(option_id, 'I will come back later to finish this live coding question.') %>
</div> </div>
<% end %> <% end %>

View File

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