summaryrefslogtreecommitdiff
path: root/web/viewsjs/reports/wiki_pages_about_non_existing_keys.js.erb
blob: 71c102dde38be073dcc186d600c5ed000f2bf56c (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
<%
    osm = @trans.t.osm
    page = @trans.t.reports.wiki_pages_about_non_existing_keys
 %>
function page_init() {
    up = function() { window.location = '/reports'; };
    create_flexigrid('grid-keys', {
        url: '/api/4/keys/all?filter=in_wiki,not_in_db&include=wikipages',
        colModel: [
            { display: '<img src="/img/sources/wiki.16.png" alt="Wiki" width="16" height="16" title="Wiki"/>', name: 'in_wiki', width: 20, sortable: true, align: 'center' },
            { display: '<img src="/img/sources/josm.16.png" alt="JOSM" width="16" height="16" title="JOSM"/>', name: 'in_josm', width: 20, sortable: true, align: 'center' },
            { display: '<%= h(osm.key) %>', name: 'key', width: 250, sortable: true, align: 'left' },
            { display: '<%= h(page.wiki_pages) %>', name: 'wikipages', width: 600, sortable: false, align: 'left' }
        ],
        searchitems: [
            { display: '<%= h(osm.key) %>', name: 'key' }
        ],
        sortname: 'count_all',
        sortorder: 'desc',
        preProcess: function(data) {
            data.rows = jQuery.map(data.data, function(row, i) {
                var wikilinks = [];
                jQuery(row.wikipages).each(function(i, wikipage) {
                    var w = link_to_wiki(wikipage.title);
                    if (wikipage.type == 'redirect') {
                        w += ' (REDIRECT)';
                    }
                    wikilinks.push(w);
                });
                return { 'cell': [
                    fmt_checkmark(row.in_wiki),
                    fmt_checkmark(row.in_josm),
                    link_to_key(row.key),
                    wikilinks.join(' &nbsp;&bull;&nbsp; ')
                ] };
            });
            return data;
        }
    });
}