comparison app/controller/grid/Probenehmer.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 var i18n = Lada.getApplication().bundle;
43 context.record.save({ 44 context.record.save({
44 success: function(record, response) { 45 success: function(record, response) {
45 //Do Nothing 46 //Do Nothing
46 }, 47 },
47 failure: function(record, response) { 48 failure: function(record, response) {
48 var json = response.request.scope.reader.jsonData; 49 var json = response.request.scope.reader.jsonData;
49 if (json) { 50 if (json) {
50 if (json.message){ 51 if (json.message){
51 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title') 52 Ext.Msg.alert(i18n.getMsg('err.msg.save.title')
52 +' #'+json.message, 53 +' #'+json.message,
53 Lada.getApplication().bundle.getMsg(json.message)); 54 i18n.getMsg(json.message));
54 } else { 55 } else {
55 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), 56 Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
56 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); 57 i18n.getMsg('err.msg.generic.body'));
57 } 58 }
58 } 59 }
59 } 60 }
60 }); 61 });
61 }, 62 },
88 * on failure, an error message is shown. 89 * on failure, an error message is shown.
89 */ 90 */
90 remove: function(button) { 91 remove: function(button) {
91 var grid = button.up('grid'); 92 var grid = button.up('grid');
92 var selection = grid.getView().getSelectionModel().getSelection()[0]; 93 var selection = grid.getView().getSelectionModel().getSelection()[0];
93 //TODO: i18n 94 var i18n = Lada.getApplication().bundle;
94 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) { 95 Ext.MessageBox.confirm(i18n.getMsg('delete'),
96 i18n.getMsg('confirmation.question'),
97 function(btn) {
95 if (btn === 'yes') { 98 if (btn === 'yes') {
96 selection.destroy({ 99 selection.destroy({
97 success: function() { 100 success: function() {
98 //DO NOTHING 101 //DO NOTHING
99 }, 102 },
100 failure: function(request, response) { 103 failure: function(request, response) {
101 var json = response.request.scope.reader.jsonData; 104 var json = response.request.scope.reader.jsonData;
102 if (json) { 105 if (json) {
103 if (json.message){ 106 if (json.message){
104 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title') 107 Ext.Msg.alert(i18n.getMsg('err.msg.delete.title')
105 +' #'+json.message, 108 +' #'+json.message,
106 Lada.getApplication().bundle.getMsg(json.message)); 109 i18n.getMsg(json.message));
107 } else { 110 } else {
108 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), 111 Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
109 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); 112 i18n.getMsg('err.msg.generic.body'));
110 } 113 }
111 } else { 114 } else {
112 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), 115 Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
113 Lada.getApplication().bundle.getMsg('err.msg.response.body')); 116 i18n.getMsg('err.msg.response.body'));
114 } 117 }
115 } 118 }
116 }); 119 });
117 } 120 }
118 }); 121 });

http://lada.wald.intevation.org