Mercurial > lada > lada-client
changeset 1407:2195fd3946e4
Reduce code duplication.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 22 Mar 2017 16:12:11 +0100 (2017-03-22) |
parents | d1f6aa80758f |
children | 86c6b6c01246 |
files | app/view/window/AuditTrail.js resources/i18n/Lada_de-DE.properties |
diffstat | 2 files changed, 26 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- 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; } });
--- 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