From c6a43f755d4e3380f4ad898780ac4c566dc166d1 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 13 Aug 2020 16:33:02 +0200 Subject: [PATCH] fix issue with empty cat --- appinfo/info.xml | 2 +- lib/Controller/NavController.php | 6 +++++- src/SideMenuBig.vue | 12 ++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index 2541f1f..b005569 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -15,7 +15,7 @@ You can report a bug or request a feature by opening an issue. ]]> agpl Simon Vieille - 1.8.0-rc1 + 1.8.0-rc2 SideMenu customization https://gitnet.fr/deblan/side_menu diff --git a/lib/Controller/NavController.php b/lib/Controller/NavController.php index 4e0751c..3b807a4 100644 --- a/lib/Controller/NavController.php +++ b/lib/Controller/NavController.php @@ -188,7 +188,11 @@ class NavController extends Controller } foreach ($items as $category => $value) { - ksort($items[$category]['apps']); + if (empty($items[$category]['apps'])) { + unset($items[$category]); + } else { + ksort($items[$category]['apps']); + } } usort($items, function ($a, $b) { diff --git a/src/SideMenuBig.vue b/src/SideMenuBig.vue index 67b4787..6574f36 100644 --- a/src/SideMenuBig.vue +++ b/src/SideMenuBig.vue @@ -61,13 +61,13 @@ export default { .then(function(response) { that.items = response.data.items - let apps = [] + let apps = [] - for (let category of that.items) { - for (let app of category.apps) { - apps.push(app) - } - } + for (let category of that.items) { + for (let app of category.apps) { + apps.push(app) + } + } jQuery('body').trigger('side-menu.apps', [apps]) });