summaryrefslogtreecommitdiff
path: root/web/viewsjs/tags.js.erb
blob: 6ba5c98a1923aa965126b4925567bfb26e02dcdc (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
<%
    osm = @trans.t.osm
    misc = @trans.t.misc
 %>
function page_init() {
    create_flexigrid('grid-tags', {
        url: '/api/4/tags/popular',
        colModel: [
            { display: '<%= osm.tag %>', name: 'tag', width: 300, 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: 260, 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: 220, 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: 220, 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: 220, sortable: true, align: 'center' }
        ],
        searchitems: [
            { display: '<%= osm.tag %>', name: 'tag' }
        ],
        sortname: 'count_all',
        sortorder: 'desc',
        preProcess: function(data) {
            data.rows = jQuery.map(data.data, function(row, i) {
                return { 'cell': [
                    '<span class="overflow">' + link_to_tag(row.key, row.value) + '</span>',
                    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)
                ] };
            });
            return data;
        }
    });
}