annotate app/controller/grid/Ort.js @ 587:cf328526b5bb

Moved controller into subfolders.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 11 Mar 2015 13:39:04 +0100
parents
children e1ab24758392
rev   line source
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 Ext.define('Lada.controller.grid.Ort', {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 extend: 'Ext.app.Controller',
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 init: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 this.control({
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 'ortgrid': {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 selectionchange: this.selectionChanged,
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 edit: this.gridSave
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 'ortgrid button[action=open]': {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 click: this.open
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 'ortgrid button[action=add]': {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 click: this.add
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 'ortgrid button[action=delete]': {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 click: this.remove
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 selectionChanged: function(grid, record) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 if (record) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 grid.view.panel.down('button[action=open]').enable();
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 gridSave: function(editor, context) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 context.record.save({
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 success: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 context.grid.store.reload();
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 context.grid.up('window').initData();
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 failure: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 // TODO
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 open: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 // todo
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 console.log('open');
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 add: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 // todo
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 console.log('add');
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 remove: function(button) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 var grid = button.up('grid');
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 var selection = grid.getView().getSelectionModel().getSelection()[0];
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 Ext.MessageBox.confirm('Ortsangabe löschen', 'Sind Sie sicher?', function(btn) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 if (btn === 'yes') {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 selection.destroy({
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 success: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 button.up('window').initData();
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 failure: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 });

http://lada.wald.intevation.org