skill-assessment-app/app/views/quiz/_checkbox.html.erb

19 lines
740 B
Plaintext
Raw Permalink Normal View History

2017-04-18 17:15:38 -05:00
<% answers = Array(question.answer) %>
<div role="group" aria-labelledby="<%= question.question_id %>">
<div id="<%= question.question_id %>">Check all that apply:</div>
<%= form.collection_check_boxes(:answer_array, question.input_options, :to_s, :to_s, {}, {class: ""}) do | option | %>
2016-09-02 17:51:35 -05:00
<%
option_id = "#{question.question_id}#{sanitize_to_id(option.value)}"
checked = answers.include?(option.value) ? 'checked' : ''
%>
2016-07-30 16:25:09 -05:00
2017-04-18 17:15:38 -05:00
<div>
2016-09-02 17:51:35 -05:00
<%= option.check_box( id: option_id, checked: checked, data: { last: checked } ) %>
2017-04-18 17:15:38 -05:00
<%= option.label( for: option_id, "aria-label" => option_id ) %>
2016-08-09 23:17:35 -05:00
</div>
2017-04-18 17:15:38 -05:00
<% end %>
</div>
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} %>