Mercurial > lada > lada-client
comparison app/view/window/ImportResponse.js @ 1425:68e579063a47
Improve readability.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 06 Apr 2017 12:17:59 +0200 |
parents | ee21d0e1b998 |
children | 4de04242f7ce |
comparison
equal
deleted
inserted
replaced
1424:44d28e46cc4b | 1425:68e579063a47 |
---|---|
118 /** | 118 /** |
119 * Parse the Response | 119 * Parse the Response |
120 * @param data the payload of the response | 120 * @param data the payload of the response |
121 */ | 121 */ |
122 parseResponse: function(data) { | 122 parseResponse: function(data) { |
123 var i18n = Lada.getApplication().bundle; | |
123 var errors = data.data.errors; | 124 var errors = data.data.errors; |
124 var warnings = data.data.warnings; | 125 var warnings = data.data.warnings; |
125 var out = []; | 126 var out = []; |
126 // There is a entry for each imported proben in the errors dict (might be | 127 // There is a entry for each imported proben in the errors dict (might be |
127 // empty) | 128 // empty) |
163 validation.push('Validierungsfehler: '); | 164 validation.push('Validierungsfehler: '); |
164 for (var i = msgs.length - 1; i >= 0; i--) { | 165 for (var i = msgs.length - 1; i >= 0; i--) { |
165 if (msgs[i].key === 'validation') { | 166 if (msgs[i].key === 'validation') { |
166 validation.push('<ol>'); | 167 validation.push('<ol>'); |
167 var parts = msgs[i].value.split('#'); | 168 var parts = msgs[i].value.split('#'); |
168 var str = Lada.getApplication().bundle.getMsg(parts[0]) + | 169 var str = i18n.getMsg(parts[0]) + |
169 parts[1] === undefined ? '' : parts[1]; | 170 parts[1] === undefined ? '' : parts[1]; |
170 validation.push(str + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString()) + ')'); | 171 validation.push(str + ' (' |
172 + i18n.getMsg(msgs[i].code.toString()) + ')'); | |
171 validation.push('</ol>'); | 173 validation.push('</ol>'); |
172 } | 174 } |
173 else { | 175 else { |
174 out.push('<li>' + msgs[i].key + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString())+'): '+msgs[i].value+'</li>') | 176 out.push('<li>' + msgs[i].key + ' (' |
177 + i18n.getMsg(msgs[i].code.toString()) | |
178 + '): ' + msgs[i].value + '</li>') | |
175 } | 179 } |
176 } | 180 } |
177 if (validation.length > 1) { | 181 if (validation.length > 1) { |
178 out.push('<li>') | 182 out.push('<li>') |
179 out.push(validation.join('')); | 183 out.push(validation.join('')); |
200 validation.push('Validierungswarnungen: '); | 204 validation.push('Validierungswarnungen: '); |
201 for (var i = msgs.length - 1; i >= 0; i--) { | 205 for (var i = msgs.length - 1; i >= 0; i--) { |
202 if (msgs[i].key === 'validation') { | 206 if (msgs[i].key === 'validation') { |
203 validation.push('<ol>'); | 207 validation.push('<ol>'); |
204 var parts = msgs[i].value.split('#'); | 208 var parts = msgs[i].value.split('#'); |
205 var str = Lada.getApplication().bundle.getMsg(parts[0]) + | 209 var str = i18n.getMsg(parts[0]) + |
206 parts[1] === undefined ? '' : parts[1]; | 210 parts[1] === undefined ? '' : parts[1]; |
207 validation.push(str + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString()) + ')'); | 211 validation.push(str + ' (' |
212 + i18n.getMsg(msgs[i].code.toString()) + ')'); | |
208 validation.push('</ol>'); | 213 validation.push('</ol>'); |
209 } | 214 } |
210 else { | 215 else { |
211 out.push('<li>' + msgs[i].key + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString())+'): '+msgs[i].value+'</li>') | 216 out.push('<li>' + msgs[i].key + ' (' |
217 + i18n.getMsg(msgs[i].code.toString()) | |
218 + '): ' + msgs[i].value + '</li>') | |
212 } | 219 } |
213 } | 220 } |
214 if (validation.length > 1) { | 221 if (validation.length > 1) { |
215 out.push('<li>') | 222 out.push('<li>') |
216 out.push(validation.join('')); | 223 out.push(validation.join('')); |