Module: TamSelectHelper

Defined in:
lib/generators/tam_select/templates/tam_select_helper.rb

Instance Method Summary collapse

Instance Method Details

#tam_select_options(**overrides) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/generators/tam_select/templates/tam_select_helper.rb', line 9

def tam_select_options(**overrides)
  {
    searchable: true,
    clearable: true,
    creatable: false,
    placeholder: "Select…"
  }.merge(overrides)
end

#tam_select_tag(name, option_tags = nil, options: {}, html_options: {}, &block) ⇒ Object



2
3
4
5
6
7
# File 'lib/generators/tam_select/templates/tam_select_helper.rb', line 2

def tam_select_tag(name, option_tags = nil, options: {}, html_options: {}, &block)
  data = (html_options[:data] ||= {})
  data[:controller] = [data[:controller], "tam-select"].compact.join(" ")
  data[:tam_select_options_value] = options.to_json
  select_tag(name, option_tags, html_options, &block)
end