-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customize the navigation menu (resource grouping) #271
Comments
Check out the following file, its contains the blade code navigation menu. You can easier overriding it and copying it to your |
@albalooshi thank you! How does it come that you can override it by copying it to |
@chescos No its not, in case the You can override any package view by creating a file with the same path in You can close the issue if this solves your problem. |
@albalooshi okay, thank you for explaining! I'll leave this open then, as I hope that it will someday be implemented as a feature (not just a hack). |
Related to #2 |
Here's a temporary hacky solution until original developers implements a better way of adding resource grouping. This is my custom
Then in my
Then, for example, I have two Resources under a "Administration" group, so I just set the Other existing resources without any What my navigation code does is just splitting up those resources with parents and without parents into two separate collections then loop it out as usual. |
There's also this package @chescos: |
This landed in the release today. |
When will you update the docs to version 1.1 so I now how to implement this? |
@jochemgruter add |
@dillingham it doesn't work :( |
@shalawani Can you confirm you're on the latest version? |
Can you show some code about how you're trying to group your resources? It should work, so a code example will help us figure out why it isn't working for you. |
I just add "public static $group = 'Sellers';" property for my resources |
@shalawani Can you show me the composer.json file that you have, if you have any tools or packages being pulled in. So far i'm not able to reproduce it. |
|
@albalooshi gives me the idea, after copy the file to our resource path, then just to modify the
We'll get very pretty navigation sidebar. |
I am trying to rename "Resources" sidebar-label in the navagation.blade.php, {{ __('CMS') }} does not reflect the change and still display "Resources". I have tried clearing all caches and views. What is the deal? |
I've implemented the following solution (which works also with groups): In <ul class="list-reset mb-8">
@php
$menu = [];
$noPosStartIndex = 1000;
foreach($resources as $resource):
if(method_exists($resource, 'menuPosition')):
$menu[$resource::menuPosition()] = $resource;
else:
$menu[$noPosStartIndex++] = $resource;
endif;
endforeach;
ksort($menu);
@endphp
@foreach($menu as $resource)
<li class="leading-tight mb-4 ml-8 text-sm">
<router-link :to="{
name: 'index',
params: {
resourceName: '{{ $resource::uriKey() }}'
}
}" class="text-white text-justify no-underline dim">
{{ $resource::label() }}
</router-link>
</li>
@endforeach
</ul> And added a static /**
* Returns the menu position.
*
* @return int
*/
public static function menuPosition()
{
return 10;
} |
sorry for the bump, but would it also be possible to get rid of the "resources" main menu and put all the resources in their own menu item like the Dashboard? |
which path? |
which class file? |
@LifeBlood At any resource class |
hey @p0nt - I just did that today. In each resource, set a group
Then we can copy the file from Nova, and edit the loop that displays the menu. edit Then something like this - note, mix and match the icons from heroicons.
|
@nicko170 Hey, I've tried your approach but editing the |
Hey @Arturexe I stopped doing it that way - check this package out. https://github.com/dcasia/collapsible-resource-manager You have to remember to add each resource in when you creat new ones - it's no longer automatic, but it's absolutely amazing! |
I feel that is it unpractical to just throw all resources under a "Resource" group in the navigation. I have more than 50 resources and it just looks confusing to have them all listed alphabetically under "Resources". I would like to order them into custom groups. Is there currently a way to gain full control of the navigation (e.g through a blade file)?
The text was updated successfully, but these errors were encountered: