Don't allow templates on element types
This commit is contained in:
@@ -19,13 +19,13 @@
|
||||
vm.canCreateTemplate = false;
|
||||
vm.updateTemplatePlaceholder = false;
|
||||
vm.loadingTemplates = false;
|
||||
vm.isElement = $scope.model.isElement;
|
||||
|
||||
vm.createTemplate = createTemplate;
|
||||
|
||||
/* ---------- INIT ---------- */
|
||||
|
||||
function onInit() {
|
||||
|
||||
vm.loadingTemplates = true;
|
||||
entityResource.getAll("Template").then(function (templates) {
|
||||
|
||||
@@ -86,6 +86,15 @@
|
||||
vm.canCreateTemplate = existingTemplate ? false : true;
|
||||
}
|
||||
|
||||
var unbindWatcher = $scope.$watch("model.isElement",
|
||||
function(newValue, oldValue) {
|
||||
vm.isElement = newValue;
|
||||
}
|
||||
);
|
||||
$scope.$on("$destroy", function () {
|
||||
unbindWatcher();
|
||||
});
|
||||
|
||||
onInit();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div ng-controller="Umbraco.Editors.DocumentType.TemplatesController as vm">
|
||||
<umb-box>
|
||||
<umb-box ng-hide="vm.isElement">
|
||||
<umb-box-content>
|
||||
<div class="sub-view-columns">
|
||||
|
||||
@@ -9,29 +9,34 @@
|
||||
</div>
|
||||
|
||||
<div class="sub-view-column-right">
|
||||
<umb-grid-selector
|
||||
ng-if="vm.availableTemplates"
|
||||
selected-items="model.allowedTemplates"
|
||||
available-items="vm.availableTemplates"
|
||||
default-item="model.defaultTemplate"
|
||||
item-name="template"
|
||||
name="model.name"
|
||||
alias="model.alias"
|
||||
update-placeholder="vm.updateTemplatePlaceholder">
|
||||
</umb-grid-selector>
|
||||
<umb-grid-selector
|
||||
ng-if="vm.availableTemplates"
|
||||
selected-items="model.allowedTemplates"
|
||||
available-items="vm.availableTemplates"
|
||||
default-item="model.defaultTemplate"
|
||||
item-name="template"
|
||||
name="model.name"
|
||||
alias="model.alias"
|
||||
update-placeholder="vm.updateTemplatePlaceholder">
|
||||
</umb-grid-selector>
|
||||
|
||||
<umb-button
|
||||
ng-if="vm.canCreateTemplate"
|
||||
type="button"
|
||||
button-style="info"
|
||||
action="vm.createTemplate()"
|
||||
state="vm.createTemplateButtonState"
|
||||
label-key="settings_createMatchingTemplate">
|
||||
</umb-button>
|
||||
<umb-button
|
||||
ng-if="vm.canCreateTemplate"
|
||||
type="button"
|
||||
button-style="info"
|
||||
action="vm.createTemplate()"
|
||||
state="vm.createTemplateButtonState"
|
||||
label-key="settings_createMatchingTemplate">
|
||||
</umb-button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</umb-box-content>
|
||||
</umb-box>
|
||||
<umb-empty-state
|
||||
ng-show="vm.isElement"
|
||||
position="center">
|
||||
<localize key="contentTypeEditor_elementHasNoTemplates">An Element type can't have any templates</localize>
|
||||
</umb-empty-state>
|
||||
</div>
|
||||
|
||||
@@ -1225,6 +1225,9 @@ Mange hilsner fra Umbraco robotten
|
||||
<key alias="memberCanEdit">Medlem kan redigere</key>
|
||||
<key alias="showOnMemberProfile">Vis på medlemsprofil</key>
|
||||
<key alias="tabHasNoSortOrder">fane har ingen sorteringsrækkefølge</key>
|
||||
<key alias="elementHeading">Er en Element-type</key>
|
||||
<key alias="elementDescription">En Element-type er tiltænkt brug i f.eks. Nested Content, ikke i indholdstræet</key>
|
||||
<key alias="elementHasNoTemplates">En Element-type kan ikke have nogen skabeloner</key>
|
||||
</area>
|
||||
<area alias="templateEditor">
|
||||
<key alias="alternativeField">Alternativt felt</key>
|
||||
|
||||
@@ -1520,6 +1520,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="allowVaryByCulture">Allow varying by culture</key>
|
||||
<key alias="elementHeading">Is an Element type</key>
|
||||
<key alias="elementDescription">An Element type is meant to be used for instance in Nested Content, and not in the tree</key>
|
||||
<key alias="elementHasNoTemplates">An Element type can't have templates assigned</key>
|
||||
</area>
|
||||
<area alias="modelsBuilder">
|
||||
<key alias="buildingModels">Building models</key>
|
||||
|
||||
@@ -1561,6 +1561,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="allowVaryByCulture">Allow varying by culture</key>
|
||||
<key alias="elementHeading">Is an Element type</key>
|
||||
<key alias="elementDescription">An Element type is meant to be used for instance in Nested Content, and not in the tree</key>
|
||||
<key alias="elementHasNoTemplates">An Element type can't have any templates</key>
|
||||
</area>
|
||||
<area alias="languages">
|
||||
<key alias="addLanguage">Add language</key>
|
||||
|
||||
@@ -263,6 +263,15 @@ namespace Umbraco.Web.Editors
|
||||
}
|
||||
}
|
||||
|
||||
//Before we send this model into this saving/mapping pipeline, we also need to do some cleanup on templates.
|
||||
//If the doc type is an element type, it can't have any templates assigned, so we need to reset the allowed templates here.
|
||||
if (contentTypeSave.IsElement)
|
||||
{
|
||||
contentTypeSave.AllowedTemplates = new string[] { };
|
||||
contentTypeSave.DefaultTemplate = null;
|
||||
}
|
||||
|
||||
|
||||
var savedCt = PerformPostSave<DocumentTypeDisplay, DocumentTypeSave, PropertyTypeBasic>(
|
||||
contentTypeSave: contentTypeSave,
|
||||
getContentType: i => Services.ContentTypeService.Get(i),
|
||||
|
||||
Reference in New Issue
Block a user