[Mobile] Phone Portrait Close

Used merged function to close the
left tree on selection of an object
on phone portrait.
This commit is contained in:
Shivam Dave 2015-08-28 13:38:29 -07:00
parent 0521b09bec
commit 8e6505c80f

View File

@ -50,12 +50,12 @@ define(
function updateRoute(domainObject) {
var priorRoute = $route.current,
// Act as if params HADN'T changed to avoid page reload
// Act as if params HADN'T changed to avoid page reload
unlisten;
unlisten = $scope.$on('$locationChangeSuccess', function () {
// Checks path to make sure /browse/ is at front
// if so, change $route.current
// if so, change $route.current
if ($location.path().indexOf("/browse/") === 0) {
$route.current = priorRoute;
}
@ -127,8 +127,8 @@ define(
navigateTo(domainObject);
}
}
// Uses the current navigation to get the
// Uses the current navigation to get the
// current ContextCapability, then the
// parent is gotten from that. If the parent
// is not the root, then user is navigated to
@ -138,23 +138,22 @@ define(
parentContext,
parent,
grandparentId;
// Checks if the current object has a context
if (context) {
// Sets the parent and the parent context
// which is checked
parent = context.getParent();
parentContext = parent.getCapability('context');
if ((parent.getId() !== ROOT_ID) && parentContext) {
// Gets the grandparent id
grandparentId = parentContext.getParent().getId();
// Navigates to the parent
navigateTo(parent);
// Checks after navigation if the user is located at the
// Checks after navigation if the user is located at the
// root (grandparent of original selected object, after
// navigation, user is at parent of original object and
// child of grandparent)
@ -162,27 +161,27 @@ define(
$scope.atRoot = false;
return;
}
// Set at root if no grandparent exists and
// if grandparent is ROOT, after navigation
$scope.atRoot = true;
}
}
}
function checkRoot() {
var context = navigationService.getNavigation().getCapability('context'),
parentContext,
parent,
grandparent;
// Checks if the current object has a context
if (context) {
parent = context.getParent();
parentContext = parent.getCapability('context');
if ((parent.getId() !== ROOT_ID) && parentContext) {
grandparent = parentContext.getParent();
// Checks if the grandparent exists
// if it does not exist (for example in search),
// than do not show the back button
@ -192,12 +191,11 @@ define(
}
}
}
// In any other situation where the context or parent
// context does not exist or the user is at ROOT, than
// hide the back arrow
$scope.atRoot = true;
}
// Load the root object, put it in the scope.
@ -214,12 +212,6 @@ define(
selectedObject: navigationService.getNavigation()
};
// SlideMenu boolean used to hide and show
// tree menu
$scope.treeSlide = function () {
$scope.treeClass = !$scope.treeClass;
};
// Provide a model for the left pane
$scope.paneModel = {
selectedObject: navigationService.getNavigation()
@ -235,11 +227,11 @@ define(
$scope.$on("$destroy", function () {
navigationService.removeListener(setNavigation);
});
// If the user has selected an object (and is portrait
// on a phone), then hide the tree menu
$scope.$on("select-obj", function () {
//$scope.treeSlide();
$scope.paneModel = !$scope.paneModel;
});
$scope.backArrow = navigateToParent;