pmg-gui/js/MailInfo.js
Dominik Csapak 60652b756a fix MailInfo update without data
e.g. when the user changes the email while having a mail selected,
it gets unselected (albeit briefly) and update will be called
with 'undefined'

this throws an error, so prevent this by always supplying an object

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-04-16 14:44:58 +02:00

35 lines
720 B
JavaScript

Ext.define('PMG.MailInfoBox', {
extend: 'Ext.container.Container',
xtype: 'pmgMailInfo',
cls: 'x-toolbar-default',
style: {
'border-left': '0px',
'border-right': '0px',
},
update: function(data) {
let me = this;
let escaped = {};
for (const [key, value] of Object.entries(data || {})) {
escaped[key] = Ext.util.Format.ellipsis(Ext.htmlEncode(value), 103);
}
me.items.each((item) => item.update(escaped));
},
layout: {
type: 'vbox',
align: 'stretch',
},
defaults: {
xtype: 'tbtext',
margin: '2 2 0 0 ',
},
items: [
{ tpl: `<b class="bold">${gettext("From")}:</b> {from}` },
{ tpl: `<b class="bold">${gettext("Subject")}:</b> {subject}` },
],
});