worlddb-admin 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +34 -0
  3. data/app/assets/javascripts/world_db_admin/application.js +15 -0
  4. data/app/assets/stylesheets/world_db_admin/application.css.scss +98 -0
  5. data/app/controllers/world_db_admin/cities_controller.rb +28 -0
  6. data/app/controllers/world_db_admin/codes_controller.rb +14 -0
  7. data/app/controllers/world_db_admin/continents_controller.rb +16 -0
  8. data/app/controllers/world_db_admin/countries_controller.rb +142 -0
  9. data/app/controllers/world_db_admin/langs_controller.rb +14 -0
  10. data/app/controllers/world_db_admin/pages_controller.rb +12 -0
  11. data/app/controllers/world_db_admin/regions_controller.rb +25 -0
  12. data/app/controllers/world_db_admin/tags_controller.rb +34 -0
  13. data/app/controllers/world_db_admin/world_db_admin_controller.rb +9 -0
  14. data/app/helpers/world_db_admin/application_helper.rb +82 -0
  15. data/app/helpers/world_db_admin/part_helper.rb +58 -0
  16. data/app/helpers/world_db_admin/routes_helper.rb +65 -0
  17. data/app/views/layouts/world_db_admin/world_db_admin.html.erb +36 -0
  18. data/app/views/world_db_admin/cities/index.html.erb +43 -0
  19. data/app/views/world_db_admin/codes/index.html.erb +105 -0
  20. data/app/views/world_db_admin/continents/index.html.erb +56 -0
  21. data/app/views/world_db_admin/countries/_countries.html.erb +39 -0
  22. data/app/views/world_db_admin/countries/index.html.erb +51 -0
  23. data/app/views/world_db_admin/countries/index_territories.html.erb +31 -0
  24. data/app/views/world_db_admin/countries/show.html.erb +116 -0
  25. data/app/views/world_db_admin/langs/index.html.erb +28 -0
  26. data/app/views/world_db_admin/pages/about.html.erb +65 -0
  27. data/app/views/world_db_admin/pages/index.html.erb +2 -0
  28. data/app/views/world_db_admin/regions/index.html.erb +54 -0
  29. data/app/views/world_db_admin/shared/_cities.html.erb +11 -0
  30. data/app/views/world_db_admin/shared/_countries.html.erb +23 -0
  31. data/app/views/world_db_admin/shared/_regions.html.erb +22 -0
  32. data/app/views/world_db_admin/shared/_tags.html.erb +11 -0
  33. data/app/views/world_db_admin/tags/index.html.erb +15 -0
  34. data/app/views/world_db_admin/tags/show.html.erb +63 -0
  35. data/app/views/world_db_admin/tags/template.txt.erb +6 -0
  36. data/config/routes.rb +40 -0
  37. data/lib/worlddb/admin/version.rb +1 -1
  38. metadata +35 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8ca4eb95c0922cc8c4770738cba95c16b2a339e
4
- data.tar.gz: 81324669639ef486135f4e391ee99ff014936a36
3
+ metadata.gz: 69e92d7cfbff170d2cce8f477b9faec0c02bb5c4
4
+ data.tar.gz: d1ad4e6726485ba914d2ae6007d556cb93220a0c
5
5
  SHA512:
