refactors showSearchResults to be part of appState

This commit is contained in:
Shannon
2013-11-13 14:25:07 +11:00
parent 5889140386
commit 5d49dfbe28
4 changed files with 13 additions and 5 deletions

View File

@@ -20,7 +20,8 @@ function appState($rootScope) {
var sectionState = {
//The currently active section
currentSection: null
currentSection: null,
showSearchResults: null
};
var treeState = {

View File

@@ -26,7 +26,6 @@ function navigationService($rootScope, $routeParams, $log, $location, $q, $timeo
showContextMenu: false,
stickyNavigation: false,
showTray: false,
showSearchResults: false,
currentSection: undefined,
currentPath: undefined,
currentTree: undefined,
@@ -79,7 +78,7 @@ function navigationService($rootScope, $routeParams, $log, $location, $q, $timeo
ui.stickyNavigation = false;
ui.showNavigation = true;
ui.showContextMenu = false;
ui.showSearchResults = true;
appState.setSectionState("showSearchResults", true);
appState.setMenuState("showMenu", false);
$timeout(function() {
@@ -91,7 +90,7 @@ function navigationService($rootScope, $routeParams, $log, $location, $q, $timeo
ui.currentMode = "default";
ui.showContextMenu = false;
appState.setMenuState("showMenu", false);
ui.showSearchResults = false;
appState.setSectionState("showSearchResults", false);
ui.stickyNavigation = false;
ui.showTray = false;

View File

@@ -18,6 +18,7 @@ function NavigationController($scope,$rootScope, $location, $log, $routeParams,
//set up our scope vars
$scope.showContextMenuDialog = false;
$scope.showSearchResults = false;
//wire up the screensize and tree mode detection
navigationService.init();
@@ -53,6 +54,13 @@ function NavigationController($scope,$rootScope, $location, $log, $routeParams,
$scope.showContextMenuDialog = args.value;
}
});
//Listen for section state changes
$scope.$on("appState.sectionState.changed", function (e, args) {
if (args.key === "showSearchResults") {
$scope.showSearchResults = args.value;
}
});
//This reacts to clicks passed to the body element which emits a global call to close all dialogs
$rootScope.$on("closeDialogs", function (event) {

View File

@@ -29,7 +29,7 @@
</div>
<!-- Search results -->
<div id="search-results" class="umb-modalcolumn-body" ng-show="nav.ui.showSearchResults">
<div id="search-results" class="umb-modalcolumn-body" ng-show="showSearchResults">
<ul class="umb-tree">
<li class="root">