Module: GeographicAreasHelper

Defined in:
app/helpers/geographic_areas_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) geographic_area_autocomplete_tag(geographic_area, term)



8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/geographic_areas_helper.rb', line 8

def geographic_area_autocomplete_tag(geographic_area, term)
  return nil if geographic_area.nil?
  show_this =  geographic_area.name.gsub(/#{term}/, "<mark>#{term}</mark>") # weee bit simpler
  show_this += " (#{geographic_area.parent.name})" unless geographic_area.parent.nil?

  show_this += " [#{geographic_area.geographic_area_type.name}]" unless geographic_area.geographic_area_type.nil?

  show_this += " " + (geographic_area.has_shape? ? (:span, "has shape", class: "subtle passed") : (:span, "without shape", class: "subtle warning") )
  
  show_this.html_safe
end

- (Object) geographic_area_data_origin_select_tag



41
42
43
# File 'app/helpers/geographic_areas_helper.rb', line 41

def geographic_area_data_origin_select_tag
  select_tag(:data_origin, options_for_select(GeographicArea.pluck(:data_origin).uniq), include_blank: true)
end


21
22
23
24
25
# File 'app/helpers/geographic_areas_helper.rb', line 21

def geographic_area_link(geographic_area, link_text = nil)
  return nil if geographic_area.nil?
  link_text ||= geographic_area.name
  link_to(link_text, geographic_area)
end


35
36
37
38
39
# File 'app/helpers/geographic_areas_helper.rb', line 35

def geographic_area_link_list(geographic_areas)
  (:ul) do
    geographic_areas.collect { |a| (:li, geographic_area_link(a)) }.join.html_safe
  end
end

- (Object) geographic_area_tag(geographic_area)



3
4
5
6
# File 'app/helpers/geographic_areas_helper.rb', line 3

def geographic_area_tag(geographic_area)
  return nil if geographic_area.nil?
  geographic_area.name
end


31
32
33
# File 'app/helpers/geographic_areas_helper.rb', line 31

def geographic_areas_link_list_tag(geographic_areas)
  geographic_areas.collect { |ga| link_to(ga.name, ga) }.join(",")
end

- (Object) geographic_areas_search_form



27
28
29
# File 'app/helpers/geographic_areas_helper.rb', line 27

def geographic_areas_search_form
  render('/geographic_areas/quick_search_form')
end