aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2010-11-22 22:45:23 +0100
committerJochen Topf <jochen@topf.org>2010-11-22 22:45:23 +0100
commit26f714820ff70ed4df4c0d5accc60ed77e475804 (patch)
tree5dc4ab053f30cb29fe100e2a64c8ecdccfae6c7e /web
parent5b3162413b91fd185b922dc1a84c4fcc62fb4354 (diff)
downloadtaginfo-26f714820ff70ed4df4c0d5accc60ed77e475804.tar
taginfo-26f714820ff70ed4df4c0d5accc60ed77e475804.tar.gz
Added first version of pages for embedding into wiki
Diffstat (limited to 'web')
-rw-r--r--web/lib/ui/embed.rb17
-rwxr-xr-xweb/taginfo.rb1
-rw-r--r--web/views/embed/key.erb10
-rw-r--r--web/views/embed/tag.erb10
4 files changed, 38 insertions, 0 deletions
diff --git a/web/lib/ui/embed.rb b/web/lib/ui/embed.rb
new file mode 100644
index 0000000..6561da6
--- /dev/null
+++ b/web/lib/ui/embed.rb
@@ -0,0 +1,17 @@
+# web/lib/ui/embed.rb
+class Taginfo < Sinatra::Base
+
+ get '/embed/key' do
+ @key = params[:key]
+ @count = @db.select("SELECT count_all FROM db.keys").condition('key = ?', @key).get_first_value().to_i
+ erb :'embed/key', :layout => false
+ end
+
+ get '/embed/tag' do
+ @key = params[:key]
+ @value = params[:value]
+ @count = @db.select("SELECT count_all FROM db.tags").condition('key = ?', @key).condition('value = ?', @value).get_first_value().to_i
+ erb :'embed/tag', :layout => false
+ end
+
+end
diff --git a/web/taginfo.rb b/web/taginfo.rb
index 265f4b0..0eb9465 100755
--- a/web/taginfo.rb
+++ b/web/taginfo.rb
@@ -281,6 +281,7 @@ class Taginfo < Sinatra::Base
load 'lib/ui/sources/josm.rb'
load 'lib/ui/sources/potlatch.rb'
load 'lib/ui/sources/merkaartor.rb'
+ load 'lib/ui/embed.rb'
load 'lib/ui/test.rb'
# run application
diff --git a/web/views/embed/key.erb b/web/views/embed/key.erb
new file mode 100644
index 0000000..27d6a64
--- /dev/null
+++ b/web/views/embed/key.erb
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ </head>
+ <body>
+ <p>TEST TEST TEST</p>
+ <p>There are <b><%= @count %></b> objects in the database with the key <b><%= escape_html(@key) %></b>.</p>
+ </body>
+</html>
diff --git a/web/views/embed/tag.erb b/web/views/embed/tag.erb
new file mode 100644
index 0000000..32ab764
--- /dev/null
+++ b/web/views/embed/tag.erb
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ </head>
+ <body>
+ <p>TEST TEST TEST</p>
+ <p>There are <b><%= @count %></b> objects in the database with the tag <b><%= escape_html(@key) %></b>=<b><%= escape_html(@value) %></b>.</p>
+ </body>
+</html>