From 34e9c3d10b1052d89063e4736a6bfa54749228f3 Mon Sep 17 00:00:00 2001 From: Spitfire Date: Thu, 5 Sep 2024 10:10:45 -0600 Subject: [PATCH] Users can now Tag Tags. --- app/Datagrids/Bulks/TagBulk.php | 1 + app/Http/Controllers/Search/LiveController.php | 6 +++--- resources/api-docs/1.0/tags.md | 1 + resources/views/components/forms/tags.blade.php | 2 +- resources/views/entities/components/header.blade.php | 2 -- resources/views/entities/creator/form.blade.php | 2 +- resources/views/tags/entities/_form.blade.php | 2 +- resources/views/tags/form/_entry.blade.php | 2 ++ 8 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/Datagrids/Bulks/TagBulk.php b/app/Datagrids/Bulks/TagBulk.php index 7bafb7391a..9d169fced1 100644 --- a/app/Datagrids/Bulks/TagBulk.php +++ b/app/Datagrids/Bulks/TagBulk.php @@ -12,6 +12,7 @@ class TagBulk extends Bulk 'private_choice', 'auto_applied_choice', 'hide_choice', + 'tags', 'entity_image', 'entity_header', ]; diff --git a/app/Http/Controllers/Search/LiveController.php b/app/Http/Controllers/Search/LiveController.php index e027b26add..08ebb3958d 100644 --- a/app/Http/Controllers/Search/LiveController.php +++ b/app/Http/Controllers/Search/LiveController.php @@ -112,17 +112,17 @@ public function tagChildren(Request $request, Campaign $campaign) $term = trim($request->get('q', '')); $exclude = []; - if ($request->has('exclude')) { + if ($request->has('exclude-entity')) { /** @var Tag $tag */ - $tag = Tag::findOrFail($request->get('exclude')); + $tag = Tag::findOrFail($request->get('exclude-entity')); $exclude = $tag->entities->pluck('id')->toArray(); + $exclude[] = $tag->entity->id; } return response()->json( $this->search ->term($term) ->campaign($campaign) - ->exclude([config('entities.ids.tag')]) ->excludeIds($exclude) ->find() ); diff --git a/resources/api-docs/1.0/tags.md b/resources/api-docs/1.0/tags.md index 4bb5579d59..c23d19ff70 100644 --- a/resources/api-docs/1.0/tags.md +++ b/resources/api-docs/1.0/tags.md @@ -119,6 +119,7 @@ To create a tag, use the following endpoint. | `type` | `string` | The tag's type | | `colour` | `string` | The tag's colour | | `tag_id` | `integer` | The parent tag | +| `tags` | `array` | Array of tag ids | | `entity_image_uuid` | `string` | Gallery image UUID for the entity image | | `entity_header_uuid` | `string` | Gallery image UUID for the entity header (limited to premium campaigns) | | `is_private` | `boolean` | If the tag is only visible to `admin` members of the campaign | diff --git a/resources/views/components/forms/tags.blade.php b/resources/views/components/forms/tags.blade.php index 3219fdaee9..7e6b50960a 100644 --- a/resources/views/components/forms/tags.blade.php +++ b/resources/views/components/forms/tags.blade.php @@ -10,7 +10,7 @@ is_hidden ?? false)) checked="checked" @endif /> + + @include('cruds.fields.tags') @include('cruds.fields.image')