Merge pull request #1066 from umbraco/temp-U4-7847

Fixes: U4-7847 Do not allow folders to be created underneath content types (or data types)
This commit is contained in:
Shannon Deminick
2016-01-28 15:22:03 +01:00
2 changed files with 28 additions and 20 deletions

View File

@@ -9,6 +9,7 @@
function DocumentTypesCreateController($scope, $location, navigationService, contentTypeResource, formHelper, appState, notificationsService, localizationService) {
$scope.model = {
allowCreateFolder: $scope.dialogOptions.currentNode.parentId === null || $scope.dialogOptions.currentNode.nodeType === "container",
folderName: "",
creatingFolder: false,
};
@@ -18,21 +19,28 @@ function DocumentTypesCreateController($scope, $location, navigationService, con
$scope.showCreateFolder = function() {
$scope.model.creatingFolder = true;
}
};
$scope.createContainer = function () {
if (formHelper.submitForm({
scope: $scope,
formCtrl: this.createFolderForm,
statusMessage: localizeCreateFolder
})) {
contentTypeResource.createContainer(node.id, $scope.model.folderName).then(function (folderId) {
$scope.createContainer = function() {
if (formHelper.submitForm({scope: $scope, formCtrl: this.createFolderForm, statusMessage: localizeCreateFolder})) {
contentTypeResource.createContainer(node.id, $scope.model.folderName).then(function(folderId) {
navigationService.hideMenu();
var currPath = node.path ? node.path : "-1";
navigationService.syncTree({ tree: "documenttypes", path: currPath + "," + folderId, forceReload: true, activate: true });
formHelper.resetForm({ scope: $scope });
var currPath = node.path ? node.path : "-1";
navigationService.syncTree({
tree: "documenttypes",
path: currPath + "," + folderId,
forceReload: true,
activate: true
});
formHelper.resetForm({
scope: $scope
});
var section = appState.getSectionState("currentSection");
@@ -47,22 +55,22 @@ function DocumentTypesCreateController($scope, $location, navigationService, con
}
}
});
};
}
}
};
$scope.createDocType = function() {
$location.search('create', null);
$location.search('notemplate', null);
$location.path("/settings/documenttypes/edit/" + node.id).search("create", "true");
navigationService.hideMenu();
}
};
$scope.createComponent = function() {
$location.search('create', null);
$location.search('notemplate', null);
$location.path("/settings/documenttypes/edit/" + node.id).search("create", "true").search("notemplate", "true");
navigationService.hideMenu();
}
$location.search('create', null);
$location.search('notemplate', null);
$location.path("/settings/documenttypes/edit/" + node.id).search("create", "true").search("notemplate", "true");
navigationService.hideMenu();
};
}
angular.module('umbraco').controller("Umbraco.Editors.DocumentTypes.CreateController", DocumentTypesCreateController);

View File

@@ -20,7 +20,7 @@
<span class="menu-label"><localize key="create_documentTypeWithoutTemplate"></localize></span>
</a>
</li>
<li>
<li ng-if="model.allowCreateFolder">
<a href="" ng-click="showCreateFolder()">
<i class="large icon-folder"></i>
<span class="menu-label"><localize key="general_folder"></localize></span>