comparison app/controller/grid/Datensatzerzeuger.js @ 1003:15d8c64049d1 stammdatengrids

Datensatzerzeuger now uses the server. Added i18n to confirmation messages
author Dustin Demuth <dustin@intevation.de>
date Fri, 15 Jan 2016 14:42:29 +0100
parents b21421ba6917
children 77e22ad5cc84
comparison
equal deleted inserted replaced
999:f73ca04d73a7 1003:15d8c64049d1
38 * the record. 38 * the record.
39 * On success it refreshes the windows which contains the grid 39 * On success it refreshes the windows which contains the grid
40 * On failure it displays a message 40 * On failure it displays a message
41 */ 41 */
42 gridSave: function(editor, context) { 42 gridSave: function(editor, context) {
43 context.record.set('datum', new Date()); 43 var i18n = Lada.getApplication().bundle;
44 context.record.save({ 44 context.record.save({
45 success: function(record, response) { 45 success: function(record, response) {
46 //Do Nothing 46 //Do Nothing
47 }, 47 },
48 failure: function(record, response) { 48 failure: function(record, response) {
49 var json = response.request.scope.reader.jsonData; 49 var json = response.request.scope.reader.jsonData;
50 if (json) { 50 if (json) {
51 if (json.message){ 51 if (json.message){
52 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title') 52 Ext.Msg.alert(i18n.getMsg('err.msg.save.title')
53 +' #'+json.message, 53 +' #'+json.message,
54 Lada.getApplication().bundle.getMsg(json.message)); 54 i18n.getMsg(json.message));
55 } else { 55 } else {
56 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), 56 Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
57 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); 57 i18n.getMsg('err.msg.generic.body'));
58 } 58 }
59 } 59 }
60 } 60 }
61 }); 61 });
62 }, 62 },
89 * on failure, an error message is shown. 89 * on failure, an error message is shown.
90 */ 90 */
91 remove: function(button) { 91 remove: function(button) {
92 var grid = button.up('grid'); 92 var grid = button.up('grid');
93 var selection = grid.getView().getSelectionModel().getSelection()[0]; 93 var selection = grid.getView().getSelectionModel().getSelection()[0];
94 var i18n = Lada.getApplication().bundle;
94 //TODO: i18n 95 //TODO: i18n
95 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) { 96 Ext.MessageBox.confirm(i18n.getMsg('delete'),
97 i18n.getMsg('confirmation.question'),
98 function(btn) {
96 if (btn === 'yes') { 99 if (btn === 'yes') {
97 selection.destroy({ 100 selection.destroy({
98 success: function() { 101 success: function() {
99 //DO NOTHING 102 //DO NOTHING
100 }, 103 },
101 failure: function(request, response) { 104 failure: function(request, response) {
102 var json = response.request.scope.reader.jsonData; 105 var json = response.request.scope.reader.jsonData;
103 if (json) { 106 if (json) {
104 if (json.message){ 107 if (json.message){
105 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title') 108 Ext.Msg.alert(i18n.getMsg('err.msg.delete.title')
106 +' #'+json.message, 109 +' #'+json.message,
107 Lada.getApplication().bundle.getMsg(json.message)); 110 i18n.getMsg(json.message));
108 } else { 111 } else {
109 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), 112 Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
110 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); 113 i18n.getMsg('err.msg.generic.body'));
111 } 114 }
112 } else { 115 } else {
113 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), 116 Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
114 Lada.getApplication().bundle.getMsg('err.msg.response.body')); 117 i18n.getMsg('err.msg.response.body'));
115 } 118 }
116 } 119 }
117 }); 120 });
118 } 121 }
119 }); 122 });

http://lada.wald.intevation.org