# HG changeset patch # User Tom Gottfried # 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 += '
angelegt
' - } - else { - html += '
geändert in
' - } - 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 + '
'; - } - html += '
'; - html += '

'; + html += this.createHtmlChangedFields(audit[i]); } } return html; @@ -157,27 +139,31 @@ html += '
' + i18n.getMsg(audit[i].type) + ': '; html += audit[i].identifier; } - if (audit[i].action === 'I') { - html += '
angelegt
' - } - else { - html += '
geändert in
' - } - 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 + '
'; - } - html += '
'; - html += '

'; + html += this.createHtmlChangedFields(audit[i]); } } return html; + }, + + createHtmlChangedFields: function(audit) { + var i18n = Lada.getApplication().bundle; + html = '
' + i18n.getMsg(audit.action) + + '
'; + + 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 + '
'; + } + html += '
'; + html += '

'; + 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