summaryrefslogtreecommitdiff
path: root/web/viewsjs/reports/josm_styles.js.erb
blob: ea3b36576fa239b603606552246e647db44c4740 (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
<%
    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: '<%= osm.key %>',   name: 'key', width: 300, sortable: true },
            { display: '<%= osm.value %>', name: 'value', width: 300, sortable: true },
            { display: '<%= misc.icon %>', name: 'icon', width: 40, sortable: false, align: 'center' },
            { display: '<%= misc.line %>', name: 'line', width: 40, sortable: false, align: 'center' },
            { display: '<%= misc.area %>', name: 'area', width: 40, sortable: false, align: 'center' }
        ],
        searchitems: [
            { display: '<%= osm.key %>/<%= 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),
                    print_josm_value(row.key, row.value, row.value_bool),
                    print_josm_icon('standard', row.icon),
                    print_josm_line(row.line_width, row.line_color),
                    print_josm_area(row.area_color)
                ] };
            });
            return data;
        }
    });
}

function page_init() {
    page_init2();
}