From 191b265f940d95441b4ab045fd381920c3e4f3a1 Mon Sep 17 00:00:00 2001 From: Aaron Sadler Date: Mon, 16 Aug 2021 10:18:55 +0100 Subject: [PATCH] Fixed collapse/expand toggle button to reflect on load state --- TestSite.V9/App_Plugins/UmbNav/js/umbnav.controller.js | 5 +++-- TestSite.V9/App_Plugins/UmbNav/views/editor.html | 4 ++-- TestSite/App_Plugins/UmbNav/js/umbnav.controller.js | 5 +++-- TestSite/App_Plugins/UmbNav/views/editor.html | 4 ++-- src/UmbNav.Web/App_Plugins/UmbNav/js/umbnav.controller.js | 5 +++-- src/UmbNav.Web/App_Plugins/UmbNav/views/editor.html | 4 ++-- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/TestSite.V9/App_Plugins/UmbNav/js/umbnav.controller.js b/TestSite.V9/App_Plugins/UmbNav/js/umbnav.controller.js index 595bb25..2082b56 100644 --- a/TestSite.V9/App_Plugins/UmbNav/js/umbnav.controller.js +++ b/TestSite.V9/App_Plugins/UmbNav/js/umbnav.controller.js @@ -35,10 +35,11 @@ }); }; - vm.toggleVar = false; + + vm.toggleVar = vm.items.some((element) => element.collapsed === false); $scope.toggleCollapse = function () { vm.toggleVar = !vm.toggleVar; - if (vm.toggleVar) { + if (!vm.toggleVar) { $scope.$broadcast('angular-ui-tree:collapse-all'); } else { $scope.$broadcast('angular-ui-tree:expand-all'); diff --git a/TestSite.V9/App_Plugins/UmbNav/views/editor.html b/TestSite.V9/App_Plugins/UmbNav/views/editor.html index 20184df..a807a23 100644 --- a/TestSite.V9/App_Plugins/UmbNav/views/editor.html +++ b/TestSite.V9/App_Plugins/UmbNav/views/editor.html @@ -2,10 +2,10 @@
diff --git a/TestSite/App_Plugins/UmbNav/js/umbnav.controller.js b/TestSite/App_Plugins/UmbNav/js/umbnav.controller.js index 595bb25..2082b56 100644 --- a/TestSite/App_Plugins/UmbNav/js/umbnav.controller.js +++ b/TestSite/App_Plugins/UmbNav/js/umbnav.controller.js @@ -35,10 +35,11 @@ }); }; - vm.toggleVar = false; + + vm.toggleVar = vm.items.some((element) => element.collapsed === false); $scope.toggleCollapse = function () { vm.toggleVar = !vm.toggleVar; - if (vm.toggleVar) { + if (!vm.toggleVar) { $scope.$broadcast('angular-ui-tree:collapse-all'); } else { $scope.$broadcast('angular-ui-tree:expand-all'); diff --git a/TestSite/App_Plugins/UmbNav/views/editor.html b/TestSite/App_Plugins/UmbNav/views/editor.html index 20184df..a807a23 100644 --- a/TestSite/App_Plugins/UmbNav/views/editor.html +++ b/TestSite/App_Plugins/UmbNav/views/editor.html @@ -2,10 +2,10 @@
diff --git a/src/UmbNav.Web/App_Plugins/UmbNav/js/umbnav.controller.js b/src/UmbNav.Web/App_Plugins/UmbNav/js/umbnav.controller.js index 595bb25..2082b56 100644 --- a/src/UmbNav.Web/App_Plugins/UmbNav/js/umbnav.controller.js +++ b/src/UmbNav.Web/App_Plugins/UmbNav/js/umbnav.controller.js @@ -35,10 +35,11 @@ }); }; - vm.toggleVar = false; + + vm.toggleVar = vm.items.some((element) => element.collapsed === false); $scope.toggleCollapse = function () { vm.toggleVar = !vm.toggleVar; - if (vm.toggleVar) { + if (!vm.toggleVar) { $scope.$broadcast('angular-ui-tree:collapse-all'); } else { $scope.$broadcast('angular-ui-tree:expand-all'); diff --git a/src/UmbNav.Web/App_Plugins/UmbNav/views/editor.html b/src/UmbNav.Web/App_Plugins/UmbNav/views/editor.html index 20184df..a807a23 100644 --- a/src/UmbNav.Web/App_Plugins/UmbNav/views/editor.html +++ b/src/UmbNav.Web/App_Plugins/UmbNav/views/editor.html @@ -2,10 +2,10 @@