aboutsummaryrefslogtreecommitdiff
path: root/web/viewsjs
diff options
context:
space:
mode:
Diffstat (limited to 'web/viewsjs')
-rw-r--r--web/viewsjs/search.js.erb27
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),