From d3b38e5e9761d23ff600f45c1c1b311e3a9fe770 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Tue, 14 Jul 2020 15:54:12 -0400 Subject: [PATCH 01/39] Initial Blueprints revamp ... - Remove Blueprint::all() - Add Blueprint::in() to get blueprints in a directory (namespace) - Blueprint::find() can look in a directory - Top level Blueprint CRUD is removed (except listing which will be repurposed) and added to Collections (eventually will get duplicated onto Taxonomies, Globals, Forms, etc) - Collection entryBlueprints read from the directory instead of needing to be defined in its YAML file. The method is now only a getter. - Remove editUrl and deleteUrl from Blueprint because it complicates things now that it'll be different depending on the usage. Just use the route helper. - The "Links" toggle on the edit collection page will create/delete a link.yaml (not entry_link) blueprint, rather than add to the blueprints list. --- resources/blueprints/entry_link.yaml | 11 -- .../js/components/collections/Listing.vue | 1 + resources/views/blueprints/index.blade.php | 36 ----- .../blueprints/create.blade.php | 2 +- .../blueprints/edit.blade.php | 4 +- .../collections/blueprints/index.blade.php | 26 ++++ resources/views/collections/show.blade.php | 3 + routes/cp.php | 1 + src/Entries/Collection.php | 42 +++--- src/Fields/Blueprint.php | 23 ++-- src/Fields/BlueprintRepository.php | 82 ++++++----- .../CollectionBlueprintsController.php | 90 +++++++++++++ .../CP/Collections/CollectionsController.php | 56 +++++--- .../CP/Collections/EntriesController.php | 6 +- .../CP/Fields/BlueprintController.php | 122 +---------------- .../CP/Fields/ManagesBlueprints.php | 103 ++++++++++++++ src/Stache/Stores/CollectionsStore.php | 1 - tests/Data/Entries/CollectionTest.php | 48 +++++-- tests/Data/Entries/EntryTest.php | 8 +- tests/Fakes/FakeBlueprintRepository.php | 39 ++++-- .../Blueprints/CreateBlueprintTest.php | 37 ----- .../Feature/Blueprints/StoreBlueprintTest.php | 92 ------------- .../Blueprints/CreateBlueprintTest.php | 44 ++++++ .../Blueprints/EditBlueprintTest.php | 18 +-- .../Blueprints/StoreBlueprintTest.php | 127 ++++++++++++++++++ .../Blueprints/UpdateBlueprintTest.php | 80 ++++++----- .../Blueprints/ViewBlueprintListingTest.php | 78 +++++++++++ .../Collections/UpdateCollectionTest.php | 56 ++++++-- .../Collections/ViewCollectionListingTest.php | 2 + tests/Fields/BlueprintRepositoryTest.php | 126 ++++++++--------- tests/FrontendTest.php | 9 +- tests/Tags/Collection/CollectionTest.php | 3 +- 32 files changed, 843 insertions(+), 533 deletions(-) delete mode 100644 resources/blueprints/entry_link.yaml delete mode 100644 resources/views/blueprints/index.blade.php rename resources/views/{ => collections}/blueprints/create.blade.php (94%) rename resources/views/{ => collections}/blueprints/edit.blade.php (55%) create mode 100644 resources/views/collections/blueprints/index.blade.php create mode 100644 src/Http/Controllers/CP/Collections/CollectionBlueprintsController.php create mode 100644 src/Http/Controllers/CP/Fields/ManagesBlueprints.php delete mode 100644 tests/Feature/Blueprints/CreateBlueprintTest.php delete mode 100644 tests/Feature/Blueprints/StoreBlueprintTest.php create mode 100644 tests/Feature/Collections/Blueprints/CreateBlueprintTest.php rename tests/Feature/{ => Collections}/Blueprints/EditBlueprintTest.php (56%) create mode 100644 tests/Feature/Collections/Blueprints/StoreBlueprintTest.php rename tests/Feature/{ => Collections}/Blueprints/UpdateBlueprintTest.php (71%) create mode 100644 tests/Feature/Collections/Blueprints/ViewBlueprintListingTest.php diff --git a/resources/blueprints/entry_link.yaml b/resources/blueprints/entry_link.yaml deleted file mode 100644 index 5c79573a60d..00000000000 --- a/resources/blueprints/entry_link.yaml +++ /dev/null @@ -1,11 +0,0 @@ -title: Link -fields: - - - handle: title - field: - type: text - - - handle: redirect - field: - type: link - required: true diff --git a/resources/js/components/collections/Listing.vue b/resources/js/components/collections/Listing.vue index c958968ab09..34e74ebb4aa 100644 --- a/resources/js/components/collections/Listing.vue +++ b/resources/js/components/collections/Listing.vue @@ -8,6 +8,7 @@