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

20 lines
742 B
Plaintext
Raw Normal View History

<% answer_string = answer.try(:answer) || answer %>
2017-04-18 17:15:38 -05:00
<div role="group" aria-labelledby="<%= question.question_id %>">
<div id="<%= question.question_id %>">Select the best option:</div>
<%= form.collection_radio_buttons(:answer, question.input_options, :to_s, :to_s, {}, {class: ""}) do | option | %>
<%
option_id = "#{question.question_id}#{sanitize_to_id(option.value)}"
checked = answer_string == option.value ? 'checked' : ''
%>
<div>
<%= option.radio_button( id: option_id, checked: checked, data: { last: checked } ) %>
<%= option.label(for: option_id) %>
</div>
<% 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} %>