diff --git a/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/templates/templates.controller.js b/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/templates/templates.controller.js
index 849b5ccd7b..1d825fdf26 100644
--- a/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/templates/templates.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/templates/templates.controller.js
@@ -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();
}
diff --git a/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/templates/templates.html b/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/templates/templates.html
index 8084497441..de62e151a3 100644
--- a/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/templates/templates.html
+++ b/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/templates/templates.html
@@ -1,5 +1,5 @@
-
+
@@ -9,29 +9,34 @@
-
-
+
+
-
-
+
+
+
+ An Element type can't have any templates
+
diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml
index 7a370ba90e..c8a5f5f37e 100644
--- a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml
+++ b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml
@@ -1225,6 +1225,9 @@ Mange hilsner fra Umbraco robotten
Medlem kan redigere
Vis på medlemsprofil
fane har ingen sorteringsrækkefølge
+ Er en Element-type
+ En Element-type er tiltænkt brug i f.eks. Nested Content, ikke i indholdstræet
+ En Element-type kan ikke have nogen skabeloner
Alternativt felt
diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
index 987203442a..de6f56ab75 100644
--- a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
+++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
@@ -1520,6 +1520,7 @@ To manage your website, simply open the Umbraco back office and start adding con
Allow varying by culture
Is an Element type
An Element type is meant to be used for instance in Nested Content, and not in the tree
+ An Element type can't have templates assigned
Building models
diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
index 1860d3afc9..360dff6195 100644
--- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
+++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
@@ -1561,6 +1561,7 @@ To manage your website, simply open the Umbraco back office and start adding con
Allow varying by culture
Is an Element type
An Element type is meant to be used for instance in Nested Content, and not in the tree
+ An Element type can't have any templates
Add language
diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs
index 397f6b3e9d..d7ca2d19f6 100644
--- a/src/Umbraco.Web/Editors/ContentTypeController.cs
+++ b/src/Umbraco.Web/Editors/ContentTypeController.cs
@@ -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(
contentTypeSave: contentTypeSave,
getContentType: i => Services.ContentTypeService.Get(i),