diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js
index b320162b08..25e8b76521 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js
@@ -174,6 +174,9 @@
}
}
+ // get available templates
+ $scope.availableTemplates = getAvailableTemplates($scope.content);
+
// get the auditTrail
setAuditTrailActionColor($scope.auditTrail);
@@ -387,6 +390,22 @@
console.log("this is not the template");
};
+ $scope.updateTemplate = function(templateAlias) {
+
+ // update template value
+ $scope.content.template = templateAlias;
+
+ // update template value on the correct tab
+ angular.forEach($scope.content.tabs, function(tab){
+ angular.forEach(tab.properties, function(property){
+ if(property.alias === "_umb_template") {
+ property.value = templateAlias;
+ }
+ });
+ });
+
+ };
+
function setAuditTrailActionColor(auditTrail) {
angular.forEach(auditTrail, function (item) {
switch (item.action) {
@@ -402,6 +421,23 @@
});
}
+ function getAvailableTemplates(content) {
+
+ var availableTemplates = {};
+
+ // find the templates in the properties array
+ angular.forEach(content.properties, function(property){
+ if(property.alias === "_umb_template") {
+ if(property.config && property.config.items) {
+ availableTemplates = property.config.items;
+ }
+ }
+ });
+
+ return availableTemplates;
+
+ }
+
}
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/content/edit.html b/src/Umbraco.Web.UI.Client/src/views/components/content/edit.html
index 5c19706ff8..7291ffbbb0 100644
--- a/src/Umbraco.Web.UI.Client/src/views/components/content/edit.html
+++ b/src/Umbraco.Web.UI.Client/src/views/components/content/edit.html
@@ -106,11 +106,12 @@
-
-
+