Poster/Talk preview popover with download actions (#840)#1374
Merged
Conversation
…#840) Hovering or clicking a publication's "Poster"/"Talk" link now opens a Cite-style card showing the artifact thumbnail plus download actions (PDF, the raw file e.g. PPTX, and the editable Source link), each with file size. The card opens on hover (mouse) and on click/Enter/tap, moves focus in and traps Tab while open, and closes on Escape/outside-click, so it works for mouse, keyboard, and touch alike. It degrades to the plain direct-to-PDF link when the artifact has no thumbnail. Also adds safe pdf_file_size/raw_file_size properties on Artifact: the size is read from storage at render time, which raises FileNotFoundError when a file is missing on disk. The card renders that size for every entry on a listing, so a single missing file used to 500 the whole /publications/ page; it now degrades to "no size shown" instead. - snippets/artifact_preview_link.html: reusable trigger + inert <template> card - thumbnailPreview.js: interactive popover (hover + click-to-pin, focus mgmt) - publications.css: card / action-row styling (reuses Bootstrap .popover) - wired the script into the 5 pages that render the publication snippet - tests: website/tests/test_thumbnail_preview.py Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #840.
What
Hovering or clicking a publication's Poster / Talk link now opens a Cite-style card showing the artifact thumbnail plus download actions — PDF, the raw file (PPTX/Keynote/…), and the editable Source link (
external_slides_url) — each with its file size. Clicking the thumbnail opens the PDF.Interaction & accessibility
hrefto the PDF, so it still works with JS disabled (progressive enhancement).Robustness fix
The card shows each file's size, read from storage at render time via
FileField.size— which raisesFileNotFoundErrorwhen a file is missing on disk. Because the size renders for every entry on a listing, a single missing file 500'd the entire/publications/page. New safepdf_file_size/raw_file_sizeproperties onArtifactmake a missing file degrade to "no size shown" instead. (Surfacing/fixing the underlying missing files is the existing Media / file integrity Data Health check's job.)Files
snippets/artifact_preview_link.html(new) — reusable trigger + inert<template>card; the image lazy-loads only when the card opens.static/website/js/thumbnailPreview.js(new) — self-contained, event-delegated popover (works with the member page's AJAX "load more" with no re-init).static/website/css/publications.css— card/action styling; reuses Bootstrap's.popover.models/artifact.py— safe file-size properties.display_pub_snippet.html+ the 5 pages that render it.Tests
website/tests/test_thumbnail_preview.py(8 tests): card markup, raw-file & Source actions, plain-link fallback, both layouts, and the missing-file degrade-not-crash path. Full suite green (the one unrelatedtest_page_metadatared is a stale assertion from 7e497aa, fixed separately).Before merging
🤖 Generated with Claude Code