]> git.proxmox.com Git - pmg-gui.git/commitdiff
attachment grid: move all-parts controls to tbar, transform back to collapsible title
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 11 Nov 2022 17:37:26 +0000 (18:37 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 11 Nov 2022 17:41:08 +0000 (18:41 +0100)
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 <t.lamprecht@proxmox.com>
js/AttachmentGrid.js

index ff87e313b37cd09713d32c8f1c8ab4aeb3abe0e8..3381bc198bd89ff3db719adc6d1e90d26e019913 100644 (file)
@@ -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);
     },