AdminLTEBundle icon indicating copy to clipboard operation
AdminLTEBundle copied to clipboard

Support for Top Horizontal (Sub)Menu

Open tacman opened this issue 5 years ago • 9 comments

I'm trying to implement the top menu from adminlte in the bundle.

image

But the top navbar isn't rendering right:

image

https://shakespeare-plays.herokuapp.com/typography

My request is that the bundle add a KnpTopMenuEvent that renders a top menu, similar to the sidebar.

I've implemented it, but couldn't get the classes to look right, and it feels a bit hacky.

image

https://shakespeare-plays.herokuapp.com/work/text/12night

// TopMenuBuilder.php

    public function createTopMenu(array $options)
    {

        $menu = $this->factory->createItem('root', [
            'childrenAttributes' => ['class' => 'nav navbar-nav navbar-sm'],
        ]);

        $childOptions = [
            'attributes' => ['class' => 'navbar-item'],
            'childrenAttributes' => ['class' => 'navbar-item'],
            'labelAttributes' => [],
        ];

        $this->eventDispatcher->dispatch(new KnpMenuEvent($menu, $this->factory, $options, $childOptions), 'topMenuEvent');


        return $menu;
    }

I tried putting it in to page_content_start, but that didn't work, so it's sort of hacked into a widget for now. Can you point me in the right direction on how to solve it? I'd love to add it to the AdminBundleDemo, too. Thanks.

tacman avatar May 10 '20 15:05 tacman

This top menu is ONLY available in AdminLTE v3, right?

Did you use the branch from #109 ?

kevinpapst avatar May 10 '20 15:05 kevinpapst

This branch, right?

    "kevinpapst/adminlte-bundle": "dev-adminlte-v3",

When I use that, I get

Key "bordered" for array with keys "collapsible_title, removable_title, type, collapsible, removable, solid" does not exist.

I'm reviewing the docs at https://github.com/kevinpapst/AdminLTEBundle/blob/adminlte-v3/Resources/docs/configurations.md, and can't find bordered. I'm sure my config is wrong, a while back I got it almost working, but it failed in knp_menu, so I went back to v3.

But I'd love to get this working with the new version! Can you post a admin_lte.yaml file that should work, and I'll try that?

tacman avatar May 10 '20 16:05 tacman

The demo has a v3 branch

kevinpapst avatar May 10 '20 16:05 kevinpapst

If you enable knpmenu in the demo, it fails with

Block "badge" on template "knp_menu_base.html.twig" does not exist.

On Sun, May 10, 2020 at 12:09 PM Kevin Papst [email protected] wrote:

The demo has a v3 branch

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kevinpapst/AdminLTEBundle/issues/134#issuecomment-626350935, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEXIQIZDCAUZG4FPFWTDLLRQ3GVPANCNFSM4M5JIAWQ .

tacman avatar May 10 '20 16:05 tacman

Something was recently changed regarding knp and badges and the master wasn't merged in v3 since then.

kevinpapst avatar May 10 '20 16:05 kevinpapst

If you merge it, I'll keep testing it, maybe we can release the adminlte-3 version? It seems quite nice.

On Sun, May 10, 2020 at 12:49 PM Kevin Papst [email protected] wrote:

Something was recently changed regarding knp and badges and the master wasn't merged in v3 since then.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kevinpapst/AdminLTEBundle/issues/134#issuecomment-626356398, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEXIQL7CBPV6GENFHSNNODRQ3LH5ANCNFSM4M5JIAWQ .

tacman avatar May 10 '20 17:05 tacman

Please? Sorry, I wish I knew git better and knew how to do it myself, but I don't.

tacman avatar May 10 '20 21:05 tacman

git checkout adminlte-v3
git merge master

I am not merging the PR, it is not complete.

kevinpapst avatar May 10 '20 21:05 kevinpapst

Can you merge master intro adminlte-3, push that branch? Then I'll can include the dev-adminlte-3 branch of the bundle.

Otherwise, I have to create my own fork and use that, right? That's what I tend to get goofed up on.

On a related note, would you consider making knp_menu enabled by default?

Thanks.

Tac

On Sun, May 10, 2020 at 5:42 PM Kevin Papst [email protected] wrote:

git checkout adminlte-v3 git merge master

I am not merging the PR, it is not complete.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kevinpapst/AdminLTEBundle/issues/134#issuecomment-626394082, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEXIQNHYYZ36VE6LK3Y5FTRQ4NU3ANCNFSM4M5JIAWQ .

tacman avatar May 10 '20 21:05 tacman