[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:
@@ -23,6 +23,6 @@
|
|||||||
<!-- Back Arrow Icon used on mobile-->
|
<!-- Back Arrow Icon used on mobile-->
|
||||||
<a ng-controller="BrowseController"
|
<a ng-controller="BrowseController"
|
||||||
class='type-icon icon ui-symbol s-back'
|
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>
|
</a>
|
||||||
|
|||||||
@@ -134,28 +134,44 @@ define(
|
|||||||
// is not the root, then user is navigated to
|
// is not the root, then user is navigated to
|
||||||
// parent
|
// parent
|
||||||
function navigateToParent() {
|
function navigateToParent() {
|
||||||
var parent = navigationService.getNavigation().getCapability('context').getParent(),
|
var context = navigationService.getNavigation().getCapability('context'),
|
||||||
grandparent;
|
parentContext,
|
||||||
if (parent.getId() !== ROOT_ID) {
|
parent,
|
||||||
grandparent = parent.getCapability('context').getParent().getId();
|
grandparentId;
|
||||||
navigateTo(parent);
|
|
||||||
if (grandparent && grandparent !== ROOT_ID) {
|
// Checks if the current object has a context
|
||||||
$scope.atRoot = false;
|
if (context) {
|
||||||
} else {
|
parent = context.getParent();
|
||||||
$scope.atRoot = true;
|
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() {
|
function checkRoot() {
|
||||||
var context = navigationService.getNavigation().getCapability('context'),
|
var context = navigationService.getNavigation().getCapability('context'),
|
||||||
parent;
|
parentContext,
|
||||||
|
parent,
|
||||||
|
grandparent;
|
||||||
|
|
||||||
|
// Checks if the current object has a context
|
||||||
if (context) {
|
if (context) {
|
||||||
parent = context.getParent();
|
parent = context.getParent();
|
||||||
if (parent.getId() !== ROOT_ID) {
|
parentContext = parent.getCapability('context');
|
||||||
$scope.atRoot = false;
|
if ((parent.getId() !== ROOT_ID) && parentContext) {
|
||||||
|
grandparent = parentContext.getParent();
|
||||||
|
if (!grandparent) {
|
||||||
|
$scope.atRoot = true;
|
||||||
|
} else {
|
||||||
|
$scope.atRoot = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$scope.atRoot = true;
|
$scope.atRoot = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user