skill-assessment-app/app/views/quiz/_checkbox.html.erb
2016-08-08 17:08:20 -05:00

19 lines
623 B
Plaintext

<%
question.input_options.each_with_index do | option, i |
option_id = "#{question.question_id}_#{i}"
checkbox_html = {class: 'checkbox',
id: "answer_#{option_id}",
name: "answer[checkbox][]",
checked: Array(question.answer).include?(option)
}
answers = answer.try(:answer) || answer
%>
<div class="form-group-multiples">
<%= form.check_box(:answer, checkbox_html, option, '') %>
<%= form.label(option_id, option) %>
</div>
<% end %>
<%= render partial: "quiz/answer_errors", locals: {question: question, answer: answer} %>