@@ -93,6 +93,30 @@ public function show(Request $request, $nav)
9393
9494 $ this ->authorize ('view ' , $ nav ->in ($ site ), __ ('You are not authorized to view navs. ' ));
9595
96+ $ collectionTree = null ;
97+
98+ if ($ nav ->collections ()->count () === 1 && $ nav ->collections ()->first ()->hasStructure ()) {
99+ $ collection = $ nav ->collections ()->first ();
100+
101+ $ collectionBlueprints = $ collection
102+ ->entryBlueprints ()
103+ ->reject ->hidden ()
104+ ->map (function ($ blueprint ) {
105+ return [
106+ 'handle ' => $ blueprint ->handle (),
107+ 'title ' => $ blueprint ->title (),
108+ ];
109+ })->values ();
110+
111+ $ collectionTree = [
112+ 'title ' => $ collection ->title (),
113+ 'url ' => cp_route ('collections.tree.index ' , $ collection ),
114+ 'showSlugs ' => $ collection ->structure ()->showSlugs (),
115+ 'expectsRoot ' => $ collection ->structure ()->expectsRoot (),
116+ 'blueprints ' => $ collectionBlueprints ,
117+ ];
118+ }
119+
96120 return Inertia::render ('navigation/Show ' , [
97121 'title ' => $ nav ->title (),
98122 'handle ' => $ nav ->handle (),
@@ -118,6 +142,7 @@ public function show(Request $request, $nav)
118142 'canEdit ' => User::current ()->can ('edit ' , $ nav ),
119143 'canSelectAcrossSites ' => $ nav ->canSelectAcrossSites (),
120144 'canEditBlueprint ' => User::current ()->can ('configure fields ' ),
145+ 'collectionTree ' => $ collectionTree ,
121146 ]);
122147 }
123148
0 commit comments