From 57be3ef3550ec0cb60101d73663607a3212759a8 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 11 Nov 2022 18:37:26 +0100 Subject: [PATCH] attachment grid: move all-parts controls to tbar, transform back to collapsible title just better ergonomics and I don't think a lot of people will care about the parts list, especially if the raw email is already visible anyway. Also note that while yes, the content-disposition is user controllable, most (all?) MUAs only show it if set so even spammers/attackers have it in their interest to set it. Signed-off-by: Thomas Lamprecht --- js/AttachmentGrid.js | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/js/AttachmentGrid.js b/js/AttachmentGrid.js index ff87e31..3381bc1 100644 --- a/js/AttachmentGrid.js +++ b/js/AttachmentGrid.js @@ -11,17 +11,19 @@ Ext.define('PMG.grid.AttachmentGrid', { minHeight: 50, maxHeight: 250, scrollable: true, - collapsed: true, - tools: [ + collapsible: true, + titleCollapse: true, + + tbar: [ + '->', { xtype: 'checkbox', boxLabel: gettext('show all parts'), boxLabelAlgign: 'before', listeners: { - change: function(cb, value) { - let grid = this.up('pmgAttachmentGrid'); - let store = grid.getStore(); + change: function(checkBox, value) { + let store = this.up('pmgAttachmentGrid').getStore(); store.clearFilter(); if (!value) { store.filter({ @@ -32,21 +34,8 @@ Ext.define('PMG.grid.AttachmentGrid', { }, }, }, - { - type: 'down', - handler: function() { - let me = this; - let type = me.type === 'up' ? 'down' : 'up'; - me.up('pmgAttachmentGrid').toggleCollapse(); - me.setType(type); - }, - }, ], - header: { - padding: '6 10 6 10', // make same height as normal panel - }, - store: { autoDestroy: true, fields: ['name', 'content-type', 'size', 'content-disposition'], @@ -83,10 +72,14 @@ Ext.define('PMG.grid.AttachmentGrid', { if (count > 0) { title = Ext.String.format(gettext('{0} Attachments'), count); title += ` (${Proxmox.Utils.format_size(totalSize)})`; - me.expand(); + if (me.collapsible) { + me.expand(); + } } else { title = gettext('No Attachments'); - me.collapse(); + if (me.collapsible) { + me.collapse(); + } } me.setTitle(title); }, -- 2.39.2