AdminLTEBundle icon indicating copy to clipboard operation
AdminLTEBundle copied to clipboard

Fix the KnpMenu template

Open cavasinf opened this issue 3 years ago • 4 comments

Description

ATM, the KnpMenu doesn't work. Note : Knp Breadcrumb neither..

Result with the knp_menu.md example:

  • Item header doesn't display :x:
  • Item header have a bad style :x:
  • Item parent (with child) have/need link :x:
  • Badges and arrow from items are wrongly positioned :x:
  • Wrong badge color used :x:
  • No animation from the arrow when opening an item :x:

KnpMenu

I've updated the template to match the AdminLTE 3 menu.

Template update (nothing too fancy):

  • Changed header item type class
  • Add item.label to header item display
  • Changed <a> for item with child (remove 'route' required param)
  • Changed badge item position & arrow item position

⚠️ Need to change your KnpMenuBuilderSubscriber.php for header items type from header to nav-header ⚠️ ->setAttribute('class', 'header');->setAttribute('class', 'nav-header'); ✔️

DOC update:

  • Changed Header item class
  • Remove route param for item with child
  • Changed badge color class
  • Add more generic examples with 'level' system

Result after FIX: KnpMenu_after

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [x] I updated the documentation (see here)
  • [x] I agree that this code is used in AdminLTEBundle and will be published under the MIT license

cavasinf avatar Nov 25 '21 09:11 cavasinf

ℹ️ Note ℹ️
I want to add the nav-legacy and nav-child-indent class to the menu.

The best way I've found to do it is inside KnpMenuBuilderSubscriber.php:

$menu->setChildrenAttribute('class', $menu->getChildrenAttribute('class') . " nav-legacy nav-child-indent");

Is that correct ?

cavasinf avatar Nov 25 '21 09:11 cavasinf

Please note that I can merge, but not answer your question as I am neither using this branch nor the KnpMenu.

kevinpapst avatar Nov 25 '21 11:11 kevinpapst

I am neither using this branch nor the KnpMenu.

I can see from your Demo Repo that you have a Knp Subscriber.

Did you do your tests from there for Knp ?

cavasinf avatar Nov 25 '21 12:11 cavasinf

Yes, I only used KNP in the demo app. But I guess many test/use cases were not implemented there.

kevinpapst avatar Nov 25 '21 12:11 kevinpapst

Closing: I will archive this repo now

kevinpapst avatar Dec 07 '23 12:12 kevinpapst