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 item on menu items having route with any parameter #34

Open
fractefactos opened this issue Jul 28, 2015 · 7 comments
Open

Active item on menu items having route with any parameter #34

fractefactos opened this issue Jul 28, 2015 · 7 comments

Comments

@fractefactos
Copy link

Can i configure a menu item with route as this:
'page_show/{id}'

The problem i have: The item not setting the "active" attribute

@gravitano
Copy link
Member

Try set active state via active attribute:

$menu->route('page', 'Page 1', [1], [
   'active' => function() { 
      return URL::full() == route('page', 1);
   }
]);

@fractefactos
Copy link
Author

Hi @gravitano,

Thanks for your response but i want return "active" state with any value of $id in my route:
page_show/{id}

@LonnyX
Copy link

LonnyX commented Dec 8, 2015

hi @dr-martin, @gravitano did one of you find a solution for this? I have the same issue

@fractefactos
Copy link
Author

@LonnyX Not yet, i changed this library for my purposes.

@LonnyX
Copy link

LonnyX commented Dec 10, 2015

It would be nice if you can share your purposes, it can help some poeple 👍

@fractefactos
Copy link
Author

@LonnyX this problem is the most important limitation for me

@irineujunior
Copy link

@dr-martin @LonnyX that's my solution

        Menu::modify('adminlte-sidebar', function($menu)
        {
            $menu->setView('vendor.pingpong.menus.adminlte.default');
            $menu->dropdown('Imóveis', function ($sub) {
                $sub->route('admin.properties.finalities.index', 'Finalidade', [], 1
                    , ['icon' => 'fa fa-circle-o', 'active' => function() {
                        $url = parse_url(route('admin.properties.finalities.index'));
                        $path = trim($url['path'], '/');
                        return request()->is($path . '*');
                    }]);
            }, 20, ['icon' => 'fa fa-home']);

        });

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

No branches or pull requests

4 participants