class UiBibz::Ui::Core::Forms::Selects::SelectField

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 }, { class: 'test' }).render

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

Helper

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

Private Instance Methods

component_html_classes() click to toggle source

See UiBibz::Ui::Core::Component.initialize

# File lib/ui_bibz/ui/core/forms/selects/select_field.rb, line 67
def component_html_classes
  super << ['select-field', 'form-control', 'form-select', size]
end
component_options() click to toggle source
# File lib/ui_bibz/ui/core/forms/selects/select_field.rb, line 71
def component_options
  options[:status].nil? ? super : super.merge({ surrounded: true })
end
size() click to toggle source
# File lib/ui_bibz/ui/core/forms/selects/select_field.rb, line 75
def size
  "form-select-#{options[:size]}" unless options[:size].nil?
end