6
- metadata.gz: 71f2905461258e8c63f3c623b40d09aaca077b6f21400a22ea79808aabca43261b2c854203b4cccaed2d6f72e30cf509b8e96f16c7785f37308d73c68880447c
7
- data.tar.gz: 93f01390a1d3e1979091147e5bb6b83f775b84237e9493c72eeb47fdeba8cf8045999354371cfeaff3eddcc5087933245b22476e09d3c4b6c7c0901932145deb
6
+ metadata.gz: 654901b57abaaa4a74dd8d1a12f8ac007e538f0839f0c808db380d488bf76e8c25276a06aa99c1643937ff7b63ba9f9bfb9df3a56daadc74a3a96b2bc030dc67
7
+ data.tar.gz: 04e68d31afe9d370a40bb8293f09104b5b3944d4c886bacf62462fb2fb6a31796a9f81d831bff478bfb94d5dd5948b655b3ff43c92de0fa7178f3ff5b46cf616
data/Manifest.txt CHANGED
@@ -2,6 +2,40 @@ History.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
+ app/assets/javascripts/world_db_admin/application.js
6
+ app/assets/stylesheets/world_db_admin/application.css.scss
7
+ app/controllers/world_db_admin/cities_controller.rb
8
+ app/controllers/world_db_admin/codes_controller.rb
9
+ app/controllers/world_db_admin/continents_controller.rb
10
+ app/controllers/world_db_admin/countries_controller.rb
11
+ app/controllers/world_db_admin/langs_controller.rb
12
+ app/controllers/world_db_admin/pages_controller.rb
13
+ app/controllers/world_db_admin/regions_controller.rb
14
+ app/controllers/world_db_admin/tags_controller.rb
15
+ app/controllers/world_db_admin/world_db_admin_controller.rb
16
+ app/helpers/world_db_admin/application_helper.rb
17
+ app/helpers/world_db_admin/part_helper.rb
18
+ app/helpers/world_db_admin/routes_helper.rb
19
+ app/views/layouts/world_db_admin/world_db_admin.html.erb
20
+ app/views/world_db_admin/cities/index.html.erb
21
+ app/views/world_db_admin/codes/index.html.erb
22
+ app/views/world_db_admin/continents/index.html.erb
23
+ app/views/world_db_admin/countries/_countries.html.erb
24
+ app/views/world_db_admin/countries/index.html.erb
25
+ app/views/world_db_admin/countries/index_territories.html.erb
26
+ app/views/world_db_admin/countries/show.html.erb
27
+ app/views/world_db_admin/langs/index.html.erb
28
+ app/views/world_db_admin/pages/about.html.erb
29
+ app/views/world_db_admin/pages/index.html.erb
30
+ app/views/world_db_admin/regions/index.html.erb
31
+ app/views/world_db_admin/shared/_cities.html.erb
32
+ app/views/world_db_admin/shared/_countries.html.erb
33
+ app/views/world_db_admin/shared/_regions.html.erb
34
+ app/views/world_db_admin/shared/_tags.html.erb
35
+ app/views/world_db_admin/tags/index.html.erb
36
+ app/views/world_db_admin/tags/show.html.erb
37
+ app/views/world_db_admin/tags/template.txt.erb
38
+ config/routes.rb
5
39
  lib/worlddb/admin.rb
6
40
  lib/worlddb/admin/engine.rb
