Collections: Add inline collection creation to the DataView block#27
Merged
Conversation
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.
What
Closes #97
Adds an inline way to create a collection from the DataView block placeholder, backed by a new
cortext/v1/collectionsREST endpoint that creates the collection from just a title.Why
Today, inserting a Collection view means leaving the editor to create the collection first, then coming back to pick it. This makes it a single step.
How
Adding a
CollectionsControllerthat turns the title into a unique, CPT-safe slug, inserts thecrtxt_collectionpost, and registers the row CPT during the same request so the response can return a workingrestBase. Slug derivation reads existing slugs once and falls back to numeric suffixes when the desired slug is reserved, already taken, or would push past the 20-character post-type limit.Reworking the block placeholder so the picker and a "Create collection" form sit together, and adding a toolbar dropdown to swap the active collection without removing the block. Splitting out invalid and error states in
CollectionDataViewsso a deleted collection or a failed row fetch shows a notice instead of an empty table. Pulling the collection list query into a shared constant so the sidebar and the block share a cache entry.Testing Instructions
collectionIdresolves.composer test -- --filter=Test_Rest_Collections_Controllerand thedata-view-block.spec.jsPlaywright spec.Grabacion.de.pantalla.2026-04-28.a.las.0.24.02.mov