V8: Add back button to listviews in media (#5116)

This commit is contained in:
Kenn Jacobsen
2019-04-22 10:00:51 +02:00
committed by Sebastiaan Janssen
parent 59df7f1399
commit 8b6fbee47e
2 changed files with 15 additions and 2 deletions

View File

@@ -14,7 +14,9 @@
hide-description="true"
hide-alias="true"
navigation="content.apps"
on-select-navigation-item="appChanged(item)">
on-select-navigation-item="appChanged(item)"
show-back-button="showBack()"
on-back="onBack()">
</umb-editor-header>
<umb-editor-container>

View File

@@ -9,7 +9,7 @@
function mediaEditController($scope, $routeParams, $q, appState, mediaResource,
entityResource, navigationService, notificationsService, localizationService,
serverValidationManager, contentEditingHelper, fileManager, formHelper,
editorState, umbRequestHelper, $http, eventsService) {
editorState, umbRequestHelper, $http, eventsService, $location) {
var evts = [];
var nodeId = null;
@@ -279,6 +279,17 @@ function mediaEditController($scope, $routeParams, $q, appState, mediaResource,
}
}
$scope.showBack = function () {
return !infiniteMode && !!$scope.page.listViewPath;
}
/** Callback for when user clicks the back-icon */
$scope.onBack = function() {
if ($scope.page.listViewPath) {
$location.path($scope.page.listViewPath);
}
};
//ensure to unregister from all events!
$scope.$on('$destroy', function () {
for (var e in evts) {