mirror of
https://git.proxmox.com/git/pmg-gui
synced 2025-08-13 14:56:30 +00:00
add render_filetype
this will be used to show the icon in the attachment list Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com> Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
parent
572198b7e6
commit
19b455dd5c
32
js/Utils.js
32
js/Utils.js
@ -747,6 +747,38 @@ Ext.define('PMG.Utils', {
|
||||
/*jslint confusion: false*/
|
||||
},
|
||||
|
||||
render_filetype: function(value) {
|
||||
let iconCls = 'fa-file-o';
|
||||
let text = Proxmox.Utils.unknownText;
|
||||
|
||||
if (!value) {
|
||||
return `<i class='fa ${iconCls}'></i> ${text}`;
|
||||
}
|
||||
|
||||
text = value.toString().toLowerCase();
|
||||
let type = text.split('/')[0];
|
||||
|
||||
switch (type) {
|
||||
case 'audio':
|
||||
case 'image':
|
||||
case 'video':
|
||||
case 'text':
|
||||
iconCls = `fa-file-${type}-o`;
|
||||
break;
|
||||
case 'application':
|
||||
let subtypes = ['excel', 'pdf', 'word', 'powerpoint'];
|
||||
let found = subtypes.find(st => text.includes(st));
|
||||
if (found !== undefined) {
|
||||
iconCls = `fa-file-${found}-o`;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return `<i class='fa ${iconCls}'></i> ${text}`;
|
||||
},
|
||||
|
||||
sender_renderer: function(value, metaData, rec) {
|
||||
var subject = Ext.htmlEncode(value);
|
||||
var from = Ext.htmlEncode(rec.data.from);
|
||||
|
Loading…
Reference in New Issue
Block a user