diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/contenttype.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/contenttype.resource.js index 01b6360d07..6acf702546 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/contenttype.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/contenttype.resource.js @@ -511,41 +511,8 @@ function contentTypeResource($q, $http, umbRequestHelper, umbDataFormatter, loca $http.post(umbRequestHelper.getApiUrl("contentTypeApiBaseUrl", "PostCreateContainer", { parentId: parentId, name: encodeURIComponent(name) })), 'Failed to create a folder under parent id ' + parentId); - }, - /** - * @ngdoc method - * @name umbraco.resources.contentTypeResource#createCollection - * @methodOf umbraco.resources.contentTypeResource - * - * @description - * Create a collection of a content types - * - * ##usage - *
-        * contentTypeResource.createCollection(1244,"testcollectionname",true,"collectionItemName",true,"icon-name","icon-name")
-        *    .then(function() {
-        *       Do stuff..
-        *    });
-        * 
- * - * @param {Int} parentId the ID of the parent content type underneath which to create the collection - * @param {String} collectionName the name of the collection - * @param {Boolean} collectionCreateTemplate true/false to specify whether to create a default template for the collection - * @param {String} collectionItemName the name of the collection item - * @param {Boolean} collectionItemCreateTemplate true/false to specify whether to create a default template for the collection item - * @param {String} collectionIcon the icon for the collection - * @param {String} collectionItemIcon the icon for the collection item - * @returns {Promise} resourcePromise object. - * - */ - createCollection: function (parentId, collectionName, collectionCreateTemplate, collectionItemName, collectionItemCreateTemplate, collectionIcon, collectionItemIcon) { - - return umbRequestHelper.resourcePromise( - $http.post(umbRequestHelper.getApiUrl("contentTypeApiBaseUrl", "PostCreateCollection", { parentId: parentId, collectionName: collectionName, collectionCreateTemplate: collectionCreateTemplate, collectionItemName: collectionItemName, collectionItemCreateTemplate: collectionItemCreateTemplate, collectionIcon: collectionIcon, collectionItemIcon: collectionItemIcon})), - 'Failed to create collection under ' + parentId); - - }, + }, /** * @ngdoc method diff --git a/src/Umbraco.Web.UI.Client/src/views/documenttypes/create.controller.js b/src/Umbraco.Web.UI.Client/src/views/documenttypes/create.controller.js index 71eee085ee..23173a404d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/documenttypes/create.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/documenttypes/create.controller.js @@ -11,8 +11,7 @@ function DocumentTypesCreateController($scope, $location, navigationService, con $scope.model = { allowCreateFolder: $scope.currentNode.parentId === null || $scope.currentNode.nodeType === "container", folderName: "", - creatingFolder: false, - creatingDoctypeCollection: false + creatingFolder: false }; var disableTemplates = Umbraco.Sys.ServerVariables.features.disabledFeatures.disableTemplates; @@ -24,12 +23,6 @@ function DocumentTypesCreateController($scope, $location, navigationService, con $scope.model.creatingFolder = true; }; - $scope.showCreateDocTypeCollection = function () { - $scope.model.creatingDoctypeCollection = true; - $scope.model.collectionCreateTemplate = !$scope.model.disableTemplates; - $scope.model.collectionItemCreateTemplate = !$scope.model.disableTemplates; - }; - $scope.createContainer = function () { if (formHelper.submitForm({ scope: $scope, formCtrl: $scope.createFolderForm })) { @@ -58,55 +51,7 @@ function DocumentTypesCreateController($scope, $location, navigationService, con }); } - }; - - $scope.createCollection = function () { - - if (formHelper.submitForm({ scope: $scope, formCtrl: this.createDoctypeCollectionForm, statusMessage: "Creating Doctype Collection..." })) { - - // see if we can find matching icons - var collectionIcon = "icon-folders", collectionItemIcon = "icon-document"; - iconHelper.getIcons().then(function (icons) { - - for (var i = 0; i < icons.length; i++) { - // for matching we'll require a full match for collection, partial match for item - if (icons[i].substring(5) == $scope.model.collectionName.toLowerCase()) { - collectionIcon = icons[i]; - } else if (icons[i].substring(5).indexOf($scope.model.collectionItemName.toLowerCase()) > -1) { - collectionItemIcon = icons[i]; - } - } - - 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); - - formHelper.resetForm({ scope: $scope, formCtrl: this.createDoctypeCollectionForm }); - - var section = appState.getSectionState("currentSection"); - - // redirect to the item id - $location.path("/" + section + "/documenttypes/edit/" + collectionData.containerId); - - }, function (err) { - - formHelper.resetForm({ scope: $scope, formCtrl: this.createDoctypeCollectionForm, hasErrors: true }); - $scope.error = err; - - //show any notifications - if (Utilities.isArray(err.data.notifications)) { - for (var i = 0; i < err.data.notifications.length; i++) { - notificationsService.showNotification(err.data.notifications[i]); - } - } - }); - }); - } - - }; + }; // Disabling logic for creating document type with template if disableTemplates is set to true if (!disableTemplates) { @@ -125,6 +70,22 @@ function DocumentTypesCreateController($scope, $location, navigationService, con navigationService.hideMenu(); }; + $scope.createComposition = function () { + $location.search('create', null); + $location.search('notemplate', null); + $location.search('iscomposition', null); + $location.path("/settings/documenttypes/edit/" + node.id).search("create", "true").search("notemplate", "true").search("iscomposition", "true"); + navigationService.hideMenu(); + }; + + $scope.createElement = function () { + $location.search('create', null); + $location.search('notemplate', null); + $location.search('iselement', null); + $location.path("/settings/documenttypes/edit/" + node.id).search("create", "true").search("notemplate", "true").search("iselement", "true"); + navigationService.hideMenu(); + }; + $scope.close = function() { const showMenu = true; navigationService.hideDialog(showMenu); diff --git a/src/Umbraco.Web.UI.Client/src/views/documenttypes/create.html b/src/Umbraco.Web.UI.Client/src/views/documenttypes/create.html index 4ebb96c09b..208b4eaeda 100644 --- a/src/Umbraco.Web.UI.Client/src/views/documenttypes/create.html +++ b/src/Umbraco.Web.UI.Client/src/views/documenttypes/create.html @@ -1,16 +1,15 @@
-