Module: WorldDbAdmin::ApplicationHelper

Defined in:
app/helpers/world_db_admin/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#city_style(city) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/helpers/world_db_admin/application_helper.rb', line 30

def city_style( city )
 # city_1_000_000 and up
 # city_500_000 and up
 # city_100_000 and up
 # city_10_000 and up or less
 # city_nil
 
  pop =  if city.popm.present?   then city.popm
         elsif city.pop.present? then city.pop
         else  nil
         end
 
  if pop.blank?
    return 'city_nil'
  elsif pop > 10000000
    return 'city_10_000_000'
  elsif pop > 1000000
    return 'city_1_000_000'
  elsif pop > 500000
    return 'city_500_000'
  elsif pop > 100000
    return 'city_100_000'
  else # assume < 100_000
    return 'city_10_000'
  end
 
end

#country_style(country) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'app/helpers/world_db_admin/application_helper.rb', line 58

def country_style( country )
 # country_100_000_000 and up
 # country_10_000_000 and up
 # country_1_000_000 and up
 # country_100_000 and up or less
 # country_nil
 
  if country.pop.blank?
    return 'country_nil'
  elsif country.pop > 100000000
    return 'country_100_000_000'
  elsif country.pop > 10000000
    return 'country_10_000_000'
  elsif country.pop > 1000000
    return 'country_1_000_000'
  else # assume < 100_000
    return 'country_100_000'
  end
 
end

#image_tag_for_country(country, opts = {}) ⇒ Object



20
21
22
23
24
25
26
# File 'app/helpers/world_db_admin/application_helper.rb', line 20

def image_tag_for_country( country, opts={} )
  if opts[:size] == 'large' || opts[:size] == '64x64'
    image_tag "flags/64x64/#{country.key}.png"
  else
    image_tag "flags/24x24/#{country.key}.png"
  end
end

#powered_byObject



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

def powered_by
  ## todo/fix: use version from wettpool module
   :div do
    link_to( 'Questions? Comments?', 'http://groups.google.com/group/opensport' ) + " | " +
    link_to( "world.db/#{WorldDb::VERSION}", 'https://github.com/geraldb/world.db' )  + ', ' +
    link_to( 'world.db.admin/1', 'https://github.com/geraldb/world.db.admin' ) + ' - ' + 
    ( :span, "Ruby/#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}/#{RUBY_PLATFORM}) on") + ' ' +
    ( :span, "Rails/#{Rails.version} (#{Rails.env})" ) + " | " + 
    link_to( 'Icon Drawer Flags', 'http://www.icondrawer.com' )
    ## content_tag( :span, "#{request.headers['SERVER_SOFTWARE'] || request.headers['SERVER']}" )
  end
end