diff --git a/e2e/web/tests/issue.spec.mjs b/e2e/web/tests/issue.spec.mjs index 93f118e3..39f509e6 100644 --- a/e2e/web/tests/issue.spec.mjs +++ b/e2e/web/tests/issue.spec.mjs @@ -107,6 +107,29 @@ test('< widens the panel, and it stays', async ({ page }) => { expect(Math.abs(await width() - w1)).toBeLessThan(2); }); +test('alt+i lists the attachments with who added them, and it stays', async ({ page, app }) => { + const png = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==', 'base64'); + for (const [name, mimeType, buffer] of [['shot.png', 'image/png', png], ['export.csv', 'text/csv', Buffer.from('a,b\n')]]) { + const res = await page.request.post(app.url + '/api/issues/DEMO-4/attachments', { multipart: { file: { name, mimeType, buffer } } }); + expect(res.ok()).toBeTruthy(); + } + await page.reload(); + const files = panel(page).locator('.sec-head', { hasText: 'Attachments' }).locator('..'); + await expect(files.locator('.thumb', { hasText: 'shot.png' })).toBeVisible(); + await expect(files.locator('.row-link', { hasText: 'export.csv' })).toContainText('Jamie Rivers'); + await panel(page).click({ position: { x: 5, y: 5 } }); + await page.keyboard.press('Alt+i'); + await expect(files.locator('.thumb')).toHaveCount(0); + const row = files.locator('.row-link.file', { hasText: 'shot.png' }); + await expect(row).toContainText('Jamie Rivers'); + await expect(row.locator('time')).toBeVisible(); + await page.reload(); + await expect(files.locator('.row-link.file', { hasText: 'shot.png' })).toBeVisible(); + await expect(files.locator('.thumb')).toHaveCount(0); + await files.getByRole('button', { name: 'Show as thumbnails' }).click(); + await expect(files.locator('.thumb', { hasText: 'shot.png' })).toBeVisible(); +}); + // laneway-server's change stream (the demo has none: this stands in for it): someone else's comment // shows in the open issue without a reload. test.describe('on laneway-server', () => { diff --git a/internal/i18n/nl/web-board-issue.json b/internal/i18n/nl/web-board-issue.json index c6f79138..1ab0e5be 100644 --- a/internal/i18n/nl/web-board-issue.json +++ b/internal/i18n/nl/web-board-issue.json @@ -818,5 +818,8 @@ "mute": "dempen", "full screen": "volledig scherm", "Picture-in-picture (p)": "Beeld-in-beeld (p)", - "picture-in-picture": "beeld-in-beeld" + "picture-in-picture": "beeld-in-beeld", + "Show as list": "Als lijst tonen", + "Show as thumbnails": "Als miniaturen tonen", + "attachments as list or thumbnails": "bijlagen als lijst of miniaturen" } diff --git a/internal/jira/attachment.go b/internal/jira/attachment.go index bfeb36b0..05e83d3a 100644 --- a/internal/jira/attachment.go +++ b/internal/jira/attachment.go @@ -26,6 +26,9 @@ type Attachment struct { Filename string MimeType string Size int64 + // Author is who uploaded it; Created when. Both are zero when Jira leaves them out. + Author string + Created time.Time } // IsImage reports whether the attachment is a picture the panel can draw. @@ -38,6 +41,20 @@ type apiAttachment struct { Filename string `json:"filename"` MimeType string `json:"mimeType"` Size int64 `json:"size"` + Author *user `json:"author"` + Created string `json:"created"` +} + +// attachment is the file as the panels show it. +func (a apiAttachment) attachment() Attachment { + at := Attachment{ID: a.ID, Filename: safeterm.Line(a.Filename), MimeType: a.MimeType, Size: a.Size} + if a.Author != nil { + at.Author = safeterm.Line(a.Author.DisplayName) + } + if t, err := time.Parse("2006-01-02T15:04:05.999-0700", a.Created); err == nil { + at.Created = t + } + return at } // mediaRef is the placeholder target adfToMarkdown writes for a media node; @@ -337,7 +354,7 @@ func (c *Client) issueMedia(ctx context.Context, a apiIssue) (files map[string]s } atts := make([]Attachment, len(a.Fields.Attachment)) for i, at := range a.Fields.Attachment { - atts[i] = Attachment{ID: at.ID, Filename: safeterm.Line(at.Filename), MimeType: at.MimeType, Size: at.Size} + atts[i] = at.attachment() } media = c.mediaFiles(ctx, atts) if inline { diff --git a/internal/jira/attachment_test.go b/internal/jira/attachment_test.go index 6c6cdffe..c3a3e31c 100644 --- a/internal/jira/attachment_test.go +++ b/internal/jira/attachment_test.go @@ -8,6 +8,7 @@ import ( "path/filepath" "strings" "testing" + "time" ) func TestIssueResolvesMedia(t *testing.T) { @@ -40,6 +41,31 @@ func TestIssueResolvesMedia(t *testing.T) { } } +func TestIssueAttachmentUploader(t *testing.T) { + body := `{"key":"ABC-1","fields":{"summary":"s","attachment":[ + {"id":"10","filename":"shot.png","mimeType":"image/png","size":5, + "author":{"accountId":"a1","displayName":"Ann Lee"},"created":"2026-11-03T09:15:00.000+0100"}, + {"id":"11","filename":"old.pdf","mimeType":"application/pdf","size":7}]}}` + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + _, _ = w.Write([]byte(body)) + })) + defer srv.Close() + iss, err := New(Config{BaseURL: srv.URL, Email: "e", APIToken: "t"}).Get(context.Background(), "ABC-1") + if err != nil { + t.Fatal(err) + } + if len(iss.Attachments) != 2 { + t.Fatalf("attachments = %+v", iss.Attachments) + } + a := iss.Attachments[0] + if a.Author != "Ann Lee" || a.Created.UTC().Format(time.RFC3339) != "2026-11-03T08:15:00Z" { + t.Errorf("first = %+v, want Ann Lee at 2026-11-03T08:15:00Z", a) + } + if b := iss.Attachments[1]; b.Author != "" || !b.Created.IsZero() { + t.Errorf("without author or date = %+v, want both zero", b) + } +} + func TestAttachmentContent(t *testing.T) { var gotPath, gotAuth string srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/internal/jira/jira.go b/internal/jira/jira.go index d21afceb..aab69c06 100644 --- a/internal/jira/jira.go +++ b/internal/jira/jira.go @@ -887,7 +887,7 @@ func (c *Client) toIssue(a apiIssue, files map[string]string, media map[string]A iss.Labels = append(iss.Labels, safeterm.Line(l)) } for _, at := range a.Fields.Attachment { - iss.Attachments = append(iss.Attachments, Attachment{ID: at.ID, Filename: safeterm.Line(at.Filename), MimeType: at.MimeType, Size: at.Size}) + iss.Attachments = append(iss.Attachments, at.attachment()) } iss.Description = resolveMedia(iss.Description, iss.Attachments, media) iss.Links = issueLinks(a.Fields.Parent, a.Fields.IssueLinks, a.Fields.Subtasks) diff --git a/internal/web/README.md b/internal/web/README.md index 20de4499..1d8980af 100644 --- a/internal/web/README.md +++ b/internal/web/README.md @@ -54,7 +54,7 @@ Scopes stack: global < view < panel (beside a board the panel's keys fire only w | Picker | type to filter, `↑↓`/`ctrl+n` `ctrl+p` move, `enter` picks, `esc`; one that takes several (labels, list columns, assignee filter): `space` (nothing typed), `tab` (clears what was typed; typed text matching nothing becomes a new label) or a click ticks, `enter` or Apply takes them | | Go | `g h` home, `g p` planning, `g r` reports, `g m` roadmap, `g w` my work, `g i` inbox, `g s` standup, `g a` agents, `g ,` settings, `g t` next theme, `g l` rules, `@` switch or add a Jira site (also with one site; the last row asks what `laneway setup` does, `POST /api/sites`, and the server starts again on it), `ctrl+a` ask the LLM about the issue (Edit as comment puts the answer in its comment composer, as the TUI; nothing posts until you do), your `ui.actions` keys | | Board | `hjkl`/arrows move, `enter` open, `t` lanes/list, `s` status, `e` summary, `a` assign, `p` priority, `P` points, `H`/`L` move column (several statuses: pick one; a move the workflow wants fields for opens its form; `u` undoes; dragging splits such a lane into one drop zone per status, unreachable ones dimmed), `J`/`K` rank, `M` to a sprint or the backlog (marked cards, else the selected; `.` repeats it, `u` undoes), `E` quick edit (the card menu at the card; a right-click opens it at the pointer: current values, submenus for status, assignee, priority and sprint (the board's open sprints and the backlog), points, labels, pin, open in a new tab; `↑↓` `enter`/`→` `←`/`esc`; a long press on a phone keeps the sheet), `x` mark (`ctrl+click` too, the opened card with it; `shift+click` marks the run within the lane or list), `X` bulk, `o` Jira, `y` copy key, `r` refresh, `O` swimlanes (lanes) / sort (list; by assignee, priority, epic or status it heads each group with its count and points; a drop into another swimlane gives the card its assignee or epic, `u` undoes), `z`/`Z` fold/unfold swimlane, `c` compact (one-line) cards, `alt+e` hide/show empty lanes, `alt+l` next lane layout (`ui.lane_layouts`, arranged server-side by internal/lanes; stacked columns get a header over their first card), `C` list columns (drag a header onto another to move its column, its right edge to resize it, a double-click on the edge resets it; pref `board.colw`), `V` releases (the report), `F` filter builder (as the TUI's: `↑↓` pick, `→`/`tab` and `←`/`shift+tab` column, `enter` deeper then add, `ctrl+x` drop last term, `esc`), `*` pin, `.` repeat, `alt+j`/`alt+k` rank bottom/top, `ctrl+a` mark all, `ctrl+y` copy branch, `Y` copy link, `alt+t` time machine (`←` `→` `esc`), `alt+o` closed sprints, `B` board, `alt+p` project, `v` view, `[`/`]` previous/next view (sprints, backlog, `ui.views`, starred filters), `f` filter, `m` mine, `A` assignee (the project's assignable people; `space` (nothing typed), `tab` (clears what was typed) or a click ticks several, `enter` or Apply takes them, `enter` without a tick takes the row; `m` stays one toggle), `0` clear, `1`-`9` quick filters; the bar lists Mine, Assignee, then the quick filters (`ui.quick_filters` first); `is:notes` in `f` finds cards with private notes | -| Issue panel | A link to an issue on this site (descriptions, comments, notes, inbox, merge requests) draws as a pill, status, key, summary and assignee (`lib/issuepill.js`, `GET /api/issues/{key}/card`), and opens it here (a link with its own text keeps it); Details lists the edit screen's other fields (components, custom fields) after its own, a click edits one: the pinned ones (the pin on hover, the site's every project, shared with the TUI; its own fields pinned till unpinned; `PUT /api/fields/pinned/{id}`, `jira.FieldPins`), the rest under More (remembered open), `ui.empty_fields: hide` folds their empty ones; a filled rich-text field is a section under the description, edited like it (`GET`/`PUT /api/issues/{key}/doc/{field}`); a closed issue's fields come read-only from the screen last seen for its project and type (`jira/layout.go`); that screen also comes with the issue (`Issue.Screen`, its fields asked along), so the fields draw at once and editmeta changes nothing in place; `j`/`k` comment or scroll, `c` comment (`ctrl+o` in it: who sees it, everyone, an internal note or a project role), `R` reply, `e` summary (own focused comment), `E` description, `a` `p` `P` `l` assignee, priority, points, labels (Jira's complete as you type), `s` status, `L` link issue, `A` actions (subtask, link, each agent of the issue: type into, prompt, stop, a new agent in its directory; on a done issue remove its worktree once merged and clean; draft pull request when `jira.repos` has the project; clone (opens the create form filled in; creating links it), type, move, original estimate, dependency tree, delete, watchers, vote, flag, upload), `G` go to a linked issue (a Confluence page of this site, there or in Links, opens in place as markdown, its macros named, its images through `GET /api/confluence/images/{id}`, `GET /confluence/pages/{id}`; `ctrl+click` opens Confluence), `Backspace` back along the visible trail of followed issues (links, children, parent, `G`, palette; click a row to jump back; opening from the board resets it), `i` image viewer (arrows, `d` download), `d` delete own comment (`u` posts it back), a comment's Copy link copies its Jira link (`?focusedCommentId=`), `[`/`]` previous/next issue of the list beside, `1`-`4` tabs (`3` again steps History through Changes, Work log and All: comments, changes and work together; its box filters; a changed description shows the lines it changed), `4` Terminal (only while a herdr agent works on the issue: its live terminal; `4` again the next agent, `enter` or `ctrl+\` type, `t` take over input, `j`/`k` scroll back), `N` private notes, `D` development (in Details: pull requests, deploys, builds, branches, commits; `j`/`k` rows, `enter` open (a GitLab merge request unfolds: state, pipeline by stage, approvals, description; `GET /api/gitlab/mr?url=`; `d` its diff), `o` open in the browser, `r` reload, `y` copy branch/hash, `esc` back), `y`/`Y` copy key/link, `ctrl+y` copy branch, `*` pin, `<`/`>` widen/narrow (5%, stopping at `ui.panel_width`; a drag snaps to it within 3%, 20–80%), `o` Jira, `r` refresh, `ctrl+enter` save; a comment, comment edit or description being written is kept as a draft in the state file (shared with the TUI) and comes back after a reload; esc or Cancel with changes asks first; expands start folded | +| Issue panel | A link to an issue on this site (descriptions, comments, notes, inbox, merge requests) draws as a pill, status, key, summary and assignee (`lib/issuepill.js`, `GET /api/issues/{key}/card`), and opens it here (a link with its own text keeps it); Details lists the edit screen's other fields (components, custom fields) after its own, a click edits one: the pinned ones (the pin on hover, the site's every project, shared with the TUI; its own fields pinned till unpinned; `PUT /api/fields/pinned/{id}`, `jira.FieldPins`), the rest under More (remembered open), `ui.empty_fields: hide` folds their empty ones; a filled rich-text field is a section under the description, edited like it (`GET`/`PUT /api/issues/{key}/doc/{field}`); a closed issue's fields come read-only from the screen last seen for its project and type (`jira/layout.go`); that screen also comes with the issue (`Issue.Screen`, its fields asked along), so the fields draw at once and editmeta changes nothing in place; `j`/`k` comment or scroll, `c` comment (`ctrl+o` in it: who sees it, everyone, an internal note or a project role), `R` reply, `e` summary (own focused comment), `E` description, `a` `p` `P` `l` assignee, priority, points, labels (Jira's complete as you type), `s` status, `L` link issue, `A` actions (subtask, link, each agent of the issue: type into, prompt, stop, a new agent in its directory; on a done issue remove its worktree once merged and clean; draft pull request when `jira.repos` has the project; clone (opens the create form filled in; creating links it), type, move, original estimate, dependency tree, delete, watchers, vote, flag, upload), `G` go to a linked issue (a Confluence page of this site, there or in Links, opens in place as markdown, its macros named, its images through `GET /api/confluence/images/{id}`, `GET /confluence/pages/{id}`; `ctrl+click` opens Confluence), `Backspace` back along the visible trail of followed issues (links, children, parent, `G`, palette; click a row to jump back; opening from the board resets it), `i` image viewer (arrows, `d` download), `alt+i` attachments as thumbnails or a list (who added each and when; pref `issue.files`), `d` delete own comment (`u` posts it back), a comment's Copy link copies its Jira link (`?focusedCommentId=`), `[`/`]` previous/next issue of the list beside, `1`-`4` tabs (`3` again steps History through Changes, Work log and All: comments, changes and work together; its box filters; a changed description shows the lines it changed), `4` Terminal (only while a herdr agent works on the issue: its live terminal; `4` again the next agent, `enter` or `ctrl+\` type, `t` take over input, `j`/`k` scroll back), `N` private notes, `D` development (in Details: pull requests, deploys, builds, branches, commits; `j`/`k` rows, `enter` open (a GitLab merge request unfolds: state, pipeline by stage, approvals, description; `GET /api/gitlab/mr?url=`; `d` its diff), `o` open in the browser, `r` reload, `y` copy branch/hash, `esc` back), `y`/`Y` copy key/link, `ctrl+y` copy branch, `*` pin, `<`/`>` widen/narrow (5%, stopping at `ui.panel_width`; a drag snaps to it within 3%, 20–80%), `o` Jira, `r` refresh, `ctrl+enter` save; a comment, comment edit or description being written is kept as a draft in the state file (shared with the TUI) and comes back after a reload; esc or Cancel with changes asks first; expands start folded | | Home | `ui.home`'s widgets, in its order, as the TUI's `~` (`internal/home`; with none set, `g h` shows every one and the board stays the start): my work (open), inbox (unread), the remembered board's active sprint (done against the time gone, behind when it trails by a tenth), the timer, waiting on my review, a count per starred Jira filter and starred search (`GET /home/sprint/{board}`, `GET /home/filters`); `jk`, `enter` opens the row (a search as a board view), a head's Open its view, `esc` the board, `r` refresh | | Planning | `jk` move, `Home`/`End`, `PgUp`/`PgDn`, `J`/`K` rank, `m` move to sprint, `[`/`]` previous/next sprint, `x`/`space` select (`ctrl+click` too, the opened issue with it; `shift+click` selects the run), `z` fold, `enter` open, `P` points, `a` assignee, `e` quick edit, `X` bulk edit the marked, `o` Jira, `y` copy the section as a markdown table, `u` undoes a move, `N` `Z` `C` `E` new, start, complete (with `ui.delight` it says how the sprint ranks), edit sprint, `B` board, `alt+p` project, `f` filter (the board's query language), `F` filter builder, `A` filter by assignee (several, as on the board); the board's chips: Mine (no key: `m` moves), Assignee, `1`-`9` its quick filters (Jira narrows every section: `GET /plan/{board}?jql=`, which lists them as `QuickFilters`), `0` clear, `|` split (a second pane keeps one sprint or the backlog in view, picked in its bar and remembered per board, and leaves it out of the list; `>` moves there, `tab` or `h`/`l` switches pane, drag between panes; wide screens only), `O` sort, `R` reload; the list is the board's (`lib/cardlist.js`): a header click sorts within each section, again reverses, a third time back to rank (sorted, `J`/`K` don't rank and a drop goes to the section's end), each pane of the split sorts on its own (prefs `planning.sort.`, `planning.sort.split.`), Columns picks them, a dragged header moves one and its dragged edge resizes it (prefs `planning.cols`, `planning.colw`); a head counts the unestimated; each sprint head shows the points per assignee against `ui.capacity`, yours less your `ui.calendar` meetings in the sprint (the hours in its tooltip; `GET /plan/{board}` `Sprints[].Mine`) | | Reports | `h`/`l`/`[`/`]`/arrows previous/next report, `1`-`7` pick, `s` sprint, `B` board, `alt+p` project, `W` weeks (cycle time), `d` the column done counts from (`ui.report_done`), `c` a second line for the visit (`?compare=`; burndown, burnup, flow, cycle time and retro; velocity and releases keep Jira's done), `r` release (releases; every released version listed, `enter` its issues as a board view), `y` copy the numbers as a markdown table, `R` reload, `jk` items | diff --git a/internal/web/static/css/issue.css b/internal/web/static/css/issue.css index 7339e90b..e9ac5248 100644 --- a/internal/web/static/css/issue.css +++ b/internal/web/static/css/issue.css @@ -55,6 +55,10 @@ a.issue-ref { font-family: var(--font-mono); font-size: .95em; } .thumb img { width: 100%; height: 5.714rem; object-fit: cover; border-radius: 3px; background: var(--bg-3); display: block; } .thumb-video { position: relative; display: block; } .thumb-video .ico { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: 1.714rem; height: 1.714rem; padding: .357rem; border-radius: 50%; background: rgb(0 0 0 / .55); color: #fff; pointer-events: none; } +.row-link.file { gap: .571rem; } .row-link.file a.clip { color: inherit; } .row-link.file a.clip:hover { text-decoration: none; } .row-link.file > .dim { flex: none; font-size: .9em; } +.file-thumb { flex: none; width: 1.714rem; height: 1.714rem; border-radius: 3px; object-fit: cover; background: var(--bg-3); display: grid; place-items: center; color: var(--fg-2); } +.file-by { display: inline-flex; align-items: center; gap: .286rem; max-width: 10rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } +@media (max-width: 40rem) { .row-link.file .file-by { display: none; } } .md .md-video { --player-max-h: 25.714rem; margin: .4em auto; } .lightbox { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; } diff --git a/internal/web/static/js/lib/icons.js b/internal/web/static/js/lib/icons.js index 1d664d85..58a9031a 100644 --- a/internal/web/static/js/lib/icons.js +++ b/internal/web/static/js/lib/icons.js @@ -71,6 +71,7 @@ const P = { 'info': '', 'italic': '', 'kanban': '', + 'layout-grid': '', 'layout-panel-left': '', 'lightbulb': '', 'link': '', diff --git a/internal/web/static/js/views/issue.js b/internal/web/static/js/views/issue.js index 4d4526d7..999f2a35 100644 --- a/internal/web/static/js/views/issue.js +++ b/internal/web/static/js/views/issue.js @@ -476,15 +476,32 @@ export function mountIssue(el, key, { app, full, card }) { const mediaURL = a => '/api/attachments/' + encodeURIComponent(a.ID) + (isVideo(a) ? '?type=' + encodeURIComponent(a.MimeType) : ''); const poster = a => '/api/attachments/' + encodeURIComponent(a.ID) + '/thumbnail'; const size = n => (n > 1 << 20 ? (n / (1 << 20)).toFixed(1) + ' MB' : Math.max(1, Math.round(n / 1024)) + ' KB'); + // Images and videos as thumbnails, or every file as a row with who added it and when (alt+i, pref issue.files). + const filesAsList = () => app.prefs.get('issue.files', '') === 'list'; + function toggleFiles() { app.prefs.set('issue.files', filesAsList() ? '' : 'list'); renderFiles(); } + const download = a => '/api/attachments/' + encodeURIComponent(a.ID) + '?download=1&name=' + encodeURIComponent(a.Filename); + function fileRow(a) { + const media = isImage(a) || isVideo(a); + const open = h('a.clip', { href: media ? mediaURL(a) : download(a), download: media ? null : a.Filename, title: a.Filename + ' · ' + size(a.Size), + onclick: media ? e => { e.preventDefault(); gallery(0, mediaURL(a)); } : null }, a.Filename); + return h('div.row-link.file', { onclick: e => { if (!e.target.closest('a')) open.click(); } }, + media ? h('img.file-thumb', { src: isVideo(a) ? poster(a) : mediaURL(a), alt: '', loading: 'lazy', decoding: 'async' }) : h('span.file-thumb', icon('file')), + open, + a.Author && h('span.file-by.dim', ui.avatar(a.Author, null, 16), a.Author), + !isZero(a.Created) && h('time.dim', { title: dateTime(a.Created) }, ago(a.Created)), + h('span.dim', size(a.Size)), + h('a.btn.ghost.sm.x', { href: download(a), download: a.Filename, title: T('Download'), 'aria-label': T('Download') }, icon('download'))); + } function renderFiles() { const fs = (st.issue && st.issue.Attachments) || []; if (!fs.length) return clear(box.files); - const shown = fs.filter(a => isImage(a) || isVideo(a)), rest = fs.filter(a => !shown.includes(a)); - fill(box.files,h('div.sec-head', h('h3', T('Attachments')), h('span.dim', String(fs.length))), - shown.length > 0 && h('div.thumbs', shown.map(a => h('a.thumb', { href: mediaURL(a), title: a.Filename + ' · ' + size(a.Size), onclick: e => { e.preventDefault(); gallery(0, mediaURL(a)); } }, + const list = filesAsList(), shown = list ? [] : fs.filter(a => isImage(a) || isVideo(a)), rest = fs.filter(a => !shown.includes(a)); + const toggle = fs.some(a => isImage(a) || isVideo(a)) && h('button.btn.ghost.sm', { title: (list ? T('Show as thumbnails') : T('Show as list')) + ' (alt+i)', 'aria-label': list ? T('Show as thumbnails') : T('Show as list'), onclick: toggleFiles }, icon(list ? 'layout-grid' : 'list')); + fill(box.files, h('div.sec-head', h('h3', T('Attachments')), h('span.dim', String(fs.length)), toggle), + shown.length > 0 && h('div.thumbs', shown.map(a => h('a.thumb', { href: mediaURL(a), title: [a.Filename, a.Author, !isZero(a.Created) && dateTime(a.Created), size(a.Size)].filter(Boolean).join(' · '), onclick: e => { e.preventDefault(); gallery(0, mediaURL(a)); } }, isVideo(a) ? h('span.thumb-video', h('img', { src: poster(a), alt: a.Filename, loading: 'lazy', decoding: 'async' }), icon('play')) : h('img', { src: mediaURL(a), alt: a.Filename, loading: 'lazy', decoding: 'async' }), h('span.clip', a.Filename)))), - rest.map(a => h('a.row-link', { href: '/api/attachments/' + encodeURIComponent(a.ID) + '?download=1&name=' + encodeURIComponent(a.Filename), download: a.Filename }, h('span.clip', a.Filename), h('span.dim', size(a.Size))))); + rest.map(fileRow)); } // In-page viewer: the attachments' images and videos, then the images drawn in the text. ← → step, esc closes. function galleryList() { @@ -925,6 +942,7 @@ export function mountIssue(el, key, { app, full, card }) { scope.bind('Backspace', back, T('back along the trail of followed issues'), { group: G }); scope.bind('G', linked, T('go to a linked issue, child or web link'), { group: G }); scope.bind('i', () => gallery(0), T('view images'), { group: G }); + scope.bind('alt+i', toggleFiles, T('attachments as list or thumbnails'), { group: G, when: () => ((st.issue && st.issue.Attachments) || []).length > 0 && (full || app.panel.focused()) }); scope.bind('1', () => setTab('details'), T('details tab'), { group: G, bar: T('tabs') }); scope.bind('2', () => setTab('comments'), T('comments tab'), { group: G, bar: T('tabs') }); scope.bind('3', () => (st.tab === 'history' ? stepHist() : setTab('history')), T('history tab (again: work log, all)'), { group: G, bar: T('tabs') });