skill-assessment-app/app/views/candidate/_checkbox.html.erb
2016-07-31 07:40:56 -05:00

20 lines
606 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)
}
%>
<div class="form-group-multiples">
<%= form.check_box(:answer, checkbox_html, option, '') %>
<%= form.label(option_id, option) %>
</div>
<% end %>
<% if flash[:error].try(:include?, question.to_i) %>
<div class="error">Please select an answer.</div>
<% end %>