Laravel-Backpack / CRUD

Build custom admin panels. Fast!
https://backpackforlaravel.com
MIT License
3.18k stars 897 forks source link

[Enhancement] generalize active menu highlight feature #5217

Open pxpm opened 1 year ago

pxpm commented 1 year ago

We have a little problem in our active menu highlight feature.

At the moment each theme implements their own active menu selector script, that leads to inconsistencies and bugs that happen in one theme, but work in other.

We still have a problem that menu-item and menu-item?active=1 don't work properly when used as menu urls, and to fix it, we need to push a fix to multiple places.

Ideally we would create a script that can be used by any theme, centralized in CRUD project.

Tabler - https://github.com/Laravel-Backpack/theme-tabler/blob/2e42a5a04d09adb471878e0cf9b037b02025a30c/resources/assets/js/tabler.js#L6

CoreUI v4 - ??? This commit removed the code: https://github.com/Laravel-Backpack/theme-coreuiv4/commit/186ce280326d8ac06081308ceb2ef13e0d122342#diff-dc68994fe916561a3ed4f9f83658f0ee593f26c61d2d3cea03c1497a9b4da20f

I tried to search the repo for some removed code but couldn't find it: https://github.com/search?q=repo%3ALaravel-Backpack%2Ftheme-coreuiv4%20sidebarTransition&type=code

CoreUI v2 - https://github.com/Laravel-Backpack/theme-coreuiv2/blob/0c66d9a17bc0010335319b080004800a8bd40f8c/resources/views/inc/sidebar.blade.php#L62

Let me know what you think about this @tabacitu

Cheers

tabacitu commented 1 year ago

Hmm...

😀

I think some JS in our "UI" is inevitable, and could be useful to theme developers yes:

I'll think about this again when I finish the Bootstrap theme (1-2 weeks).