aboutsummaryrefslogtreecommitdiff
path: root/web
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
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')
-rw-r--r--web/lib/api/v4/project.rb8
-rw-r--r--web/lib/api/v4/tag.rb10
-rw-r--r--web/viewsjs/key.js.erb11
-rw-r--r--web/viewsjs/project.js.erb5
-rw-r--r--web/viewsjs/tag.js.erb11
5 files changed, 38 insertions, 7 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']
diff --git a/web/viewsjs/key.js.erb b/web/viewsjs/key.js.erb
index e384d5b..9bf8583 100644
--- a/web/viewsjs/key.js.erb
+++ b/web/viewsjs/key.js.erb
@@ -108,9 +108,9 @@ var create_flexigrid_for = {
link_to_wiki(row.title),
html_escape(row.description),
fmt_wiki_image_popup(row.image),
- fmt_type_icon('node', row.on_node) +
- fmt_type_icon('way', row.on_way) +
- fmt_type_icon('area', row.on_area) +
+ fmt_type_icon('node', row.on_node) +
+ fmt_type_icon('way', row.on_way) +
+ fmt_type_icon('area', row.on_area) +
fmt_type_icon('relation', row.on_relation),
fmt_key_or_tag_list(row.tags_implies),
fmt_key_or_tag_list(row.tags_combination),
@@ -151,6 +151,7 @@ var create_flexigrid_for = {
colModel: [
{ display: '<%= h(taginfo.project) %>', name: 'project_name', width: 280, sortable: true },
{ display: '<%= h(osm.tag) %>', name: 'key', width: 220, sortable: true },
+ { display: '<%= h(osm.objects) %>', name: 'objects', width: 80, sortable: false },
{ display: '<%= h(page.projects.description) %>', name: 'description', width: 600, sortable: false, align: 'left' }
],
searchitems: [
@@ -163,6 +164,10 @@ var create_flexigrid_for = {
return { 'cell': [
link_to_project(row.project_id, row.project_name),
row.value ? link_to_tag(row.key, row.value) : (link_to_key(row.key) + '=*'),
+ fmt_type_icon('node', row.on_node) +
+ fmt_type_icon('way', row.on_way) +
+ fmt_type_icon('area', row.on_area) +
+ fmt_type_icon('relation', row.on_relation),
project_tag_desc(row.description, row.icon_url, row.doc_url)
] };
});
diff --git a/web/viewsjs/project.js.erb b/web/viewsjs/project.js.erb
index 59af6dd..435b07f 100644
--- a/web/viewsjs/project.js.erb
+++ b/web/viewsjs/project.js.erb
@@ -8,6 +8,7 @@ var create_flexigrid_for = {
url: '/api/4/project/tags?project=' + encodeURIComponent(project),
colModel: [
{ display: '<%= h(osm.tag) %>', name: 'tag', width: 260, sortable: true },
+ { display: '<%= h(osm.objects) %>', name: 'objects', width: 80, sortable: false },
{ display: '<%= h(misc.description) %>', name: 'description', width: 800, sortable: false, align: 'left' }
],
searchitems: [
@@ -19,6 +20,10 @@ var create_flexigrid_for = {
data.rows = jQuery.map(data.data, function(row, i) {
return { 'cell': [
row.value ? link_to_tag(row.key, row.value) : (link_to_key(row.key) + '=*'),
+ fmt_type_icon('node', row.on_node) +
+ fmt_type_icon('way', row.on_way) +
+ fmt_type_icon('area', row.on_area) +
+ fmt_type_icon('relation', row.on_relation),
project_tag_desc(row.description, row.doc_url, row.icon_url)
] };
});
diff --git a/web/viewsjs/tag.js.erb b/web/viewsjs/tag.js.erb
index 1cc6e89..34b5935 100644
--- a/web/viewsjs/tag.js.erb
+++ b/web/viewsjs/tag.js.erb
@@ -88,9 +88,9 @@ var create_flexigrid_for = {
link_to_wiki(row.title),
html_escape(row.description),
fmt_wiki_image_popup(row.image),
- fmt_type_icon('node', row.on_node) +
- fmt_type_icon('way', row.on_way) +
- fmt_type_icon('area', row.on_area) +
+ fmt_type_icon('node', row.on_node) +
+ fmt_type_icon('way', row.on_way) +
+ fmt_type_icon('area', row.on_area) +
fmt_type_icon('relation', row.on_relation),
fmt_key_or_tag_list(row.tags_implies),
fmt_key_or_tag_list(row.tags_combination),
@@ -131,6 +131,7 @@ var create_flexigrid_for = {
colModel: [
{ display: '<%= h(taginfo.project) %>', name: 'project_name', width: 280, sortable: true },
{ display: '<%= h(osm.tag) %>', name: 'key', width: 220, sortable: true },
+ { display: '<%= h(osm.objects) %>', name: 'objects', width: 80, sortable: false },
{ display: '<%= h(page.projects.description) %>', name: 'description', width: 600, sortable: false, align: 'left' }
],
searchitems: [
@@ -143,6 +144,10 @@ var create_flexigrid_for = {
return { 'cell': [
link_to_project(row.project_id, row.project_name),
row.value ? link_to_tag(row.key, row.value) : (link_to_key(row.key) + '=*'),
+ fmt_type_icon('node', row.on_node) +
+ fmt_type_icon('way', row.on_way) +
+ fmt_type_icon('area', row.on_area) +
+ fmt_type_icon('relation', row.on_relation),
project_tag_desc(row.description, row.icon_url, row.doc_url)
] };
});