gurix/helena

View on GitHub
app/views/helena/questions/_radio_group.html.slim

Summary

Maintainability
Test Coverage
fieldset.radio_group id="question_#{question.code}" class="#{'helena-error' if errors[question.code]}"
  legend = question_label(question, dummy: true)

  - question.labels.each do |label|
    .radio
      label
        - checked = (answers[question.code].to_s == label.value.to_s) || label.preselected
        = form.simple_fields_for :answers do |answer_form|
          = answer_form.radio_button question.code, label.value, checked: checked
        = label.text
  - if errors[question.code]
    .error= errors[question.code]