summaryrefslogtreecommitdiff
path: root/web/viewsjs/reports/frequently_used_keys_without_wiki_page.js.erb
blob: d405fe5acdae37093a97761081312ce68d21ae63 (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
44
45
46
47
<%
    osm = @trans.t.osm
    misc = @trans.t.misc
    page = @trans.t.reports.frequently_used_keys_without_wiki_page
 %>
function create_flexigrid_with_option(english) {
    create_flexigrid('grid-keys', {
        url: '/api/4/keys/without_wiki_page?english=' + english,
        colModel: [
            { display: '<%= page.table.create_wiki_page %>', name: 'create_wiki_page', width: 200, sortable: false },
            { display: '<%= osm.key %>', name: 'key', width: 180, 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: 70, sortable: true, align: 'right' },
            { display: '<%= osm.users %>', name: 'users_all', width: 44, sortable: true, align: 'right' },
            { 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': [
                    print_wiki_link('Key:' + row.key, { edit: true }),
                    link_to_key(row.key),
                    print_with_ts(row.count_all),
                    print_with_ts(row.users_all),
                    print_with_ts(row.values_all),
                    print_prevalent_value_list(row.key, row.prevalent_values)
                ] };
            });
            return data;
        }
    });
}

function page_init() {
    up = function() { window.location = '/reports'; };
    page_init2();
    jQuery('#english').bind('click', function() {
        jQuery('#grid-keys').flexOptions({
            url: '/api/4/keys/without_wiki_page?english=' + (jQuery('#english')[0].checked ? '1' : '0')
        });
        jQuery('#grid-keys').flexReload();
    });
}