[Lada-commits] [PATCH 1 of 2] Reduce code duplication
Wald Commits
scm-commit at wald.intevation.org
Wed Mar 22 16:21:13 CET 2017
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1490195531 -3600
# Node ID 2195fd3946e4ef2a168955aeea66c0ba19d7489d
# Parent d1f6aa80758f369f47a1539a190614b2efbfe00f
Reduce code duplication.
diff -r d1f6aa80758f -r 2195fd3946e4 app/view/window/AuditTrail.js
--- a/app/view/window/AuditTrail.js Wed Mar 22 15:01:35 2017 +0100
+++ b/app/view/window/AuditTrail.js Wed Mar 22 16:12:11 2017 +0100
@@ -118,25 +118,7 @@
audit[i].identifier.identifier;
}
- if (audit[i].action === 'I') {
- html += '<br>angelegt<br><div style="margin-left:2em;">'
- }
- else {
- html += '<br>geändert in<br><div style="margin-left:2em;">'
- }
- for (var key in audit[i].changedFields) {
- var value = '';
- if (Ext.Array.contains(this.dateItems, key)) {
- value = Ext.Date.format(new Date(audit[i].changedFields[key]), 'd.m.Y H:i');
- }
- else {
- value = audit[i].changedFields[key];
- }
- html += '' + i18n.getMsg(key) + ': ' +
- value + '<br>';
- }
- html += '</div>';
- html += '</p>';
+ html += this.createHtmlChangedFields(audit[i]);
}
}
return html;
@@ -157,27 +139,31 @@
html += '<br>' + i18n.getMsg(audit[i].type) + ': ';
html += audit[i].identifier;
}
- if (audit[i].action === 'I') {
- html += '<br>angelegt<br><div style="margin-left:2em;">'
- }
- else {
- html += '<br>geändert in<br><div style="margin-left:2em;">'
- }
- for (var key in audit[i].changedFields) {
- var value = '';
- if (Ext.Array.contains(this.dateItems, key)) {
- value = Ext.Date.format(new Date(audit[i].changedFields[key]), 'd.m.Y H:i');
- }
- else {
- value = audit[i].changedFields[key];
- }
- html += '' + i18n.getMsg(key) + ': ' +
- value + '<br>';
- }
- html += '</div>';
- html += '</p>';
+ html += this.createHtmlChangedFields(audit[i]);
}
}
return html;
+ },
+
+ createHtmlChangedFields: function(audit) {
+ var i18n = Lada.getApplication().bundle;
+ html = '<br>' + i18n.getMsg(audit.action)
+ + '<br><div style="margin-left:2em;">';
+
+ for (var key in audit.changedFields) {
+ var value = '';
+ if (Ext.Array.contains(this.dateItems, key)) {
+ value = Ext.Date.format(new Date(audit.changedFields[key]),
+ 'd.m.Y H:i');
+ }
+ else {
+ value = audit.changedFields[key];
+ }
+ html += '' + i18n.getMsg(key) + ': ' +
+ value + '<br>';
+ }
+ html += '</div>';
+ html += '</p>';
+ return html;
}
});
diff -r d1f6aa80758f -r 2195fd3946e4 resources/i18n/Lada_de-DE.properties
--- a/resources/i18n/Lada_de-DE.properties Wed Mar 22 15:01:35 2017 +0100
+++ b/resources/i18n/Lada_de-DE.properties Wed Mar 22 16:12:11 2017 +0100
@@ -413,3 +413,5 @@
datenbasis_id: Datenbasis
probeentnahme_beginn:Probenentnahme(Beginn)
probeentnahme_ende:Probenentnahme(Ende)
+I:angelegt
+U:geändert in
More information about the Lada-commits
mailing list