Post editor picker: attach an existing Media from the library #192

Closed
opened 2026-08-12 05:58:02 +00:00 by rosa · 0 comments
Owner

Parent

Implementation spec: Media management: Library page and editor picker — implementation spec (§2.4). The winning interaction is variant A from the picker prototype (branch prototype/media-picker); nothing from that branch merges — it gets rebuilt properly.

What to build

In both post editors, beneath the untouched file input, a collapsed "Or pick from your library" section expands into the user's tile grid. Picking a Media attaches it as the Post's Photo (with the form's alt) instead of uploading a new one. Selection works without JavaScript; a small script layers on the settled interaction.

Acceptance criteria

  • Both editors (new and edit) render the collapsed picker through a shared markup helper, fed by the owner's Media newest-first: Ready tiles selectable with the filename-or-date label plus dimensions and upload date; Processing tiles disabled with a badge; Failed excluded entirely (the Library still shows them).
  • Selection works with JavaScript disabled: each selectable tile is a label wrapping a radio input carrying the Media id, and submitting attaches the picked Media as the Post's Photo.
  • A static JS asset adds the inline preview of the picked tile (thumbnail, label, metadata) with a clear-selection control, and upload/pick mutual exclusion — the last action wins and clears the other. No CSP change.
  • Server-side photo precedence is remove > upload > pick > keep. A pick of a foreign or unknown id — only producible by a forged form — is rejected as a bad request without revealing whether the id exists; if a tampered form sends both an upload and a pick, the upload wins.
  • Keep behavior is unchanged: no action retains the existing Photo with the form's alt re-adopted.
  • mise run format, mise run ci, and mise run clippy pass.

Blocked by

  • #189 — Media captures its upload filename as a display label (tile labels).
  • #190 — Domain ops: list, resolve, reference, and delete Media (the grid's listing and the ownership-checked resolution). Independent of the Library page ticket — the two can proceed in parallel.
## Parent Implementation spec: [Media management: Library page and editor picker — implementation spec](https://code.cosmicrose.dev/rosa/vernier/issues/188) (§2.4). The winning interaction is variant A from the picker prototype (branch `prototype/media-picker`); nothing from that branch merges — it gets rebuilt properly. ## What to build In both post editors, beneath the untouched file input, a collapsed "Or pick from your library" section expands into the user's tile grid. Picking a Media attaches it as the Post's Photo (with the form's alt) instead of uploading a new one. Selection works without JavaScript; a small script layers on the settled interaction. ## Acceptance criteria - [ ] Both editors (new and edit) render the collapsed picker through a shared markup helper, fed by the owner's Media newest-first: Ready tiles selectable with the filename-or-date label plus dimensions and upload date; Processing tiles disabled with a badge; Failed excluded entirely (the Library still shows them). - [ ] Selection works with JavaScript disabled: each selectable tile is a label wrapping a radio input carrying the Media id, and submitting attaches the picked Media as the Post's Photo. - [ ] A static JS asset adds the inline preview of the picked tile (thumbnail, label, metadata) with a clear-selection control, and upload/pick mutual exclusion — the last action wins and clears the other. No CSP change. - [ ] Server-side photo precedence is remove > upload > pick > keep. A pick of a foreign or unknown id — only producible by a forged form — is rejected as a bad request without revealing whether the id exists; if a tampered form sends both an upload and a pick, the upload wins. - [ ] Keep behavior is unchanged: no action retains the existing Photo with the form's alt re-adopted. - [ ] `mise run format`, `mise run ci`, and `mise run clippy` pass. ## Blocked by - #189 — Media captures its upload filename as a display label (tile labels). - #190 — Domain ops: list, resolve, reference, and delete Media (the grid's listing and the ownership-checked resolution). Independent of the Library page ticket — the two can proceed in parallel.
rosa added this to the v0.1 milestone 2026-08-12 18:04:00 +00:00
rosa closed this issue 2026-08-12 22:21:17 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
rosa/vernier#192
No description provided.