Skip to content

Let timelines get images from the editor - #1521

Open
drusepth wants to merge 4 commits into
masterfrom
ccr-693f6c89-4c8e7p
Open

drusepth wants to merge 4 commits into
masterfrom
ccr-693f6c89-4c8e7p

Conversation

@drusepth

@drusepth drusepth commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

User-facing changes

  • Timelines can now have images. Use the Add cover image button on the editor's banner (it reads Edit images once there is one) to upload, reorder, set a cover, adjust framing and delete, using the same gallery as other pages.
  • Timeline pages and the timeline editor now have the same banner as other content pages: the cover image, or the stock timeline image until you add one.
  • When you share a link to a timeline, the preview shows its cover image, title and description.
  • Timeline cards on your Timelines list show the timeline's cover image.
  • Uploading timeline images works without JavaScript too.
  • The Images and Share windows close with Escape, keep keyboard focus inside while open, return focus to where you were when they close, stop the page scrolling behind them, and no longer sit underneath the site sidebar.
  • Bug fix: the timeline editor no longer runs off the side of phone screens. It was about 150px wider than a phone, which cut off the right edge (including the View button) and let the page scroll sideways.

Implementation notes

  • The backend already supported timeline images (HasImageUploads, POST /image_uploads); only the UI was missing.
  • Both timeline pages render the shared content/_hero_header. That partial now also accepts optional icon, color, title, title_x_text and corner_actions locals, so pages without a ContentSerializer can use it. Existing content pages render it exactly as before.
  • The editor's images button sits in the banner's top-right corner rather than in the title bar, because the editor's fixed side tabs overlap the title bar (the content editors have the same overlap).
  • The gallery is loaded into the Images window the first time it opens (GET /timelines/:id/gallery over XHR) rather than rendered on every editor page view. After the window closes, the banner is re-fetched (GET /timelines/:id/cover).
  • Without JavaScript, the button links to /timelines/:id/gallery as a page of its own. timelines#update saves that form's files through ImageUploadService so upload bandwidth is charged. The upload loop it shares with ContentController moved to the UploadsGalleryImages concern.
  • Phone-width fix: <main> in the timeline editor is a flex item and lacked min-w-0, so it couldn't shrink below its widest unbreakable row.
  • Gotcha for anyone writing Alpine in views: the HTML parser the tests use (libxml2) drops every attribute on an element whose attribute value contains =>. So arrow functions in Alpine attributes can't be tested with assert_select, and I avoided them here.
  • Left alone: the title appears both in the banner and below it, as on other content pages.

Testing

  • New test/controllers/timeline_images_test.rb (10 tests): the editor banner with and without a cover, the gallery loading on demand, the no-JS gallery page and upload (including the bandwidth charge), the editor's JSON saves still working, people who can't edit being blocked, the banner and og:image on the timeline page, and visitors not seeing private images.
  • Full suite passes: rails test (882 tests, 1 skip that needs Postgres) and rspec (14 examples).
  • Checked by hand in a browser:
    • The editor with and without a cover.
    • Uploading, after which the banner updates once the window closes.
    • Escape in the full-size image viewer closes only the viewer.
    • Tab stays inside the window.
    • The Share window covers the sidebar.
    • Inline renames update the banner title.
    • The banner narrows when a side panel opens.
    • With JavaScript off: the button leads to the gallery page, and uploading there works.
    • At 390, 768, 1024 and 1400px wide, the timeline editor, timeline page and Timelines list have no sideways scrolling.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RVaA9Va1rv4KddobfGZCD4

Timelines already supported image uploads in the model and upload endpoint,
but the timeline editor had no way to reach them, so timeline cards were
stuck on the stock header image. Add an Images button beside View that
opens the shared content gallery (upload, reorder, set cover) in a modal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RVaA9Va1rv4KddobfGZCD4
…ndow

- Editor: replace the Images button with a cover slot above the title. It
  shows the cover (with an Edit images button) or an "Add a cover image"
  prompt, opens the Images window, and is re-rendered when the window closes.
- The gallery loads into the window on first open (timelines#gallery over
  XHR) instead of with every editor page view.
- Without JavaScript the cover slot links to timelines#gallery as a page of
  its own, and timelines#update saves the gallery form's files through
  ImageUploadService, so bandwidth is charged. The upload loop shared with
  ContentController moves to the UploadsGalleryImages concern.
- Timeline page: cover banner when there is a cover (private images only for
  people who can edit), and title, description and og:image/twitter tags.
- Images and Share windows: Escape closes them (but not while the image
  viewer or framing editor is open on top), Tab stays inside, focus returns
  to what opened them, the page behind stops scrolling, and they sit above
  the site sidebar (z-60).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RVaA9Va1rv4KddobfGZCD4
The timeline page and editor now render content/_hero_header like every
other content page: a full-width banner (the stock timeline image when
there's no cover) with the frosted title bar and type icon. The editor uses
the same shorter height as other content editors, narrows with its side
panels, and keeps the title in step with inline renames.

The editor's way into the Images window is an Add cover image / Edit images
button in the banner's top-right corner, clear of the fixed side tabs that
overlap the title bar. The hero partial takes icon, color, title,
title_x_text and corner_actions locals so pages without a ContentSerializer
can use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RVaA9Va1rv4KddobfGZCD4
@railway-app

railway-app Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the notebook-pr-1521 environment in Notebook.ai Feature Review

Service Status Web Updated
notebook 😴 Sleeping (View Logs) Web Nov 29, 2026 at 10:05 am UTC

<main> is a flex item, so without min-w-0 it couldn't shrink below its
content's widest unbreakable row. On a 390px screen the editor was 542px
wide, cutting off the right edge (including the View button) and letting
the page scroll sideways.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RVaA9Va1rv4KddobfGZCD4

This branch was successfully deployed

1 active deployment
Notebook.ai Feature Review / notebook-pr-1521 — df2c30c8 Deployed Nov 29, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants