Sha256: ba9399c64e441dd7eeca790dec34ae6b136dfc633e3a9b8cbb79f95bafc70d1c

Contents?: true

Size: 645 Bytes

Versions: 1

Compression:

Stored size: 645 Bytes

Contents

# frozen_string_literal: true

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

    def label
      false
    end

    def input(_wrapper_options)
      UiBibz::Ui::Core::Forms::Choices::CheckboxField.new(input_attribute_name, new_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

    def new_options
      options.merge({ label: options[:label] || attribute_name.to_s.titleize })
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ui_bibz-3.0.0.alpha5 lib/ui_bibz/inputs/ui_bibz_inputs/ui_checkbox_field_input.rb