Sha256: 903308485c41f3dbfd946a59101c8b3e1b732acd06874fe485a753b440be61e0

Contents?: true

Size: 968 Bytes

Versions: 2

Compression:

Stored size: 968 Bytes

Contents

class RadioAsAccessibleInput < SimpleForm::Inputs::CollectionInput
  def label
    ""
  end

  def input_type
    "radio"
  end

  def input
    input_options[:collection_wrapper_tag] ||= options.fetch(:collection_wrapper_tag, SimpleForm.collection_wrapper_tag)
    label_method, value_method = detect_collection_methods
    input_dom = @builder.send(:"collection_#{input_type}_buttons",
                              attribute_name, collection,
                              value_method, label_method,
                              input_options, input_html_options)
    if input_options[:required]
      fieldset = "<fieldset class='radio_buttons normal required' aria-required='true'>"
    else
      fieldset = "<fieldset class='radio_buttons normal'>"
    end

    dom = <<-STRING
    #{fieldset}
      <legend>#{input_options[:label]}</legend>
      <div class='options'>
        #{input_dom}
      </div>
    </fieldset>
    STRING
    dom.html_safe
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
undercase-0.2.57 app/inputs/radio_as_accessible_input.rb
undercase-0.2.29 app/inputs/radio_as_accessible_input.rb