Reload node children after publishing with descendants

This commit is contained in:
Kenn Jacobsen
2019-10-06 09:32:18 +02:00
committed by Sebastiaan Janssen
parent 426aa981f8
commit 8fa3ebdd04

View File

@@ -4,7 +4,7 @@
function ContentEditController($rootScope, $scope, $routeParams, $q, $window,
appState, contentResource, entityResource, navigationService, notificationsService,
serverValidationManager, contentEditingHelper, localizationService, formHelper, umbRequestHelper,
editorState, $http, eventsService, overlayService, $location, localStorageService) {
editorState, $http, eventsService, overlayService, $location, localStorageService, treeService) {
var evts = [];
var infiniteMode = $scope.infiniteModel && $scope.infiniteModel.infiniteMode;
@@ -305,7 +305,7 @@
}
/** Syncs the content item to it's tree node - this occurs on first load and after saving */
function syncTreeNode(content, path, initialLoad) {
function syncTreeNode(content, path, initialLoad, reloadChildren) {
if (infiniteMode || !path) {
return;
@@ -315,6 +315,9 @@
navigationService.syncTree({ tree: $scope.treeAlias, path: path.split(","), forceReload: initialLoad !== true })
.then(function (syncArgs) {
$scope.page.menu.currentNode = syncArgs.node;
if (reloadChildren && syncArgs.node.expanded) {
treeService.loadNodeChildren({node: syncArgs.node});
}
}, function () {
//handle the rejection
console.log("A problem occurred syncing the tree! A path is probably incorrect.")
@@ -446,7 +449,7 @@
//needs to be manually set for infinite editing mode
$scope.page.isNew = false;
syncTreeNode($scope.content, data.path);
syncTreeNode($scope.content, data.path, false, args.reloadChildren);
eventsService.emit("content.saved", { content: $scope.content, action: args.action });
@@ -851,7 +854,8 @@
return contentResource.publishWithDescendants(content, create, model.includeUnpublished, files, showNotifications);
},
action: "publishDescendants",
showNotifications: false
showNotifications: false,
reloadChildren: model.includeUnpublished
}).then(function (data) {
//show all notifications manually here since we disabled showing them automatically in the save method
formHelper.showNotifications(data);