Skip to content
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

Duplicate "Activity Logs" entry in the menu #40

Open
brunocoelhosilva opened this issue Nov 24, 2023 · 10 comments
Open

Duplicate "Activity Logs" entry in the menu #40

brunocoelhosilva opened this issue Nov 24, 2023 · 10 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@brunocoelhosilva
Copy link

Hi there,

In the documentation it only shows "Activity Logs" in the menu once, but in my case it also appears within Resources. Is this expected?
I would like only the bottom one to appear.
Thanks.

Screenshot 2023-11-24 at 09 24 41

@robbanl
Copy link

robbanl commented Nov 28, 2023

I am facing the same issue

@bolechen
Copy link
Owner

bolechen commented Dec 4, 2023

Whats laravel & nova version do you use?

@robbanl
Copy link

robbanl commented Dec 4, 2023

I'm using the most recent versions of each package:

Nova: 4.32.6
Laravel: 10.34.2

@brunocoelhosilva
Copy link
Author

Nova:4.32.6
Laravel: 10.35.0

@votkapower
Copy link

Here is a fix:

  1. Create a new ActivityLog Resource and extend the original, and just disable the resources link

namespace App\Nova;

class Activitylog extends \Bolechen\NovaActivitylog\Resources\Activitylog
{
    public static $displayInNavigation = false;

}

  1. Swap the model in the nova-activitylog.php config (publish it if you havent)
    'resource' => \App\Nova\ActivityLog::class,
    Now it will remove the link in the Resources section and only leave the link with the icon.

It worked for me.

@bolechen
Copy link
Owner

bolechen commented Dec 7, 2023

Here is a fix:

  1. Create a new ActivityLog Resource and extend the original, and just disable the resources link

namespace App\Nova;

class Activitylog extends \Bolechen\NovaActivitylog\Resources\Activitylog
{
    public static $displayInNavigation = false;

}
  1. Swap the model in the nova-activitylog.php config (publish it if you havent)
    'resource' => \App\Nova\ActivityLog::class,
    Now it will remove the link in the Resources section and only leave the link with the icon.

It worked for me.

I'm sorry for the inconvenience.For my own personal reasont, ican't have nova 4.x access, but thx for you help.
I see the $displayInNavigation changed default to true by this PR #27 by @Kussie
I want ask to Kussis, may I ask for your reasoning as to why you did what you did at the time?Does it need to be changed back?

@Kussie
Copy link
Contributor

Kussie commented Dec 7, 2023

Here is a fix:

  1. Create a new ActivityLog Resource and extend the original, and just disable the resources link

namespace App\Nova;

class Activitylog extends \Bolechen\NovaActivitylog\Resources\Activitylog
{
    public static $displayInNavigation = false;

}
  1. Swap the model in the nova-activitylog.php config (publish it if you havent)
    'resource' => \App\Nova\ActivityLog::class,
    Now it will remove the link in the Resources section and only leave the link with the icon.

It worked for me.

I'm sorry for the inconvenience.For my own personal reasont, ican't have nova 4.x access, but thx for you help. I see the $displayInNavigation changed default to true by this PR #27 by @Kussie I want ask to Kussis, may I ask for your reasoning as to why you did what you did at the time?Does it need to be changed back?

Without that change at the time it wouldn't appear at all if i recall. Given this hasnt been an issue until recently i wonder if there has been a change in Nova that has altered the behaviour. I no longer use Nova so i'm not sure

@bolechen
Copy link
Owner

bolechen commented Dec 7, 2023

thx @Kussie response. i change the flag default to false.
Please try the latest version to see if it's working.
Thanks to all for your help.

@bolechen bolechen self-assigned this Dec 7, 2023
@brunocoelhosilva
Copy link
Author

@bolechen Thanks for your help.
However, when you set public static $displayInNavigation = false; both items in the menu disappear. My solution for now is to put public static $displayInNavigation = true; and remove new NovaActivitylog() from the tools method in NovaServiceProvider.php

@bolechen bolechen reopened this Dec 8, 2023
@bolechen bolechen added the help wanted Extra attention is needed label Dec 8, 2023
@bolechen
Copy link
Owner

bolechen commented Dec 8, 2023

It looks like Nova 4 has refactored the Tools menu, since I personally don't have access to it, I'm hoping some kind soul can submit a PR, here's a link to the official instructions I found on it:

Customized Main Menu
If you have [customized Nova's main sidebar menu](https://nova.laravel.com/docs/menus.html#customizing-the-main-menu), a link to your tool will not automatically display in Nova's sidebar. You will need to manually define your tool's menu inside your custom Nova::mainMenu callback.

@ref https://nova.laravel.com/docs/customization/tools.html#navigation

Hide navigation link only in Resources and not everywhere:
laravel/nova-issues#4368

@bolechen bolechen added the bug Something isn't working label Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants