Module: Baddr::TagHelper

Defined in:
app/helpers/baddr/tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#baddr_city_tag(name, value, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'app/helpers/baddr/tag_helper.rb', line 10

def baddr_city_tag(name, value, options={})
  options[:class] = (options.with_indifferent_access[:class].presence || []) << 'baddr-cities'
  select_options = if @state_value.present?
    options_from_collection_for_select(City.for_state(@state_value), 'id', 'name', value)
  else
    ''
  end
  select_tag name, select_options, options
end

#baddr_state_tag(name, value, options = {}) ⇒ Object



3
4
5
6
7
8
9
# File 'app/helpers/baddr/tag_helper.rb', line 3

def baddr_state_tag(name, value, options={})
  @states = State.all
  @state_value = value
  select_options = options_from_collection_for_select @states, 'code', 'name', value
  options[:class] = (options.with_indifferent_access[:class].presence || []) << 'baddr-states'
  select_tag name, select_options, options
end