Mercurial > lada > lada-client
comparison app/controller/Kommentare.js @ 491:850ccfe5f3c4
Code style.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 31 Oct 2014 23:23:32 +0100 |
parents | 446e99cfd425 |
children | 7c0653e8d9f7 |
comparison
equal
deleted
inserted
replaced
490:446e99cfd425 | 491:850ccfe5f3c4 |
---|---|
9 /** | 9 /** |
10 * Controller for Kommentare | 10 * Controller for Kommentare |
11 */ | 11 */ |
12 Ext.define('Lada.controller.Kommentare', { | 12 Ext.define('Lada.controller.Kommentare', { |
13 extend: 'Lada.controller.Base', | 13 extend: 'Lada.controller.Base', |
14 | |
14 views: [ | 15 views: [ |
15 'kommentare.Create' | 16 'kommentare.Create' |
16 ], | 17 ], |
18 | |
17 stores: [ | 19 stores: [ |
18 'KommentareP' | 20 'KommentareP' |
19 ], | 21 ], |
22 | |
20 models: [ | 23 models: [ |
21 'KommentarP' | 24 'KommentarP' |
22 ], | 25 ], |
26 | |
23 init: function() { | 27 init: function() { |
24 console.log('Initialising the Kommentare controller'); | 28 console.log('Initialising the Kommentare controller'); |
25 this.callParent(); | 29 this.callParent(); |
26 }, | 30 }, |
31 | |
27 addListeners: function() { | 32 addListeners: function() { |
28 this.control({ | 33 this.control({ |
29 'kommentarelist': { | 34 'kommentarelist': { |
30 itemdblclick: this.editItem | 35 itemdblclick: this.editItem |
31 }, | 36 }, |
42 savesuccess: this.createSuccess, | 47 savesuccess: this.createSuccess, |
43 savefailure: this.createFailure | 48 savefailure: this.createFailure |
44 } | 49 } |
45 }); | 50 }); |
46 }, | 51 }, |
52 | |
47 addItem: function(button) { | 53 addItem: function(button) { |
48 console.log('Adding new Kommentar for Probe ' + button.probeId); | 54 console.log('Adding new Kommentar for Probe ' + button.probeId); |
49 var kommentar = Ext.create('Lada.model.KommentarP'); | 55 var kommentar = Ext.create('Lada.model.KommentarP'); |
50 kommentar.set('probeId', button.probeId); | 56 kommentar.set('probeId', button.probeId); |
51 var view = Ext.widget('kommentarecreate', {model: kommentar}); | 57 var view = Ext.widget('kommentarecreate', { |
58 model: kommentar | |
59 }); | |
52 }, | 60 }, |
61 | |
53 editItem: function(grid, record) { | 62 editItem: function(grid, record) { |
54 console.log('Editing Kommentar'); | 63 console.log('Editing Kommentar'); |
55 record.getAuthInfo(this.initEditWindow) | 64 record.getAuthInfo(this.initEditWindow) |
56 console.log("Loaded Kommentar with ID " + record.getId()); //outputs ID | 65 console.log("Loaded Kommentar with ID " + record.getId()); //outputs ID |
57 }, | 66 }, |
67 | |
58 initEditWindow: function(record, readonly, owner) { | 68 initEditWindow: function(record, readonly, owner) { |
59 var view = Ext.widget('kommentarecreate', {model: record}); | 69 var view = Ext.widget('kommentarecreate', { |
70 model: record | |
71 }); | |
60 var ignore = Array(); | 72 var ignore = Array(); |
61 if (readonly) { | 73 if (readonly) { |
62 var form = view.down('form'); | 74 var form = view.down('form'); |
63 form.setReadOnly(true, ignore); | 75 form.setReadOnly(true, ignore); |
64 } | 76 } |
65 }, | 77 }, |
78 | |
66 createSuccess: function(form, record, operation) { | 79 createSuccess: function(form, record, operation) { |
67 var store = this.getKommentarePStore(); | 80 var store = this.getKommentarePStore(); |
68 store.reload(); | 81 store.reload(); |
69 var win = form.up('window'); | 82 var win = form.up('window'); |
70 win.close(); | 83 win.close(); |