Removing the option to create document type with a template

This commit is contained in:
Robert
2018-03-07 14:10:25 +01:00
parent 728bf8b52d
commit eb06e62937
2 changed files with 28 additions and 18 deletions

View File

@@ -14,18 +14,21 @@ function DocumentTypesCreateController($scope, $location, navigationService, con
creatingFolder: false,
};
var disableTemplate = Umbraco.Sys.ServerVariables.disabledFeatures.disableTemplate;
$scope.model.disableTemplate = disableTemplate;
var node = $scope.dialogOptions.currentNode,
localizeCreateFolder = localizationService.localize("defaultdialog_createFolder");
$scope.showCreateFolder = function() {
$scope.showCreateFolder = function () {
$scope.model.creatingFolder = true;
};
$scope.createContainer = function() {
$scope.createContainer = function () {
if (formHelper.submitForm({scope: $scope, formCtrl: this.createFolderForm, statusMessage: localizeCreateFolder})) {
if (formHelper.submitForm({ scope: $scope, formCtrl: this.createFolderForm, statusMessage: localizeCreateFolder })) {
contentTypeResource.createContainer(node.id, $scope.model.folderName).then(function(folderId) {
contentTypeResource.createContainer(node.id, $scope.model.folderName).then(function (folderId) {
navigationService.hideMenu();
@@ -44,7 +47,7 @@ function DocumentTypesCreateController($scope, $location, navigationService, con
var section = appState.getSectionState("currentSection");
}, function(err) {
}, function (err) {
$scope.error = err;
@@ -58,14 +61,17 @@ 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();
};
// Disabling logic for creating document type with template if disableTemplate is set to true
if (!disableTemplate) {
$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() {
$scope.createComponent = function () {
$location.search('create', null);
$location.search('notemplate', null);
$location.path("/settings/documenttypes/edit/" + node.id).search("create", "true").search("notemplate", "true");

View File

@@ -4,7 +4,7 @@
<h5><localize key="create_createUnder">Create an item under</localize> {{currentNode.name}}</h5>
<ul class="umb-actions umb-actions-child">
<li data-element="action-documentType">
<li data-element="action-documentType" ng-hide="model.disableTemplate">
<a href="" ng-click="createDocType()" umb-auto-focus>
<i class="large icon-item-arrangement"></i>
@@ -15,10 +15,14 @@
</a>
</li>
<li data-element="action-documentTypeWithoutTemplate">
<a href="" ng-click="createComponent()">
<i class="large icon-item-arrangement"></i>
<span class="menu-label"><localize key="create_documentTypeWithoutTemplate"></localize></span>
</a>
<a href="" ng-click="createComponent()">
<i class="large icon-item-arrangement"></i>
<span class="menu-label">
<localize ng-if="model.disableTemplate == false" key="create_documentTypeWithoutTemplate"></localize>
<localize ng-if="model.disableTemplate == true" key="content_documentType">Document type></localize>
</span>
</a>
</li>
<li data-element="action-folder" ng-if="model.allowCreateFolder">
<a href="" ng-click="showCreateFolder()">
@@ -33,7 +37,7 @@
<form novalidate name="createFolderForm"
ng-submit="createContainer()"
val-form-manager>
<div ng-show="error">
<h5 class="text-error">{{error.errorMsg}}</h5>
<p class="text-error">{{error.data.message}}</p>