Skip to content

feat(panel): additional media groups on catalog edit screens (spec 0060)#2581

Merged
glennjacobs merged 1 commit into
2.xfrom
panel-media-groups
Jul 22, 2026
Merged

feat(panel): additional media groups on catalog edit screens (spec 0060)#2581
glennjacobs merged 1 commit into
2.xfrom
panel-media-groups

Conversation

@glennjacobs

Copy link
Copy Markdown
Contributor

Summary

Brings v1's registerable media groups into the new Inertia panel. Previously the panel was hardcoded to a single images collection with image-only uploads; the Filament panel and core already supported arbitrary collections per model via MediaDefinitions, but the Inertia panel dropped it.

Now a model's MediaDefinitions can declare any number of collections beyond images — document downloads, a second image gallery, etc. — and each renders as its own section on the products, brands, collections and product-types edit screens. Image collections keep the rich uploader (grid, hero, focal, crop); non-image collections get a new file-list uploader (download, rename, reorder, delete). Groups are declared in code, matching v1 and Filament — no admin UI.

Spec: specs/0060-panel-media-groups.md.

Changes

Core

  • StandardDefinitions images collection declares its accepted mime types.
  • HasMedia::thumbnail() and ReorderMedia primary promotion are scoped to the configured image collection, so media in other groups can never become the model thumbnail (MediaObserver was already scoped).

Panel backend

  • New Support/Media/MediaGroups prop builder — one mediaGroups entry per registered collection (type: image|file, accept, items, per-collection URLs), replacing the inline media block duplicated across the four edit controllers.
  • New HandlesMediaReorder trait + shared Http/Requests/Media/{MediaStoreRequest,MediaUpdateRequest} abstracts. A request can only write to a collection the model registers; per-group file rules come from the collection's mime allowlist; alt text is required for images only.
  • The four *MediaControllers / *MediaStoreRequests / *MediaUpdateRequests are collection-aware; the collection travels in the request body so route names are unchanged.

Panel frontend

  • MediaManager is now prop-driven (renders any image collection).
  • New FileManager + FileEditDialog for non-image groups.
  • MediaGroups wrapper dispatches per group type; looped on all four edit pages.
  • File-group lang keys added across all 16 locales.

Notes / behaviour changes

  • Inertia prop rename on the four edit pages: mediamediaGroups (internal to first-party pages, not part of the add-on contract surface).
  • HasMedia::thumbnail() / image primary now scoped to the image collection — inert for any single-collection install, only changes behaviour once a second collection exists.
  • No MediaDefinitions contract change, no migrations, no new dependencies.

Testing

  • Pest: core (thumbnail/primary scoping + mime rejection) and panel (per-group mime enforcement, non-registered-collection rejection, multi-group prop shape, reorder without thumbnail hijack).
  • Vitest: updated MediaManager, new FileManager.
  • Full local run green: core 1169, panel 730, admin 235, filament 45; vitest 237; PHPStan clean; type-check clean; npm run build ok.

🤖 Generated with Claude Code

Bring v1's registerable media groups into the Inertia panel. A model's
MediaDefinitions can declare collections beyond `images` (e.g. document
downloads or a second image gallery); each renders as its own section on the
products, brands, collections and product-types edit screens. Image groups use
the existing rich uploader; non-image groups get a new file-list uploader.

- Core: `StandardDefinitions` images collection declares its accepted mime
  types; `thumbnail()` and `ReorderMedia` primary promotion are scoped to the
  configured image collection so other groups never own the thumbnail.
- Panel backend: `MediaGroups` prop builder + `HandlesMediaReorder` trait and
  shared `MediaStoreRequest`/`MediaUpdateRequest` abstracts make the four media
  controllers collection-aware; a request can only write to a collection the
  model registers, and file rules come from that collection's mime allowlist.
- Panel frontend: prop-driven `MediaManager`, new `FileManager` +
  `FileEditDialog`, and a `MediaGroups` wrapper looped on the edit pages.
- Media lang keys added across all 16 locales.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-project-automation github-project-automation Bot moved this to Todo in Roadmap Jul 22, 2026
@glennjacobs
glennjacobs merged commit 946486c into 2.x Jul 22, 2026
23 checks passed
@glennjacobs
glennjacobs deleted the panel-media-groups branch July 22, 2026 15:01
@github-project-automation github-project-automation Bot moved this from Todo to Done in Roadmap Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant