pattern-view.js 1.38 KB
/* global $dj, slickgrid, edit */

var text_ops = ['eq', 'ne', 'bw', 'bn', 'ew', 'en', 'cn', 'nc', 're', 'nr'];
var eqne = ['eq', 'ne'];

$.extend(slickgrid, {
    grid_caption: "Wzory",
    grid_element_id: 'pattern-grid',
    main_field: 'name',
    initial_columns: $dj.initial_columns,
    initial_sort_rules: [],
    all_columns: {
        'name': {id: 'name', name: 'Id', field: 'name'},
        'type': {id: 'type', name: 'Typ', field: 'type'},
        'pos': {id: 'pos', name: 'Cz. mowy', field: 'lexical_class'},
        'example': {id: 'example', name: 'Przykład', field: 'example'}
    },
    filter_fields: {
        'name': {name: 'Nazwa', gender: 'f', ops: text_ops},
        'old_name': {name: 'Stara nazwa', gender: 'f', ops: text_ops},
        'lexical_class': {
            name: 'Część mowy',
            gender: 'f',
            ops: eqne,
            options: $dj.lexical_class_options
        },
        'type': {
            name: 'Typ',
            gender: 'm',
            ops: eqne,
            optgroups: $dj.pattern_type_options
        },
        'base_form_label': {name: 'Efobaz', gender: 'm', ops: eqne}
    },
    load_content: function(id) {
        "use strict";
        function check() {
            return id === slickgrid.active_id();
        }
        edit.busy_on();
        edit.load_content(id, check);
    },
    init_sort: function() {},
    init: function() {}
});