Skip to content

Commit 1c28ed6

Browse files
committed
Add user and user group blueprint command palette links.
1 parent 4bf1063 commit 1c28ed6

3 files changed

Lines changed: 21 additions & 11 deletions

File tree

src/Auth/UserGroupRepository.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,12 @@ public function blueprint()
2626

2727
return $blueprint;
2828
}
29+
30+
public function blueprintCommandPaletteLink()
31+
{
32+
return $this->blueprint()?->commandPaletteLink(
33+
type: 'Users',
34+
url: cp_route('blueprints.user-groups.edit'),
35+
);
36+
}
2937
}

src/Auth/UserRepository.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ public function blueprint()
8585
return $blueprint;
8686
}
8787

88+
public function blueprintCommandPaletteLink()
89+
{
90+
return $this->blueprint()?->commandPaletteLink(
91+
type: 'Users',
92+
url: cp_route('blueprints.users.edit'),
93+
);
94+
}
95+
8896
public function findByOAuthId(Provider $provider, string $id): ?User
8997
{
9098
return $this->find(

src/CommandPalette/Palette.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,11 @@ protected function buildFields(): self
7676
->map(fn ($form) => $form->blueprintCommandPaletteLink())
7777
->each(fn (Link $link) => $this->addCommand($link));
7878

79-
// TODO: Womp, got to end of this and realized they don't have `editUrl()` methods, so we'll refactor this to what's above ^
80-
// collect()
81-
// ->merge(Facades\Collection::all()->flatMap(fn ($collection) => $collection->entryBlueprints()))
82-
// ->merge(Facades\Taxonomy::all()->flatMap(fn ($taxonomy) => $taxonomy->termBlueprints()))
83-
// ->merge(Facades\Nav::all()->map->blueprint())
84-
// ->merge(Facades\GlobalSet::all()->map->blueprint())
85-
// ->merge(Facades\AssetContainer::all()->map->blueprint())
86-
// ->merge(Blueprint::getAdditionalNamespaces()->keys()->flatMap(fn (string $key) => Blueprint::in($key)->sortBy(fn (Blueprint $blueprint) => $blueprint->title())))
87-
// ->flatten()
88-
// ->map(fn (Blueprint $blueprint) => $blueprint->generateCommandPaletteLink())
89-
// ->each(fn (Link $link) => $this->addCommand($link));
79+
$this->addCommand(Facades\User::blueprintCommandPaletteLink());
80+
$this->addCommand(Facades\UserGroup::blueprintCommandPaletteLink());
81+
82+
// TODO: Handle additional blueprint namespaces
83+
// Blueprint::getAdditionalNamespaces()->keys()->flatMap(fn (string $key) => Blueprint::in($key)->sortBy(fn (Blueprint $blueprint) => $blueprint->title()))
9084

9185
Facades\Fieldset::all()
9286
->map(fn (Fieldset $fieldset) => $fieldset->commandPaletteLink())

0 commit comments

Comments
 (0)