Class: Matestack::Ui::Bootstrap::Form::Radio

Inherits:
VueJs::Components::Form::Radio
  • Object
show all
Defined in:
lib/matestack/ui/bootstrap/form/radio.rb

Instance Method Summary collapse

Instance Method Details

#responseObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/matestack/ui/bootstrap/form/radio.rb', line 9

def response
  div class: "matestack-ui-bootstrap-radio" do
    label input_label, class: "form-label", ":for": id if input_label

    radio_options.to_a.each_with_index do |item, index|
      div class: "form-check #{'form-check-inline' if context.variant == :inline}" do
        input options.merge(radio_attributes(item)).merge(bootstrap_radio_attributes)
        label item_label(item), class: "form-check-label", ":for": item_id(item_value(item))
        if index == radio_options.to_a.size - 1
          render_errors
        end
      end
    end
    render_form_text if context.form_text
  end

end