mirror of
https://github.com/nasa/openmct.git
synced 2025-04-21 09:31:24 +00:00
[Context] Back Arrow
Checks the Back Arrow in both checkRoot and navigateToParent, also checks grandparent in both. This allows the back arrow to hide in search when context is unavailable.
This commit is contained in:
parent
8c4c65241a
commit
48136c2265
platform/commonUI/browse
@ -23,6 +23,6 @@
|
||||
<!-- Back Arrow Icon used on mobile-->
|
||||
<a ng-controller="BrowseController"
|
||||
class='type-icon icon ui-symbol s-back'
|
||||
ng-click='backArrow()'
|
||||
ng-class="checkRoot(); atRoot ? 'hidden' : ''">{
|
||||
ng-class="checkRoot(); atRoot ? 'hidden' : ''"
|
||||
ng-click='backArrow()'>{
|
||||
</a>
|
||||
|
@ -134,28 +134,44 @@ define(
|
||||
// is not the root, then user is navigated to
|
||||
// parent
|
||||
function navigateToParent() {
|
||||
var parent = navigationService.getNavigation().getCapability('context').getParent(),
|
||||
grandparent;
|
||||
if (parent.getId() !== ROOT_ID) {
|
||||
grandparent = parent.getCapability('context').getParent().getId();
|
||||
navigateTo(parent);
|
||||
if (grandparent && grandparent !== ROOT_ID) {
|
||||
$scope.atRoot = false;
|
||||
} else {
|
||||
$scope.atRoot = true;
|
||||
var context = navigationService.getNavigation().getCapability('context'),
|
||||
parentContext,
|
||||
parent,
|
||||
grandparentId;
|
||||
|
||||
// Checks if the current object has a context
|
||||
if (context) {
|
||||
parent = context.getParent();
|
||||
parentContext = parent.getCapability('context');
|
||||
if ((parent.getId() !== ROOT_ID) && parentContext) {
|
||||
grandparentId = parentContext.getParent().getId();
|
||||
navigateTo(parent);
|
||||
if (grandparentId && grandparentId !== ROOT_ID) {
|
||||
$scope.atRoot = false;
|
||||
} else {
|
||||
$scope.atRoot = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$scope.atRoot = true;
|
||||
}
|
||||
}
|
||||
|
||||
function checkRoot() {
|
||||
var context = navigationService.getNavigation().getCapability('context'),
|
||||
parent;
|
||||
parentContext,
|
||||
parent,
|
||||
grandparent;
|
||||
|
||||
// Checks if the current object has a context
|
||||
if (context) {
|
||||
parent = context.getParent();
|
||||
if (parent.getId() !== ROOT_ID) {
|
||||
$scope.atRoot = false;
|
||||
parentContext = parent.getCapability('context');
|
||||
if ((parent.getId() !== ROOT_ID) && parentContext) {
|
||||
grandparent = parentContext.getParent();
|
||||
if (!grandparent) {
|
||||
$scope.atRoot = true;
|
||||
} else {
|
||||
$scope.atRoot = false;
|
||||
}
|
||||
} else {
|
||||
$scope.atRoot = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user