summaryrefslogtreecommitdiff
path: root/web/lib
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2012-01-15 21:06:21 +0100
committerJochen Topf <jochen@topf.org>2012-01-15 21:06:21 +0100
commita7357ac505d2dee358c31190f6a5c755228045c3 (patch)
tree68e8f38ceaf93737004247d065bf4b804420ccb0 /web/lib
parentab6e34d587c7c3d3e29879ddd9940c773c625b54 (diff)
downloadtaginfo-a7357ac505d2dee358c31190f6a5c755228045c3.tar
taginfo-a7357ac505d2dee358c31190f6a5c755228045c3.tar.gz
Section cleanup
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/ui/reports.rb3
-rw-r--r--web/lib/ui/test.rb6
-rw-r--r--web/lib/utils.rb5
3 files changed, 8 insertions, 6 deletions
diff --git a/web/lib/ui/reports.rb b/web/lib/ui/reports.rb
index 0a16558..c26e35d 100644
--- a/web/lib/ui/reports.rb
+++ b/web/lib/ui/reports.rb
@@ -9,8 +9,7 @@ class Taginfo < Sinatra::Base
Report.each do |report|
get report.url do
@title = report.title
- @section = 'reports'
- @section_title = 'reports'
+ section :reports
erb ('reports/' + report.name).to_sym
end
end
diff --git a/web/lib/ui/test.rb b/web/lib/ui/test.rb
index ba66f3b..296ecf6 100644
--- a/web/lib/ui/test.rb
+++ b/web/lib/ui/test.rb
@@ -7,8 +7,7 @@ class Taginfo < Sinatra::Base
end
get! '/test/tags' do
- @section = 'test'
- @section_title = 'Test'
+ section :test
@title = ['Tags', 'Test']
limit = 300;
(@min, @max) = @db.select('SELECT min(count) AS min, max(count) AS max FROM popular_keys').get_columns(:min, :max)
@@ -20,8 +19,7 @@ class Taginfo < Sinatra::Base
end
get '/test/wiki_import' do
- @section = 'test'
- @section_title = 'Test'
+ section :test
@title = ['Wiki Import', 'Test']
@invalid_page_titles = @db.select('SELECT * FROM invalid_page_titles').execute()
erb :'test/wiki_import'
diff --git a/web/lib/utils.rb b/web/lib/utils.rb
index c18575b..2b1712d 100644
--- a/web/lib/utils.rb
+++ b/web/lib/utils.rb
@@ -35,6 +35,11 @@ def title
@title.join(' | ')
end
+def section(id)
+ @section = id.to_s
+ @section_title = t.taginfo[@section]
+end
+
# Escape tag key or value for XAPI according to
# http://wiki.openstreetmap.org/wiki/XAPI#Escaping
def xapi_escape(text)