view app/controller/Kommentare.js @ 456:683b8a3010cc

Show ortsType of Ort, and not otyp of ortedetail in orte listing.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 18 Dec 2013 11:04:50 +0100
parents 6a7a9267e00f
children debfcc7713e3
line wrap: on
line source
/**
 * Controller for Kommentare
 */
Ext.define('Lada.controller.Kommentare', {
    extend: 'Lada.controller.Base',
    views: [
        'kommentare.Create'
    ],
    stores: [
        'Kommentare'
    ],
    models: [
        'Kommentar'
    ],
    init: function() {
        console.log('Initialising the Kommentare controller');
        this.callParent();
    },
    addListeners: function() {
        this.control({
            'kommentarelist': {
                itemdblclick: this.editItem
            },
            'kommentarelist toolbar button[action=add]': {
                click: this.addItem
            },
            'kommentarelist toolbar button[action=delete]': {
                click: this.deleteItem
            },
            'kommentarecreate button[action=save]': {
                click: this.saveItem
            },
            'kommentarecreate form': {
                savesuccess: this.createSuccess,
                savefailure: this.createFailure
            }
        });
    },
    addItem: function(button) {
        console.log('Adding new Kommentar for Probe ' + button.probeId);
        var kommentar = Ext.create('Lada.model.Kommentar');
        kommentar.set('probeId', button.probeId);
        var view = Ext.widget('kommentarecreate', {model: kommentar});
    },
    editItem: function(grid, record) {
        console.log('Editing Kommentar');
        record.getAuthInfo(this.initEditWindow)
        console.log("Loaded Kommentar with ID " + record.getId()); //outputs ID
    },
    initEditWindow: function(record, readonly, owner) {
        var view = Ext.widget('kommentarecreate', {model: record});
        var ignore = Array();
        if (readonly) {
            var form = view.down('form');
            form.setReadOnly(true, ignore);
        }
    },
    createSuccess: function(form, record, operation) {
        var store = this.getKommentareStore();
        store.reload();
        var win = form.up('window');
        win.close();
    }
});

http://lada.wald.intevation.org