Sha256: a2eee1fc7ab05322a868771f012dc07b8b0909d2e011d660d46903ec48bd5b63

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

- label_width = "#{80 / question.labels.count}%"

.radio_matrix class="#{'helena-error' if errors.present?}"
  = question_label(question, dummy: true)

  table.table
    thead
      tr
        th
        - question.labels.each do |label|
          th width="#{label_width}"
            == label.text
    tbody
      - question.sub_questions.each do |sub_question|
        tr class="#{'error' if errors[sub_question.code]}" id="question_#{sub_question.code}"
          td
            = sub_question.parts.first
            - if errors[sub_question.code]
              .error= errors[sub_question.code]
          - question.labels.each do |label|
            - checked = answers[sub_question.code].to_s == label.value.to_s if answers[sub_question.code].present?
            - checked ||= (label.preselected? ? true : false)
            th width="#{label_width}"
              label
                = form.simple_fields_for :answers do |answer_form|
                  = answer_form.radio_button sub_question.code, label.value, checked: checked
                .label-text= label.text

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
helena-2.1.0 app/views/helena/questions/_radio_matrix.html.slim