diff options
author | Jochen Topf <jochen@topf.org> | 2013-01-20 17:53:26 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2013-01-20 17:53:26 +0100 |
commit | 29bf3235f82be1f33f349fdf2f491120fea4a533 (patch) | |
tree | dc2b154b1b27cc16f3d7a792f9e2ca70eb401305 /web/viewsjs | |
parent | 722c7680195a9e6dba98950e8bdbe373b6830fbc (diff) | |
download | taginfo-29bf3235f82be1f33f349fdf2f491120fea4a533.tar taginfo-29bf3235f82be1f33f349fdf2f491120fea4a533.tar.gz |
Add search for relation type
Diffstat (limited to 'web/viewsjs')
-rw-r--r-- | web/viewsjs/search.js.erb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/web/viewsjs/search.js.erb b/web/viewsjs/search.js.erb index 9dcafa2..3e65214 100644 --- a/web/viewsjs/search.js.erb +++ b/web/viewsjs/search.js.erb @@ -22,6 +22,13 @@ function link_to_value_with_highlight(key, value, query) { ); } +function link_to_rtype_with_highlight(rtype, query) { + return link( + url_for_rtype(rtype), + highlight(rtype, query) + ); +} + var create_flexigrid_for = { keys: function(query) { create_flexigrid('grid-keys', { @@ -65,6 +72,26 @@ var create_flexigrid_for = { } }); }, + relations: function(query) { + create_flexigrid('grid-relations', { + url: '/api/4/relations/all?query=' + encodeURIComponent(query), + colModel: [ + { display: '<%= misc.count %>', name: 'count', width: 80, sortable: true, align: 'right' }, + { display: '<%= osm.relation_type %>', name: 'rtype', width: 500, sortable: true } + ], + sortname: 'count', + sortorder: 'desc', + preProcess: function(data) { + data.rows = jQuery.map(data.data, function(row, i) { + return { 'cell': [ + fmt_with_ts(row.count), + link_to_rtype_with_highlight(row.rtype, query) + ] }; + }); + return data; + } + }); + }, roles: function(query) { create_flexigrid('grid-roles', { url: '/api/4/search/by_role?query=' + encodeURIComponent(query), |