<% osm = @trans.t.osm misc = @trans.t.misc search = @trans.t.pages.search %> var create_flexigrid_for = { keys: function(query) { create_flexigrid('grid-keys', { url: '/api/4/keys/all?query=' + encodeURIComponent(query), colModel: [ { display: '<%= h(misc.count) %>', name: 'count_all', width: 80, sortable: true, align: 'right' }, { display: '<%= h(osm.key) %>', name: 'key', width: 500, sortable: true } ], sortname: 'count_all', sortorder: 'desc', preProcess: function(data) { data.rows = jQuery.map(data.data, function(row, i) { return { 'cell': [ fmt_with_ts(row.count_all), link_to_key_with_highlight(row.key, query) ] }; }); return data; } }); }, values: function(query) { create_flexigrid('grid-values', { url: '/api/4/search/by_value?query=' + encodeURIComponent(query), colModel: [ { display: '<%= h(misc.count) %>', name: 'count_all', width: 80, sortable: true, align: 'right' }, { display: '<%= h(osm.key) %>', name: 'key', width: 250, sortable: true }, { display: '<%= h(osm.value) %>', name: 'value', width: 500, sortable: true } ], sortname: 'count_all', sortorder: 'desc', preProcess: function(data) { data.rows = jQuery.map(data.data, function(row, i) { return { 'cell': [ fmt_with_ts(row.count_all), link_to_key(row.key), link_to_value_with_highlight(row.key, row.value, query) ] }; }); return data; } }); }, relations: function(query) { create_flexigrid('grid-relations', { url: '/api/4/relations/all?query=' + encodeURIComponent(query), colModel: [ { display: '<%= h(misc.count) %>', name: 'count', width: 80, sortable: true, align: 'right' }, { display: '<%= h(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), colModel: [ { display: '<%= h(misc.count) %>', name: 'count_all', width: 80, sortable: true, align: 'right' }, { display: '<%= h(osm.relation_types) %>', name: 'rtype', width: 250, sortable: true }, { display: '<%= h(osm.relation_member_roles) %>', name: 'role', width: 500, sortable: true } ], sortname: 'count_all', sortorder: 'desc', preProcess: function(data) { data.rows = jQuery.map(data.data, function(row, i) { return { 'cell': [ fmt_with_ts(row.count_all), link_to_rtype(row.rtype), highlight(row.role, query) ] }; }); return data; } }); }, tags: function(query) { var q = query.split('=', 2); create_flexigrid('grid-tags', { url: '/api/4/search/by_key_and_value?query=' + encodeURIComponent(query), colModel: [ { display: '<%= h(misc.count) %>', name: 'count_all', width: 80, sortable: true, align: 'right' }, { display: '<%= h(osm.key) %>', name: 'key', width: 300, sortable: true }, { display: '<%= h(osm.value) %>', name: 'value', width: 500, sortable: true } ], sortname: 'count_all', sortorder: 'desc', preProcess: function(data) { data.rows = jQuery.map(data.data, function(row, i) { return { 'cell': [ fmt_with_ts(row.count_all), link_to_key_with_highlight(row.key, q[0]), link_to_value_with_highlight(row.key, row.value, q[1]) ] }; }); return data; } }); }, fulltext: function(query) { create_flexigrid('grid-fulltext', { url: '/api/4/search/by_keyword?query=' + encodeURIComponent(query), colModel: [ { display: '<%= h(osm.key) %>', name: 'key', width: 300, sortable: true }, { display: '<%= h(osm.value) %>', name: 'value', width: 500, sortable: true } ], sortname: 'key', sortorder: 'asc', preProcess: function(data) { data.rows = jQuery.map(data.data, function(row, i) { return { 'cell': [ link_to_key(row.key), row.value ? link_to_value(row.key, row.value) : '' ] }; }); return data; } }); } }; function page_init() { page_init2(); }