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

Active menu is wrong #3764

Closed
maganius opened this issue Jun 29, 2021 · 7 comments
Closed

Active menu is wrong #3764

maganius opened this issue Jun 29, 2021 · 7 comments

Comments

@maganius
Copy link

maganius commented Jun 29, 2021

The active menu of backpack is wrong if you have an external link.

For example:

If you have 3 menu (Plans, Users, Google)

Google menu is active by default (its wrong).

If you enter in Plans and edit an item the Google menu is active with Plan.

Image of example.

image

In the image only "Planes" need be active.

@pxpm
Copy link
Contributor

pxpm commented Jul 3, 2021

Hello @maganius thanks for the report.

Unfortunatelly I could not reproduce your issue:

<li class="nav-item"><a class="nav-link" href="{{ backpack_url('dashboard') }}"><i class="la la-home nav-icon"></i> {{ trans('backpack::base.dashboard') }}</a></li>
<li class='nav-item'><a class='nav-link' href='{{ backpack_url('bazinga') }}'><i class='nav-icon la la-question'></i> Bazingas</a></li>
<li class='nav-item'><a class='nav-link' href='https://google.com'><i class='nav-icon la la-question'></i> external</a></li>

image

I see you changed sidebard css so I guess is something wrong with your code.

If not, please help me here to reproduce it :)

Thanks again,
Pedro

@maganius
Copy link
Author

maganius commented Jul 3, 2021

@pxpm you need edit an entry, not in the list, try it

@pxpm
Copy link
Contributor

pxpm commented Jul 4, 2021

I am sorry @maganius but that does not allow to reproduce it too.

image

Anything else I should try ?

Thanks,
Pedro

@maganius
Copy link
Author

maganius commented Jul 5, 2021

its strange, I have this versions:

PHP 7.4.16 (cli) (built: Mar 25 2021 12:56:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies

LARAVEL VERSION:

v8.48.1@edc138060a13c9e5f15c005fad5f6a39b4ccf5fa

BACKPACK VERSION:

4.1.48@53bc6028f445f9b2ecfb8893283f6b6087539353

This is my menu

<li class='nav-item'><a class='nav-link' href='{{ backpack_url('user') }}'><i class='nav-icon la la-user'></i> Usuarios</a></li>
<li class='nav-item'><a class='nav-link' href='{{ backpack_url('company') }}'><i class='nav-icon la la-briefcase'></i> Empresas</a></li>
<li class='nav-item'><a class='nav-link' href='{{ backpack_url('plan') }}'><i class='nav-icon la la-chart-line'></i> Planes</a></li>
<li class='nav-item'><a class='nav-link' href='{{ backpack_url('device') }}'><i class='nav-icon la la-desktop'></i> Dispositivos</a></li>
<li class='nav-item'><a class='nav-link' href='{{ route('home') }}' target="_blank"><i class='nav-icon la la-sign-in-alt'></i> Visitar sitio</a></li>

image

I don't know exactly why when I edit any entry my external link is set as active also.

@pxpm
Copy link
Contributor

pxpm commented Aug 26, 2021

Hello @maganius

I think I can't be much more help here, as I am unable to reproduce it.

One thing I noticed is that you use ' (single quote) instead of " (double quote), maybe the problem is there?

I am going to close this, please feel free to continue the discussion or re-open if you see fit.

Wish you the best,
Pedro

@pxpm pxpm closed this as completed Aug 26, 2021
@tabacitu
Copy link
Member

@maganius maybe the output of route('home') and backpack_url('plan') is similar - indeed if too much of the resulting URLs is similar, the JS might make two menus active instead of one. What's their output?

Cheers!

@shaheen2013
Copy link

shaheen2013 commented Sep 14, 2023

@pxpm if you make two crud operation or suppose two side bar has prefix same name like
href="{{ backpack_url('dashboard-dashboard') }}"
href='{{ backpack_url('dashboard-bazinga') }}'>
I mean two sidebars' url prefix are same and after the hyphen has a different name, then this issue has arisen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants