Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions resources/js/components/structures/PageSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
:can-create="false"
:can-reorder="false"
:max-items="maxItems"
:tree="tree"
@item-data-updated="itemDataUpdated"
/>
</template>
Expand All @@ -34,6 +35,10 @@ export default {
type: Number,
required: false,
},
tree: {
type: Object,
required: false,
},
},

data() {
Expand Down
2 changes: 2 additions & 0 deletions resources/js/pages/navigation/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default {
canSelectAcrossSites: { type: Boolean, required: true },
canEditBlueprint: { type: Boolean, required: true },
entryQueryScopes: { type: Array, default: () => [] },
collectionTree: { type: Object, required: false },
},

data() {
Expand Down Expand Up @@ -540,6 +541,7 @@ export default {
:query-scopes="entryQueryScopes"
:max-items="maxPagesSelection"
:can-select-across-sites="canSelectAcrossSites"
:tree="collectionTree"
@selected="entriesSelected"
/>

Expand Down
25 changes: 25 additions & 0 deletions src/Http/Controllers/CP/Navigation/NavigationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,30 @@ public function show(Request $request, $nav)

$this->authorize('view', $nav->in($site), __('You are not authorized to view navs.'));

$collectionTree = null;

if ($nav->collections()->count() === 1 && $nav->collections()->first()->hasStructure()) {
$collection = $nav->collections()->first();

$collectionBlueprints = $collection
->entryBlueprints()
->reject->hidden()
->map(function ($blueprint) {
return [
'handle' => $blueprint->handle(),
'title' => $blueprint->title(),
];
})->values();

$collectionTree = [
'title' => $collection->title(),
'url' => cp_route('collections.tree.index', $collection),
'showSlugs' => $collection->structure()->showSlugs(),
'expectsRoot' => $collection->structure()->expectsRoot(),
'blueprints' => $collectionBlueprints,
];
}

return Inertia::render('navigation/Show', [
'title' => $nav->title(),
'handle' => $nav->handle(),
Expand All @@ -118,6 +142,7 @@ public function show(Request $request, $nav)
'canEdit' => User::current()->can('edit', $nav),
'canSelectAcrossSites' => $nav->canSelectAcrossSites(),
'canEditBlueprint' => User::current()->can('configure fields'),
'collectionTree' => $collectionTree,
]);
}

Expand Down