Added an active css class for Umbraco Tree items (#3056)

This commit is contained in:
Mark Drake
2018-09-30 07:38:19 -04:00
committed by Sebastiaan Janssen
parent f36139619a
commit c5de33dcae
3 changed files with 15 additions and 4 deletions

View File

@@ -18,7 +18,7 @@
</example>
*/
angular.module("umbraco.directives")
.directive('umbTreeItem', function ($compile, $http, $templateCache, $interpolate, $log, $location, $rootScope, $window, treeService, $timeout, localizationService) {
.directive('umbTreeItem', function ($compile, $http, $templateCache, $interpolate, $log, $location, $rootScope, $window, treeService, $timeout, localizationService, appState) {
return {
restrict: 'E',
replace: true,
@@ -132,7 +132,15 @@ angular.module("umbraco.directives")
}
if (node.selected) {
css.push("umb-tree-node-checked");
}
}
//is this the current action node (this is not the same as the current selected node!)
var actionNode = appState.getMenuState("currentNode");
if(actionNode) {
if(actionNode.id === node.id) {
css.push("active");
}
}
return css.join(" ");
};

View File

@@ -73,6 +73,7 @@ function navigationService($rootScope, $routeParams, $log, $location, $q, $timeo
appState.setSectionState("showSearchResults", false);
appState.setGlobalState("stickyNavigation", false);
appState.setGlobalState("showTray", false);
appState.setMenuState("currentNode", null);
if (appState.getGlobalState("isTablet") === true) {
appState.setGlobalState("showNavigation", false);
@@ -347,7 +348,8 @@ function navigationService($rootScope, $routeParams, $log, $location, $q, $timeo
if (appState.getGlobalState("isTablet") === true && !appState.getGlobalState("stickyNavigation")) {
//reset it to whatever is in the url
appState.setSectionState("currentSection", $routeParams.section);
appState.setSectionState("currentSection", $routeParams.section);
setMode("default-hidesectiontree");
}

View File

@@ -185,7 +185,8 @@
line-height: 16px;
}
.umb-tree div:hover {
.umb-tree div:hover,
.umb-tree div.active {
background: @gray-10;
}