Fixes creating content type collections

This commit is contained in:
Shannon
2018-11-20 18:43:41 +11:00
parent fad566afba
commit 82e7be4ae9
2 changed files with 24 additions and 21 deletions

View File

@@ -76,32 +76,33 @@ function DocumentTypesCreateController($scope, $location, navigationService, con
}
}
contentTypeResource.createCollection(node.id, $scope.model.collectionName, $scope.model.collectionCreateTemplate, $scope.model.collectionItemName, $scope.model.collectionItemCreateTemplate, collectionIcon, collectionItemIcon).then(function (collectionData) {
contentTypeResource.createCollection(node.id, $scope.model.collectionName, $scope.model.collectionCreateTemplate, $scope.model.collectionItemName, $scope.model.collectionItemCreateTemplate, collectionIcon, collectionItemIcon)
.then(function (collectionData) {
navigationService.hideMenu();
$location.search('create', null);
$location.search('notemplate', null);
navigationService.hideMenu();
$location.search('create', null);
$location.search('notemplate', null);
formHelper.resetForm({
scope: $scope
});
formHelper.resetForm({
scope: $scope
});
var section = appState.getSectionState("currentSection");
var section = appState.getSectionState("currentSection");
// redirect to the item id
$location.path("/settings/documenttypes/edit/" + collectionData.itemId);
// redirect to the item id
$location.path("/" + section + "/documenttypes/edit/" + collectionData.containerId);
}, function (err) {
}, function (err) {
$scope.error = err;
$scope.error = err;
//show any notifications
if (angular.isArray(err.data.notifications)) {
for (var i = 0; i < err.data.notifications.length; i++) {
notificationsService.showNotification(err.data.notifications[i]);
//show any notifications
if (angular.isArray(err.data.notifications)) {
for (var i = 0; i < err.data.notifications.length; i++) {
notificationsService.showNotification(err.data.notifications[i]);
}
}
}
});
});
});
}

View File

@@ -463,9 +463,11 @@
/** Syncs the content type to it's tree node - this occurs on first load and after saving */
function syncTreeNode(dt, path, initialLoad) {
navigationService.syncTree({ tree: "documenttypes", path: path.split(","), forceReload: initialLoad !== true }).then(function (syncArgs) {
vm.currentNode = syncArgs.node;
});
const args = { tree: "documenttypes", path: path.split(","), forceReload: initialLoad !== true };
navigationService.syncTree(args)
.then(function (syncArgs) {
vm.currentNode = syncArgs.node;
});
}
function close() {