2016-08-09 23:17:35 -05:00
|
|
|
<% question.input_options.each_with_index do | option, i |
|
|
|
|
option_id = "#{question.question_id}_#{i}"
|
2016-07-30 16:25:09 -05:00
|
|
|
|
2016-08-09 23:17:35 -05:00
|
|
|
checkbox_html = {class: 'checkbox',
|
|
|
|
id: "answer_#{option_id}",
|
|
|
|
name: "answer[checkbox][]",
|
|
|
|
checked: Array(question.answer).include?(option),
|
|
|
|
data: { last: Array(question.answer).include?(option) ? 'checked' : '' }
|
|
|
|
}
|
|
|
|
answers = answer.try(:answer) || answer
|
|
|
|
%>
|
|
|
|
<div class="form-group-multiples">
|
|
|
|
<%= form.check_box(:answer, checkbox_html, option, '') %>
|
|
|
|
<%= form.label(option_id, option) %>
|
|
|
|
</div>
|
2016-07-28 20:54:08 -05:00
|
|
|
<% end %>
|
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} %>
|