class UiBibz::Ui::Core::Forms::Selects::AbstractSelect

Create a SelectField

This element is an extend of UiBibz::Ui::Core::Component. source : silviomoreto.github.io/bootstrap-select/examples/

Attributes

Options

You can add HTML attributes using the html_options. You can pass arguments in options attribute:

Signatures

UiBibz::Ui::Core::Forms::Selects::SelectField.new(content, options = {}, html_options = {}).render

UiBibz::Ui::Core::Forms::Selects::SelectField.new(options = {}, html_options = {}) do
  content
end.render

Examples

UiBibz::Ui::Core::Forms::Selects::SelectField.new('fruits', { option_tags: list_of_fruits, searchable: true }, { class: 'test' })

UiBibz::Ui::Core::Forms::Selects::SelectField.new({ option_tags: list_of_fruits, actions_box: true }, { class: 'test' }) do
  'fruits'
end

Helper

select_field(content, options = {}, html_options = {})

Public Instance Methods

pre_render() click to toggle source

Render html tag

# File lib/ui_bibz/ui/core/forms/selects/abstract_select.rb, line 76
def pre_render
  surround_field select_field_html_tag
end

Private Instance Methods

component_html_options() click to toggle source

Try to put it on a line

# File lib/ui_bibz/ui/core/forms/selects/abstract_select.rb, line 87
def component_html_options
  super.merge({
                multiple: options[:multiple],
                disabled: options[:state] == :disabled,
                include_blank: options[:include_blank],
                prompt: options[:prompt]
              })
end
select_field_html_tag() click to toggle source
# File lib/ui_bibz/ui/core/forms/selects/abstract_select.rb, line 82
def select_field_html_tag
  select_tag content, options[:option_tags], html_options
end