2016-08-01 15:16:20 -05:00
|
|
|
<%
|
|
|
|
option_id = "#{question.question_id}_finish-later"
|
|
|
|
checkbox_html = {class: 'checkbox',
|
|
|
|
id: "answer_#{option_id}",
|
2016-08-04 21:20:01 -05:00
|
|
|
name: "answer[#{question.input_type}][later]",
|
2016-08-01 15:16:20 -05:00
|
|
|
checked: Array(question.answer).include?('finish-later')
|
|
|
|
}
|
2016-08-08 17:08:20 -05:00
|
|
|
answers = answer.try(:answer) || answer
|
2016-08-01 15:16:20 -05:00
|
|
|
%>
|
2016-07-27 22:16:12 -05:00
|
|
|
|
2016-08-08 17:08:20 -05:00
|
|
|
<%= render partial: "quiz/answer_errors", locals: {question: question, answer: answer} %>
|
2016-08-05 13:10:10 -05:00
|
|
|
|
2016-08-08 17:08:20 -05:00
|
|
|
<div id="nojs<%= question.question_id %>" data-id="live-coder-finish-later">
|
2016-08-11 17:20:08 -05:00
|
|
|
<noscript>
|
|
|
|
<p class="warning">
|
|
|
|
This is a question where you will be asked to write code, and it utilizes a JavaScript-enabled
|
|
|
|
environment. It looks like JavaScript is not loaded.
|
|
|
|
<% unless params[:action] == 'summary' %>
|
|
|
|
Please check the box below to acknowledge that you agree to come back at a later time to finish
|
|
|
|
answering this question before you can submit the test.
|
|
|
|
<% else %>
|
|
|
|
You will need to enable JavaScript and answer this question before you can submit the test.
|
|
|
|
<% end %>
|
|
|
|
</p>
|
2016-08-04 22:28:20 -05:00
|
|
|
<% unless params[:action] == 'summary' %>
|
2016-08-11 17:20:08 -05:00
|
|
|
<%= form.check_box(:answer, checkbox_html, true, '') %>
|
|
|
|
<%= form.label(option_id, 'I will come back later to finish this code question') %>
|
2016-08-04 22:28:20 -05:00
|
|
|
<% end %>
|
2016-08-11 17:20:08 -05:00
|
|
|
</noscript>
|
2016-08-04 22:28:20 -05:00
|
|
|
</div>
|
2016-07-27 22:16:12 -05:00
|
|
|
|
2016-08-08 17:08:20 -05:00
|
|
|
<div id="answer<%= question.question_id %>" data-id="live-coder-answer" style="display: none;">
|
2016-08-11 17:44:30 -05:00
|
|
|
<label for="answer_live_code">Enter answer here</label>
|
|
|
|
<%= text_area_tag 'answer[live_code][text]', (answers['text']), {data: {last: answers['text']}} %>
|
|
|
|
|
2016-08-08 17:08:20 -05:00
|
|
|
<div class="code-input">
|
|
|
|
<label for="answer_live_code_html">HTML</label>
|
2016-08-11 17:44:30 -05:00
|
|
|
<%= text_area_tag 'answer[live_code][html]', (answers['html']), { data: {id: 'code-html', last: answers['html']}, class: 'code-answer code-html' } %>
|
2016-08-08 17:08:20 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="code-input">
|
|
|
|
<label for="answer_live_code_css">CSS</label>
|
2016-08-09 23:17:35 -05:00
|
|
|
<%= text_area_tag 'answer[live_code][css]', (answers['css']), { data: {id: 'code-css', last: answers['css']}, class: 'code-answer code-css' } %>
|
2016-08-08 17:08:20 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="code-input">
|
|
|
|
<label for="answer_live_code_js">JS</label>
|
2016-08-09 23:17:35 -05:00
|
|
|
<%= text_area_tag 'answer[live_code][js]', (answers['js']), { data: {id: 'code-js', last: answers['js']}, class: 'code-answer code-js' } %>
|
2016-08-08 17:08:20 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="results" data-id="results"></div>
|
2016-07-27 22:16:12 -05:00
|
|
|
</div>
|
2016-08-08 17:08:20 -05:00
|
|
|
|
|
|
|
<script>
|
|
|
|
<% # removes the no-js message SUPER FAST %>
|
|
|
|
document.getElementById("nojs<%= question.question_id %>").style.display = "none";
|
|
|
|
document.getElementById("answer<%= question.question_id %>").style.display = "";
|
|
|
|
</script>
|