feat(panel): additional media groups on catalog edit screens (spec 0060)#2581
Merged
Conversation
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>
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.
Summary
Brings v1's registerable media groups into the new Inertia panel. Previously the panel was hardcoded to a single
imagescollection with image-only uploads; the Filament panel and core already supported arbitrary collections per model viaMediaDefinitions, but the Inertia panel dropped it.Now a model's
MediaDefinitionscan declare any number of collections beyondimages— 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
StandardDefinitionsimages collection declares its accepted mime types.HasMedia::thumbnail()andReorderMediaprimary promotion are scoped to the configured image collection, so media in other groups can never become the model thumbnail (MediaObserverwas already scoped).Panel backend
Support/Media/MediaGroupsprop builder — onemediaGroupsentry per registered collection (type: image|file, accept, items, per-collection URLs), replacing the inline media block duplicated across the four edit controllers.HandlesMediaReordertrait + sharedHttp/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.*MediaControllers /*MediaStoreRequests /*MediaUpdateRequests are collection-aware; the collection travels in the request body so route names are unchanged.Panel frontend
MediaManageris now prop-driven (renders any image collection).FileManager+FileEditDialogfor non-image groups.MediaGroupswrapper dispatches per group type; looped on all four edit pages.Notes / behaviour changes
media→mediaGroups(internal to first-party pages, not part of the add-on contract surface).HasMedia::thumbnail()/ imageprimarynow scoped to the image collection — inert for any single-collection install, only changes behaviour once a second collection exists.MediaDefinitionscontract change, no migrations, no new dependencies.Testing
MediaManager, newFileManager.npm run buildok.🤖 Generated with Claude Code