Fixes #5931, show breadcrumb for new content

Could probably do with adding "Untitled" to translation file

(cherry picked from commit 249126a2b5)
This commit is contained in:
Matt Brailsford
2019-07-18 11:01:46 +01:00
committed by Sebastiaan Janssen
parent ea591c87a2
commit 802e6d7979

View File

@@ -27,13 +27,18 @@
editorState.set($scope.content);
//We fetch all ancestors of the node to generate the footer breadcrumb navigation
if (!$scope.page.isNew) {
if (content.parentId && content.parentId !== -1) {
entityResource.getAncestors(content.id, "document")
.then(function (anc) {
$scope.ancestors = anc;
});
if (content.parentId && content.parentId !== -1) {
var ancestorIds = content.path.split(',');
ancestorIds.shift(); // Remove -1
if ($scope.page.isNew) {
ancestorIds.pop(); // Remove 0
}
entityResource.getByIds(ancestorIds, 'document').then(function (anc) {
$scope.ancestors = anc;
if ($scope.page.isNew) {
$scope.ancestors.push({ name: "Untitled" })
}
});
}
evts.push(eventsService.on("editors.content.changePublishDate", function (event, args) {