mirror of
https://github.com/mjl-/mox.git
synced 2025-01-14 01:06:27 +03:00
webmail: with 6 or more attachments, show the first 4, and a button to show the rest.
for issue #113
This commit is contained in:
parent
9529ae0bd4
commit
41a62de4d7
2 changed files with 53 additions and 40 deletions
|
@ -3643,7 +3643,9 @@ const newMsgView = (miv, msglistView, listMailboxes, possibleLabels, messageLoad
|
|||
popupRoot.focus();
|
||||
attachmentView = { key: keyHandler(attachShortcuts) };
|
||||
};
|
||||
dom._kids(msgattachmentElem, (mi.Attachments && mi.Attachments.length === 0) ? [] : dom.div(style({ borderTop: '1px solid #ccc' }), dom.div(dom._class('pad'), 'Attachments: ', (mi.Attachments || []).map(a => {
|
||||
const renderAttachments = (all) => {
|
||||
const l = mi.Attachments || [];
|
||||
dom._kids(msgattachmentElem, (l && l.length === 0) ? [] : dom.div(style({ borderTop: '1px solid #ccc' }), dom.div(dom._class('pad'), 'Attachments: ', l.slice(0, all ? l.length : 4).map(a => {
|
||||
const name = a.Filename || '(unnamed)';
|
||||
const viewable = isViewable(a);
|
||||
const size = formatSize(a.Part.DecodedSize);
|
||||
|
@ -3658,7 +3660,11 @@ const newMsgView = (miv, msglistView, listMailboxes, possibleLabels, messageLoad
|
|||
return [dom.span(dom._class('btngroup'), viewbtn, dlbtn), ' '];
|
||||
}
|
||||
return [dom.span(dom._class('btngroup'), dlbtn, viewbtn), ' '];
|
||||
}), dom.a('Download all as zip', attr.download(''), style({ color: 'inherit' }), attr.href('msg/' + m.ID + '/attachments.zip')))));
|
||||
}), all || l.length < 6 ? [] : dom.clickbutton('More...', function click() {
|
||||
renderAttachments(true);
|
||||
}), ' ', dom.a('Download all as zip', attr.download(''), style({ color: 'inherit' }), attr.href('msg/' + m.ID + '/attachments.zip')))));
|
||||
};
|
||||
renderAttachments(false);
|
||||
const root = dom.div(style({ position: 'absolute', top: 0, right: 0, bottom: 0, left: 0, display: 'flex', flexDirection: 'column' }));
|
||||
dom._kids(root, msgmetaElem, msgcontentElem);
|
||||
const loadText = (pm) => {
|
||||
|
|
|
@ -3215,12 +3215,14 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
|||
attachmentView = {key: keyHandler(attachShortcuts)}
|
||||
}
|
||||
|
||||
const renderAttachments = (all: boolean) => {
|
||||
const l = mi.Attachments || []
|
||||
dom._kids(msgattachmentElem,
|
||||
(mi.Attachments && mi.Attachments.length === 0) ? [] : dom.div(
|
||||
(l && l.length === 0) ? [] : dom.div(
|
||||
style({borderTop: '1px solid #ccc'}),
|
||||
dom.div(dom._class('pad'),
|
||||
'Attachments: ',
|
||||
(mi.Attachments || []).map(a => {
|
||||
l.slice(0, all ? l.length : 4).map(a => {
|
||||
const name = a.Filename || '(unnamed)'
|
||||
const viewable = isViewable(a)
|
||||
const size = formatSize(a.Part.DecodedSize)
|
||||
|
@ -3236,10 +3238,15 @@ const newMsgView = (miv: MsgitemView, msglistView: MsglistView, listMailboxes: l
|
|||
}
|
||||
return [dom.span(dom._class('btngroup'), dlbtn, viewbtn), ' ']
|
||||
}),
|
||||
all || l.length < 6 ? [] : dom.clickbutton('More...', function click() {
|
||||
renderAttachments(true)
|
||||
}), ' ',
|
||||
dom.a('Download all as zip', attr.download(''), style({color: 'inherit'}), attr.href('msg/'+m.ID+'/attachments.zip')),
|
||||
),
|
||||
)
|
||||
)
|
||||
}
|
||||
renderAttachments(false)
|
||||
|
||||
const root = dom.div(style({position: 'absolute', top: 0, right: 0, bottom: 0, left: 0, display: 'flex', flexDirection: 'column'}))
|
||||
dom._kids(root, msgmetaElem, msgcontentElem)
|
||||
|
|
Loading…
Reference in a new issue