summaryrefslogtreecommitdiff
path: root/web/viewsjs/keys.js.erb
blob: df633877f063bdb1b0e18003773a26cf2f8b5cc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<%
    osm = @trans.t.osm
    misc = @trans.t.misc
 %>
function page_init() {
    create_flexigrid('grid-keys', {
        url: '/api/4/keys/all?include=prevalent_values',
        colModel: [
            { display: '<%= osm.key %>', name: 'key', width: 160, sortable: true },
            { display: '<span title="<%= misc.objects_tooltip %>"><img src="/img/types/all.16.png" width="16" height="16" alt=""/> <%= osm.objects %></span>', name: 'count_all', width: 160, sortable: true, align: 'center' },
            { display: '<span title="<%= misc.nodes_tooltip %>"><img src="/img/types/node.16.png" width="16" height="16" alt=""/> <%= osm.nodes %></span>', name: 'count_nodes', width: 250, sortable: true, align: 'center' },
            { display: '<span title="<%= misc.ways_tooltip %>"><img src="/img/types/way.16.png" width="16" height="16" alt=""/> <%= osm.ways %></span>', name: 'count_ways', width: 250, sortable: true, align: 'center' },
            { display: '<span title="<%= misc.relations_tooltip %>"><img src="/img/types/relation.16.png" width="16" height="16" alt=""/> <%= osm.relations %></span>', name: 'count_relations',  width: 250, sortable: true, align: 'center' },
            { display: '<span title="<%= misc.users_tooltip %>"><%= osm.users %></span>', name: 'users_all', width: 44, sortable: true, align: 'right' },
            { display: '<img src="/img/sources/wiki.16.png" alt="Wiki" width="16" height="16" title="<%= misc.in_wiki_tooltip %>"/>', name: 'in_wiki', width: 20, sortable: true, align: 'center' },
            { display: '<img src="/img/sources/josm.16.png" alt="JOSM" width="16" height="16" title="<%= misc.in_josm_tooltip %>"/>', name: 'in_josm', width: 20, sortable: true, align: 'center' },
            { display: '<span title="<%= misc.values_tooltip %>"><%= osm.values %></span>', name: 'values_all', width: 70, sortable: true, align: 'right' },
            { display: '<span title="<%= misc.prevalent_values_tooltip %>"><%= misc.prevalent_values %></span>', name: 'prevalent_values', width: 500, sortable: true }
        ],
        searchitems: [
            { display: '<%= 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),
                    fmt_value_with_percent(row.count_all,       row.count_all_fraction),
                    fmt_value_with_percent(row.count_nodes,     row.count_nodes_fraction),
                    fmt_value_with_percent(row.count_ways,      row.count_ways_fraction),
                    fmt_value_with_percent(row.count_relations, row.count_relations_fraction),
                    fmt_with_ts(row.users_all),
                    fmt_checkmark(row.in_wiki),
                    fmt_checkmark(row.in_josm),
                    fmt_with_ts(row.values_all),
                    fmt_prevalent_value_list(row.key, row.prevalent_values)
                ] };
            });
            return data;
        }
    });
}