7
41
  lib/worlddb/admin/version.rb
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,98 @@
1
+
2
+
3
+ // $base-font-size: 18px; // was 20px
4
+ $base-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
5
+
6
+
7
+ $dark-gray: #333333;
8
+ $azure: #F0FFFF; // azure (see wikipedia web colors)
9
+
10
+
11
+ body
12
+ {
13
+ font-family: $base-font-family;
14
+ }
15
+
16
+
17
+ a {
18
+ color: black;
19
+ text-decoration: none;
20
+
21
+ &:hover {
22
+ color: black;
23
+ background-color: aqua;
24
+ text-decoration: underline;
25
+ }
26
+
27
+ &:visited { color: black; }
28
+ }
29
+
30
+ .city_10_000_000 { font-size: 24px; font-weight: bold; }
31
+ .city_1_000_000 { font-size: 20px; font-weight: bold; }
32
+ .city_500_000 { font-size: 16px; font-weight: bold; }
33
+ .city_100_000 { font-size: 14px; }
34
+ .city_10_000 { font-size: 12px; }
35
+ .city_nil { font-size: 14px; color: navy; }
36
+
37
+ .country_100_000_000 { font-size: 20px; font-weight: bold; }
38
+ .country_10_000_000 { font-size: 16px; font-weight: bold; }
39
+ .country_1_000_000 { font-size: 14px; }
40
+ .country_100_000 { font-size: 12px; }
41
+ .country_nil { font-size: 14px; color: navy; }
42
+
43
+
44
+ /***********
45
+ ne => not equal
46
+ x => missing
47
+ *****/
48
+ .code-ne,
49
+ .code-x {
50
+ color: navy;
51
+ border: 2px solid navy;
52
+ font-weight: bold;
53
+ }
54
+
55
+ .region-count,
56
+ .country-count,
57
+ .city-count,
58
+ .tag-count,
59
+ .tagging-count,
60
+ .tags,
61
+ .country-key,
62
+ .region-key,
63
+ .city-key,
64
+ .lang-key,
65
+ .lang-count {
66
+ color: $dark-gray;
67
+ font-size: 12px; // ~80%
68
+ }
69
+
70
+ table {
71
+ td.city-key,
72
+ td.country-key,
73
+ td.region-key {
74
+ color: $dark-gray;
75
+ font-size: 12px; // ~80%
76
+ * {
77
+ color: $dark-gray;
78
+ font-size: 12px; // ~80%
79
+ }
80
+ }
81
+ }
82
+
83
+
84
+
85
+ /////////////////////////
86
+ // version / powered_by
87
+
88
+ .version
89
+ {
90
+ text-align: center;
91
+ margin-top: 10px;
92
+ color: grey;
93
+
94
+ a, span {
95
+ font-size: 12px;
96
+ color: grey
97
+ }
98
+ }
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ module WorldDbAdmin
4
+
5
+ class CitiesController < WorldDbAdminController
6
+
7
+ # GET /cities
8
+ def index
9
+
10
+ order = params[:order]
11
+ @cities = case order
12
+ when 'pop' then City.by_pop.all
13
+ when 'popm' then City.order( 'popm desc' ).all
14
+ when 'title' then City.by_title.all
15
+ else City.by_key.all
16
+ end
17
+
18
+ end
19
+
20
+ # GET /:key
21
+ def shortcut
22
+ ## for now just redirect to cities page w/ anchor includes e.g cities/#newyork
23
+ redirect_to cities_path( :anchor => params[:key] )
24
+ end
25
+
26
+ end # class CitiesController
27
+
28
+ end # module WorldDbAdmin
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ module WorldDbAdmin
4
+
5
+ class CodesController < WorldDbAdminController
6
+
7
+ # GET /code
8
+ def index
9
+ @countries = Country.by_title.all
10
+ end
11
+
12
+ end # class CodesController
13
+
14
+ end # module WorldDbAdmin
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+
3
+ module WorldDbAdmin
4
+
5
+ class ContinentsController < WorldDbAdminController
6
+
7
+ # GET /continents
8
+ def index
9
+ @continents = Continent.all
10
+
11
+ @order = params[:order] || 'title'
12
+ end
13
+
14
+ end # class ContinentsController
15
+
16
+ end # module WorldDbAdmin
@@ -0,0 +1,142 @@
1
+ # encoding: utf-8
2
+
3
+ module WorldDbAdmin
4
+
5
+ COUNTRY_FILTER_TAGS = [
6
+ 'all',
7
+ 'un',
8
+ 'europe',
9
+ 'asia',
10
+ 'africa',
11
+ 'america',
12
+ 'north america',
13
+ 'south america',
14
+ 'central america',
15
+ 'caribbean',
16
+ 'oceania',
17
+ 'south asia',
18
+ 'southeast asia',
19
+ 'central asia',
20
+ 'east asia',
21
+ 'middle east',
22
+ 'western asia',
23
+ 'northern africa',
24
+ 'western africa',
25
+ 'central africa',
26
+ 'southern africa',
27
+ 'northern europe',
28
+ 'western europe',
29
+ 'central europe',
30
+ 'eastern europe',
31
+ 'southern europe',
32
+ 'southeastern europe',
33
+ 'balkans',
34
+ 'nordic',
35
+ 'eu',
36
+ 'schengen',
37
+ 'euro',
38
+ 'g8',
39
+ 'g5',
40
+ 'g20',
41
+ 'fifa',
42
+ 'uefa', # europe
43
+ 'caf', # africa
44
+ 'afc', # asia
45
+ 'afc waff', # Middle East / West Asia
46
+ 'ofc', # pacific
47
+ 'concacaf', # north&central america n caribbean
48
+ 'concacaf nafu', # North America
49
+ 'concacaf uncaf', # Central America
50
+ 'concacaf cfu', # Caribbean
51
+ 'conmebol' # south america
52
+
53
+
54
+ # 'pop_100m_n_up',
55
+ # 'pop_10m_n_up',
56
+ # 'pop_1m_n_up',
57
+ # 'area_1_000_000_n_up',
58
+ # 'area_100_000_n_up',
59
+ # 'area_1_000_n_up'
60
+ ]
61
+
62
+ class CountriesController < WorldDbAdminController
63
+
64
+ # GET /countries
65
+ def index
66
+
67
+ ## for now store order and tag in session
68
+ ## todo/fix: find a better way to store user order and filter settings
69
+
70
+ session[:order] = order = params[:order] || session[:order] || 'title'
71
+ session[:tag] = tag = params[:tag] || session[:tag] || 'all'
72
+
73
+ @countries = nil
74
+
75
+ if order == 'pop'
76
+ @countries = Country.by_pop
77
+ elsif order == 'area'
78
+ @countries = Country.by_area
79
+ elsif order == 'title'
80
+ @countries = Country.by_title
81
+ else
82
+ @countries = Country.by_title
83
+ end
84
+
85
+ =begin
86
+ if tag == 'all'
87
+ ## do nothing; include all
88
+ else
89
+ ## fix/todo: add with_tag() scope to Country!!!
90
+ country_ids = Tag.find_by_key!( tag ).country_ids
91
+
92
+ @countries = @countries.find( country_ids )
93
+ end
94
+ =end
95
+ @countries = @countries.where( c: true ).all
96
+ end
97
+
98
+ def index_territories
99
+
100
+ session[:order] = order = params[:order] || session[:order] || 'title'
101
+ session[:tag] = tag = params[:tag] || session[:tag] || 'all'
102
+
103
+ @countries = nil
104
+
105
+ if order == 'pop'
106
+ @countries = Country.by_pop
107
+ elsif order == 'area'
108
+ @countries = Country.by_area
109
+ elsif order == 'title'
110
+ @countries = Country.by_title
111
+ else
112
+ @countries = Country.by_title
113
+ end
114
+
115
+ =begin
116
+ if tag == 'all'
117
+ ## do nothing; include all
118
+ else
119
+ ## fix/todo: add with_tag() scope to Country!!!
120
+ country_ids = Tag.find_by_key!( tag ).country_ids
121
+
122
+ @countries = @countries.find( country_ids )
123
+ =end
124
+ @countries = @countries.where( d: true ).all
125
+ end
126
+
127
+
128
+ # GET /:key e.g /at or /us etc.
129
+ def shortcut
130
+ @country = Country.find_by_key!( params[:key] )
131
+ render :show
132
+ end
133
+
134
+ # GET /countries/:id e.g. /countries/1
135
+ def show
136
+ @country = Country.find( params[:id] )
137
+ end
138
+
139
+ end # class CountriesController
140
+
141
+
142
+ end # module WorldDbAdmin
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ module WorldDbAdmin
4
+
5
+ class LangsController < WorldDbAdminController
6
+
7
+ # GET /langs
8
+ def index
9
+ @langs = Lang.all
10
+ end
11
+
12
+ end # class LangsController
13
+
14
+ end # module WorldDbAdmin
@@ -0,0 +1,12 @@
1
+
2
+ module WorldDbAdmin
3
+
4
+ class PagesController < WorldDbAdminController
5
+ def index
6
+ end
7
+
8
+ def about
9
+ end
10
+ end
11
+
12
+ end # module WorldDbAdmin
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ module WorldDbAdmin
4
+
5
+ class RegionsController < WorldDbAdminController
6
+
7
+ # GET /regions
8
+ def index
9
+ @countries = Country.all
10
+ end
11
+
12
+ include RoutesHelper # need access to short_country_path for redirect
13
+
14
+ # GET /:country_key/:key e.g. /us/ny or /de/by
15
+ def shortcut
16
+ ## for now just redirect to country page w/ anchor includes e.g country/#ny
17
+ country = Country.find_by_key( params[:country_key] )
18
+ redirect_to short_country_path( country, anchor: params[:key] )
19
+ end
20
+
21
+
22
+
23
+ end # class RegionsController
24
+
25
+ end # module WorldDbAdmin
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+
3
+ module WorldDbAdmin
4
+
5
+ class TagsController < WorldDbAdminController
6
+
7
+ # GET /tags
8
+ def index
9
+ ## fix: Tag.by_key must be key asc !! but is desc? why? fix it
10
+ @tags = Tag.order('key asc').all
11
+ end
12
+
13
+ # GET /tag/:key e.g. /tag/euro or /tag/north_america
14
+ def shortcut
15
+ @tag = Tag.find_by_slug!( params[:key] )
16
+ @order = params[:order] || 'title'
17
+
18
+ ## magic parameter for dev -> generate yaml text template
19
+ if params[:yml].present? || params[:yaml].present?
20
+ render 'template.txt.erb', :layout => false, :content_type => 'text/plain'
21
+ return
22
+ end
23
+
24
+ render :show
25
+ end
26
+
27
+ # GET /tags/:id e.g. /tags/1
28
+ def show
29
+ @tag = Tag.find( params[:id] )
30
+ end
31
+
32
+ end # class TagsController
33
+
34
+ end # module WorldDbAdmin
@@ -0,0 +1,9 @@
1
+
2
+ module WorldDbAdmin
3
+
4
+ class WorldDbAdminController < ActionController::Base
5
+
6
+
7
+ end
8
+
9
+ end # module WorldDbAdmin
@@ -0,0 +1,82 @@
1
+ # encoding: utf-8
2
+
3
+ module WorldDbAdmin
4
+
5
+ module ApplicationHelper
6
+
7
+ def powered_by
8
+ ## todo/fix: use version from wettpool module
9
+ content_tag :div do
10
+ link_to( 'Questions? Comments?', 'http://groups.google.com/group/opensport' ) + " | " +
11
+ link_to( "world.db/#{WorldDb::VERSION}", 'https://github.com/geraldb/world.db' ) + ', ' +
12
+ link_to( 'world.db.admin/1', 'https://github.com/geraldb/world.db.admin' ) + ' - ' +
13
+ content_tag( :span, "Ruby/#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}/#{RUBY_PLATFORM}) on") + ' ' +
14
+ content_tag( :span, "Rails/#{Rails.version} (#{Rails.env})" ) + " | " +
15
+ link_to( 'Icon Drawer Flags', 'http://www.icondrawer.com' )
16
+ ## content_tag( :span, "#{request.headers['SERVER_SOFTWARE'] || request.headers['SERVER']}" )
17
+ end
18
+ end
19
+
20
+ def image_tag_for_country( country, opts={} )
21
+ if opts[:size] == 'large' || opts[:size] == '64x64'
22
+ image_tag "flags/64x64/#{country.key}.png"
23
+ else
24
+ image_tag "flags/24x24/#{country.key}.png"
25
+ end
26
+ end
27
+
28
+
29
+
30
+ def city_style( city )
31
+ # city_1_000_000 and up
32
+ # city_500_000 and up
33
+ # city_100_000 and up
34
+ # city_10_000 and up or less
35
+ # city_nil
36
+
37
+ pop = if city.popm.present? then city.popm
38
+ elsif city.pop.present? then city.pop
39
+ else nil
40
+ end
41
+
42
+ if pop.blank?
43
+ return 'city_nil'
44
+ elsif pop > 10000000
45
+ return 'city_10_000_000'
46
+ elsif pop > 1000000
47
+ return 'city_1_000_000'
48
+ elsif pop > 500000
49
+ return 'city_500_000'
50
+ elsif pop > 100000
51
+ return 'city_100_000'
52
+ else # assume < 100_000
53
+ return 'city_10_000'
54
+ end
55
+
56
+ end
57
+
58
+ def country_style( country )
59
+ # country_100_000_000 and up
60
+ # country_10_000_000 and up
61
+ # country_1_000_000 and up
62
+ # country_100_000 and up or less
63
+ # country_nil
64
+
65
+ if country.pop.blank?
66
+ return 'country_nil'
67
+ elsif country.pop > 100000000
68
+ return 'country_100_000_000'
69
+ elsif country.pop > 10000000
70
+ return 'country_10_000_000'
71
+ elsif country.pop > 1000000
72
+ return 'country_1_000_000'
73
+ else # assume < 100_000
74
+ return 'country_100_000'
75
+ end
76
+
77
+ end
78
+
79
+
80
+ end # module ApplicationHelper
81
+
82
+ end # module WorldDbAdmin
@@ -0,0 +1,58 @@
1
+ # encoding: utf-8
2
+
3
+ module WorldDbAdmin
4
+
5
+ module PartHelper
6
+
7
+ ###################################
8
+ # helper for shared partials
9
+ #
10
+ # by convention all start w/ render_
11
+
12
+ def render_tags( tags )
13
+ render :partial => 'world_db_admin/shared/tags', :locals => { :tags => tags }
14
+ end
15
+
16
+ def render_cities( cities )
17
+ render :partial => 'world_db_admin/shared/cities', :locals => { :cities => cities }
18
+ end
19
+
20
+
21
+ def render_countries( countries, opts={} )
22
+
23
+ if opts[:order].present?
24
+ if opts[:order] == 'key'
25
+ countries = countries.order( 'key ASC' )
26
+ elsif opts[:order] == 'title'
27
+ countries = countries.order( 'title ASC' )
28
+ elsif opts[:order] == 'code'
29
+ countries = countries.order( 'code ASC' )
30
+ end
31
+ end
32
+
33
+ render :partial => 'world_db_admin/shared/countries',
34
+ :locals => { :countries => countries,
35
+ :count => opts[:count] }
36
+ end
37
+
38
+ def render_regions( regions, opts={} )
39
+
40
+ if opts[:order].present?
41
+ if opts[:order] == 'key'
42
+ regions = regions.order( 'key ASC' )
43
+ elsif opts[:order] == 'title'
44
+ regions = regions.order( 'title ASC' )
45
+ elsif opts[:order] == 'code'
46
+ regions = regions.order( 'code ASC' )
47
+ end
48
+ end
49
+
50
+ render :partial => 'world_db_admin/shared/regions',
51
+ :locals => { :regions => regions,
52
+ :count => opts[:count] }
53
+ end
54
+
55
+
56
+ end # module PartHelper
57
+
58
+ end # module WorldDbAdmin
@@ -0,0 +1,65 @@
1
+ # encoding: utf-8
2
+
3
+ module WorldDbAdmin
4
+
5
+ module RoutesHelper
6
+
7
+ ################################
8
+ ## routes for export / download (dl)
9
+
10
+ def csv_countries_path
11
+ # dl_countries_path( format: 'csv' )
12
+ '/api/v1/countries.csv'
13
+ end
14
+
15
+ def table_countries_path
16
+ # dl_countries_path( format: 'html' )
17
+ '/api/v1/countries.html'
18
+ end
19
+
20
+ def csv_cities_path
21
+ # dl_cities_path( format: 'csv' )
22
+ '/api/v1/cities.csv'
23
+ end
24
+
25
+ def table_cities_path
26
+ # dl_cities_path( format: 'html' )
27
+ '/api/v1/cities.html'
28
+ end
29
+
30
+ def csv_countries_by_tag_path( tag )
31
+ ## NB: tag needs slug NOT key (key may contain spaces)
32
+ ## dl_countries_by_tag_worker_path( tag.slug, format: 'csv')
33
+ "/api/v1/tag/#{tag.slug}.csv"
34
+ end
35
+
36
+ def table_countries_by_tag_path( tag )
37
+ ## NB: tag needs slug NOT key (key may contain spaces)
38
+ ## dl_countries_by_tag_worker_path( tag.slug, format: 'html')
39
+ "/api/v1/tag/#{tag.slug}.html"
40
+ end
41
+
42
+
43
+ ##############################
44
+ ## routes for shortcuts
45
+
46
+ def short_country_path( country, opts={} )
47
+ short_country_worker_path( country.key, opts )
48
+ end
49
+
50
+ def short_region_path( region )
51
+ short_region_worker_path( region.country.key, region.key )
52
+ end
53
+
54
+ def short_city_path( city )
55
+ short_city_worker_path( city.key )
56
+ end
57
+
58
+ def short_tag_path( tag, opts={} )
59
+ ## NB: tag needs slug NOT key (key may contain spaces)
60
+ short_tag_worker_path( tag.slug, opts )
61
+ end
62
+
63
+ end # module RoutesHelper
64
+
65
+ end # module WorldDbAdmin