Sha256: 13070557ae8f1f3ee31a9607eba8bf4ea5ffc663f010997962b5f148b96feed9

Contents?: true

Size: 462 Bytes

Versions: 24

Compression:

Stored size: 462 Bytes

Contents

module UiBibzInputs
  class UiSwitchFieldInput < BaseInput
    include UiBibz::Ui::Core::Forms::Choices

    def input(wrapper_options)
      UiBibz::Ui::Core::Forms::Choices::SwitchField.new(input_attribute_name, options, new_input_html_options).render
    end

    def new_input_html_options
      input_html_options.merge({ checked: value.nil? ? false : value })
    end

    def value
      @value ||= @builder.object.send(attribute_name)
    end

  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
ui_bibz-2.1.6 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.1.5 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.1.4 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.1.3 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.1.2 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.1.1 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.10 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.9 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.1.0 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.8 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.7 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.5 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.4 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.3 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.2 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.1 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.0 lib/ui_bibz/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.0.beta2.6 app/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.0.beta2.5 app/inputs/ui_bibz_inputs/ui_switch_field_input.rb
ui_bibz-2.0.0.beta2.4 app/inputs/ui_bibz_inputs/ui_switch_field_input.rb