aboutsummaryrefslogtreecommitdiff
path: root/web/lib
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2014-09-06 22:06:15 +0200
committerJochen Topf <jochen@topf.org>2014-09-06 22:06:15 +0200
commit543a4a540b4f33e1933777a6bb47a3978bedf5c4 (patch)
treecd434ee461be10cba256e8a2fc5d6fa7b808afcf /web/lib
parent056f9be8994e0b636d450fae19ebf10584614054 (diff)
downloadtaginfo-543a4a540b4f33e1933777a6bb47a3978bedf5c4.tar
taginfo-543a4a540b4f33e1933777a6bb47a3978bedf5c4.tar.gz
Project files can now contain a list of object types for each key/tag.
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/api/v4/project.rb8
-rw-r--r--web/lib/api/v4/tag.rb10
2 files changed, 17 insertions, 1 deletions
diff --git a/web/lib/api/v4/project.rb b/web/lib/api/v4/project.rb
index d1a197b..b1fa2e8 100644
--- a/web/lib/api/v4/project.rb
+++ b/web/lib/api/v4/project.rb
@@ -9,6 +9,10 @@ class Taginfo < Sinatra::Base
:result => paging_results([
[:key, :STRING, 'Key'],
[:value, :STRING, 'Value'],
+ [:on_node, :BOOL, 'For nodes?'],
+ [:on_way, :BOOL, 'For ways?'],
+ [:on_relation, :BOOL, 'For relations?'],
+ [:on_area, :BOOL, 'For areas?'],
[:description, :STRING, 'Description'],
[:doc_url, :STRING, 'Documentation URL'],
[:icon_url, :STRING, 'Icon URL']
@@ -42,6 +46,10 @@ class Taginfo < Sinatra::Base
:data => res.map{ |row| {
:key => row['key'],
:value => row['value'],
+ :on_node => row['on_node'].to_i == 1,
+ :on_way => row['on_way'].to_i == 1,
+ :on_relation => row['on_relation'].to_i == 1,
+ :on_area => row['on_area'].to_i == 1,
:description => row['description'],
:doc_url => row['doc_url'],
:icon_url => row['icon_url']
diff --git a/web/lib/api/v4/tag.rb b/web/lib/api/v4/tag.rb
index f2ca53b..35e4870 100644
--- a/web/lib/api/v4/tag.rb
+++ b/web/lib/api/v4/tag.rb
@@ -262,6 +262,10 @@ class Taginfo < Sinatra::Base
[:project_name, :STRING, 'Project name'],
[:key, :STRING, 'Key'],
[:value, :STRING, 'Value'],
+ [:on_node, :BOOL, 'For nodes?'],
+ [:on_way, :BOOL, 'For ways?'],
+ [:on_relation, :BOOL, 'For relations?'],
+ [:on_area, :BOOL, 'For areas?'],
[:description, :STRING, 'Description'],
[:doc_url, :STRING, 'Documentation URL'],
[:icon_url, :STRING, 'Icon URL']
@@ -278,7 +282,7 @@ class Taginfo < Sinatra::Base
condition_if("value LIKE ? ESCAPE '@' OR name LIKE ? ESCAPE '@'", q, q).
get_first_value().to_i
- res = @db.select('SELECT t.project_id, p.name, t.key, t.value, t.description, t.doc_url, t.icon_url FROM projects.projects p, projects.project_tags t ON p.id=t.project_id').
+ res = @db.select('SELECT t.project_id, p.name, t.key, t.value, t.description, t.doc_url, t.icon_url, t.on_node, t.on_way, t.on_relation, t.on_area FROM projects.projects p, projects.project_tags t ON p.id=t.project_id').
condition('key = ?', key).
condition_if('value = ? OR VALUE IS NULL', value).
condition_if("value LIKE ? ESCAPE '@' OR name LIKE ? ESCAPE '@'", q, q).
@@ -304,6 +308,10 @@ class Taginfo < Sinatra::Base
:project_name => row['name'],
:key => row['key'],
:value => row['value'],
+ :on_node => row['on_node'].to_i == 1,
+ :on_way => row['on_way'].to_i == 1,
+ :on_relation => row['on_relation'].to_i == 1,
+ :on_area => row['on_area'].to_i == 1,
:description => row['description'],
:doc_url => row['doc_url'],
:icon_url => row['icon_url']