summaryrefslogtreecommitdiff
path: root/web/viewsjs/reports/josm_styles.js.erb
blob: 6e49956e35d6236b0107049d92b246a0a3251bb9 (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
<%
    osm = @trans.t.osm
    misc = @trans.t.misc
 %>
function create_flexigrid_with_option(stylename) {
    create_flexigrid('grid-rules', {
        url: '/api/4/josm/style/rules?style=' + stylename,
        colModel: [
            { display: '<%= h(osm.key) %>',   name: 'key', width: 300, sortable: true },
            { display: '<%= h(osm.value) %>', name: 'value', width: 300, sortable: true },
            { display: '<%= h(misc.icon) %>', name: 'icon', width: 40, sortable: false, align: 'center' },
            { display: '<%= h(misc.line) %>', name: 'line', width: 40, sortable: false, align: 'center' },
            { display: '<%= h(misc.area) %>', name: 'area', width: 40, sortable: false, align: 'center' }
        ],
        searchitems: [
            { display: '<%= h(osm.key) %>/<%= h(osm.value) %>', name: 'key' }
        ],
        sortname: 'key',
        sortorder: 'asc',
        preProcess: function(data) {
            data.rows = jQuery.map(data.data, function(row, i) {
                return { 'cell': [
                    link_to_key(row.key),
                    fmt_josm_value(row.key, row.value, row.value_bool),
                    fmt_josm_icon('standard', row.icon),
                    fmt_josm_line(row.line_width, row.line_color),
                    fmt_josm_area(row.area_color)
                ] };
            });
            return data;
        }
    });
}

function page_init() {
    up = function() { window.location = '/reports'; };
    page_init2();
}