summaryrefslogtreecommitdiff
path: root/web/viewsjs/keys.js.erb
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2012-01-23 18:03:32 +0100
committerJochen Topf <jochen@topf.org>2012-01-23 18:03:32 +0100
commit9e2e806221d12e0804559e626c88994e5197399a (patch)
tree42fdd8f886672e328c6cc6a41e62ecd2e90c383e /web/viewsjs/keys.js.erb
parente82337c44404f4e42081db24152e86c8ca41e7a5 (diff)
downloadtaginfo-9e2e806221d12e0804559e626c88994e5197399a.tar
taginfo-9e2e806221d12e0804559e626c88994e5197399a.tar.gz
Move flexigrid table definitions into javascript files for each page which are created dynamically according to the language.
Diffstat (limited to 'web/viewsjs/keys.js.erb')
-rw-r--r--web/viewsjs/keys.js.erb39
1 files changed, 39 insertions, 0 deletions
diff --git a/web/viewsjs/keys.js.erb b/web/viewsjs/keys.js.erb
new file mode 100644
index 0000000..b1aebe4
--- /dev/null
+++ b/web/viewsjs/keys.js.erb
@@ -0,0 +1,39 @@
+function page_init() {
+ create_flexigrid('grid-keys', {
+ url: '/api/2/db/keys?include=prevalent_values',
+ colModel: [
+ { display: '<%= @trans.t.osm.key %>', name: 'key', width: 160, sortable: true },
+ { display: '<span title="Number of objects with this key (as absolute value and as percentage of all nodes, ways, and relations)"><img src="/img/types/all.16.png" alt=""/> Total</span>', name: 'count_all', width: 200, sortable: true, align: 'center' },
+ { display: '<span title="Number of nodes with this key (as absolute value and as percentage of tagged nodes, ie. nodes without any tags are ignored)"><img src="/img/types/node.16.png" alt=""/> Nodes</span>', name: 'count_nodes', width: 220, sortable: true, align: 'center' },
+ { display: '<span title="Number of ways with this key (as absolute value and as percentage of all ways)"><img src="/img/types/way.16.png" alt=""/> Ways</span>', name: 'count_ways', width: 220, sortable: true, align: 'center' },
+ { display: '<span title="Number of relations with this key (as absolute value and as percentage of all relations)"><img src="/img/types/relation.16.png" alt=""/> Relation</span>', name: 'count_relations', width: 220, sortable: true, align: 'center' },
+ { display: '<span title="Number of different users who last changed objects with this key">Users</span>', name: 'users_all', width: 44, sortable: true, align: 'right' },
+ { display: '<img src="/img/sources/wiki.16.png" alt="Wiki" title="Key has a wiki page"/>', name: 'in_wiki', width: 20, sortable: true, align: 'center' },
+ { display: '<img src="/img/sources/josm.16.png" alt="JOSM" title="Key appears in JOSM config"/>', name: 'in_josm', width: 20, sortable: true, align: 'center' },
+ { display: '<span title="Number of different values for this key">Values</span>', name: 'values_all', width: 70, sortable: true, align: 'right' },
+ { display: '<span title="Up to ten of the most common values for this key (only if more than 1% of tags with this key have this value)">Prevalent Values</span>', name: 'prevalent_values', width: 500, sortable: true }
+ ],
+ searchitems: [
+ { display: '<%= @trans.t.osm.key %>', name: 'key' }
+ ],
+ sortname: 'count_all',
+ sortorder: 'desc',
+ preProcess: function(data) {
+ data.rows = jQuery.map(data.data, function(row, i) {
+ return { 'cell': [
+ link_to_key(row.key),
+ print_value_with_percent(row.count_all, row.count_all_fraction),
+ print_value_with_percent(row.count_nodes, row.count_nodes_fraction),
+ print_value_with_percent(row.count_ways, row.count_ways_fraction),
+ print_value_with_percent(row.count_relations, row.count_relations_fraction),
+ print_with_ts(row.users_all),
+ row.in_wiki ? '&#x2714;' : '-',
+ row.in_josm ? '&#x2714;' : '-',
+ print_with_ts(row.values_all),
+ print_prevalent_value_list(row.key, row.prevalent_values)
+ ] };
+ });
+ return data;
+ }
+ });
+}