skill-assessment-app/app/views/quiz/_radio.html.erb
Mark Moser a977c0ceb3 refactor quiz processing
completes #60
2016-09-02 17:51:35 -05:00

16 lines
599 B
Plaintext

<% answer = answer.try(:answer) || answer %>
<%= form.collection_radio_buttons(:answer, question.input_options, :to_s, :to_s, {}, {class: 'radio'}) do | option | %>
<%
option_id = "#{question.question_id}#{sanitize_to_id(option.value)}"
checked = answer == option.value ? 'checked' : ''
%>
<div class="form-group-multiples">
<%= option.radio_button( id: option_id, checked: checked, data: { last: checked } ) %>
<%= option.label(for: option_id) %>
</div>
<% end %>
<%= render partial: "quiz/answer_errors", locals: {question: question, answer: answer} %>