summaryrefslogtreecommitdiff
path: root/web/viewsjs/reports/similar_keys.js.erb
blob: 1ea191ebfad0bcce13974cc28d09feb16851e1ce (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
<%
    osm = @trans.t.osm
    misc = @trans.t.misc
    sim = @trans.t.reports.similar_keys
 %>
function page_init() {
    up = function() { window.location = '/reports'; };
        create_flexigrid('grid-keys', {
            url: '/api/4/keys/similar',
            colModel: [
                { display: '<%= h(sim.key_common) %>', name: 'key_common', width: 350, sortable: true },
                { display: '<%= h(sim.count_common) %>', name: 'count_all_common', width: 100, sortable: true, align: 'right' },
                { display: '<%= h(sim.key_rare) %>', name: 'key_rare', width: 350, sortable: true },
                { display: '<%= h(sim.count_rare) %>', name: 'count_all_rare', width: 100, sortable: true, align: 'right' },
                { display: '<%= h(sim.similarity) %>', name: 'similarity', width: 100, sortable: true, align: 'right' }
            ],
            searchitems: [
                { display: '<%= h(osm.key) %>', name: 'common_key' }
            ],
            sortname: 'count_all_common',
            sortorder: 'desc',
            preProcess: function(data) {
                data.rows = jQuery.map(data.data, function(row, i) {
                    return { 'cell': [
                        link_to_key(row.key_common),
                        row.count_all_common,
                        link_to_key(row.key_rare),
                        row.count_all_rare,
                        row.similarity
                    ] };
                });
                return data;
            }
        });
}