diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js
index b2bbd9006a..e9cc3c6946 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js
@@ -55,6 +55,11 @@
$location.url(url);
};
+ scope.openTemplate = function () {
+ var url = "/settings/templates/edit/" + scope.node.templateId;
+ $location.url(url);
+ }
+
scope.updateTemplate = function (templateAlias) {
// update template value
diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgridselector.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgridselector.directive.js
index f8bdb50e32..127386e34d 100644
--- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgridselector.directive.js
+++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgridselector.directive.js
@@ -1,7 +1,7 @@
-(function() {
+(function () {
'use strict';
- function GridSelector() {
+ function GridSelector($location) {
function link(scope, el, attr, ctrl) {
@@ -11,18 +11,18 @@
scope.itemLabel = "";
// set default item name
- if(!scope.itemName){
+ if (!scope.itemName) {
scope.itemLabel = "item";
} else {
scope.itemLabel = scope.itemName;
}
- scope.removeItem = function(selectedItem) {
+ scope.removeItem = function (selectedItem) {
var selectedItemIndex = scope.selectedItems.indexOf(selectedItem);
scope.selectedItems.splice(selectedItemIndex, 1);
};
- scope.removeDefaultItem = function() {
+ scope.removeDefaultItem = function () {
// it will be the last item so we can clear the array
scope.selectedItems = [];
@@ -32,7 +32,7 @@
};
- scope.openItemPicker = function($event){
+ scope.openItemPicker = function ($event) {
scope.dialogModel = {
view: "itempicker",
title: "Choose " + scope.itemLabel,
@@ -40,11 +40,11 @@
selectedItems: scope.selectedItems,
event: $event,
show: true,
- submit: function(model) {
+ submit: function (model) {
scope.selectedItems.push(model.selectedItem);
// if no default item - set item as default
- if(scope.defaultItem === null) {
+ if (scope.defaultItem === null) {
scope.setAsDefaultItem(model.selectedItem);
}
@@ -54,7 +54,12 @@
};
};
- scope.setAsDefaultItem = function(selectedItem) {
+ scope.openTemplate = function (selectedItem) {
+ var url = "/settings/templates/edit/" + selectedItem.id;
+ $location.url(url);
+ }
+
+ scope.setAsDefaultItem = function (selectedItem) {
// clear default item
scope.defaultItem = {};
@@ -65,69 +70,69 @@
function updatePlaceholders() {
- // update default item
- if(scope.defaultItem !== null && scope.defaultItem.placeholder) {
+ // update default item
+ if (scope.defaultItem !== null && scope.defaultItem.placeholder) {
- scope.defaultItem.name = scope.name;
+ scope.defaultItem.name = scope.name;
- if(scope.alias !== null && scope.alias !== undefined) {
- scope.defaultItem.alias = scope.alias;
- }
-
- }
-
- // update selected items
- angular.forEach(scope.selectedItems, function(selectedItem) {
- if(selectedItem.placeholder) {
-
- selectedItem.name = scope.name;
-
- if(scope.alias !== null && scope.alias !== undefined) {
- selectedItem.alias = scope.alias;
- }
+ if (scope.alias !== null && scope.alias !== undefined) {
+ scope.defaultItem.alias = scope.alias;
+ }
}
- });
- // update availableItems
- angular.forEach(scope.availableItems, function(availableItem) {
- if(availableItem.placeholder) {
+ // update selected items
+ angular.forEach(scope.selectedItems, function (selectedItem) {
+ if (selectedItem.placeholder) {
- availableItem.name = scope.name;
+ selectedItem.name = scope.name;
- if(scope.alias !== null && scope.alias !== undefined) {
- availableItem.alias = scope.alias;
- }
+ if (scope.alias !== null && scope.alias !== undefined) {
+ selectedItem.alias = scope.alias;
+ }
- }
- });
+ }
+ });
+
+ // update availableItems
+ angular.forEach(scope.availableItems, function (availableItem) {
+ if (availableItem.placeholder) {
+
+ availableItem.name = scope.name;
+
+ if (scope.alias !== null && scope.alias !== undefined) {
+ availableItem.alias = scope.alias;
+ }
+
+ }
+ });
}
function activate() {
- // add watchers for updating placeholde name and alias
- if(scope.updatePlaceholder) {
- eventBindings.push(scope.$watch('name', function(newValue, oldValue){
- updatePlaceholders();
- }));
+ // add watchers for updating placeholde name and alias
+ if (scope.updatePlaceholder) {
+ eventBindings.push(scope.$watch('name', function (newValue, oldValue) {
+ updatePlaceholders();
+ }));
- eventBindings.push(scope.$watch('alias', function(newValue, oldValue){
- updatePlaceholders();
- }));
- }
+ eventBindings.push(scope.$watch('alias', function (newValue, oldValue) {
+ updatePlaceholders();
+ }));
+ }
}
activate();
// clean up
- scope.$on('$destroy', function(){
+ scope.$on('$destroy', function () {
- // clear watchers
- for(var e in eventBindings) {
- eventBindings[e]();
- }
+ // clear watchers
+ for (var e in eventBindings) {
+ eventBindings[e]();
+ }
});
@@ -138,13 +143,13 @@
replace: true,
templateUrl: 'views/components/umb-grid-selector.html',
scope: {
- name: "=",
- alias: "=",
- selectedItems: '=',
- availableItems: "=",
- defaultItem: "=",
- itemName: "@",
- updatePlaceholder: "="
+ name: "=",
+ alias: "=",
+ selectedItems: '=',
+ availableItems: "=",
+ defaultItem: "=",
+ itemName: "@",
+ updatePlaceholder: "="
},
link: link
};
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-content-node-info.html b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-content-node-info.html
index 7e2ac85017..783ceb262b 100644
--- a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-content-node-info.html
+++ b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-content-node-info.html
@@ -186,12 +186,17 @@
-
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/umb-grid-selector.html b/src/Umbraco.Web.UI.Client/src/views/components/umb-grid-selector.html
index 0fa236fd7f..090c5a35f4 100644
--- a/src/Umbraco.Web.UI.Client/src/views/components/umb-grid-selector.html
+++ b/src/Umbraco.Web.UI.Client/src/views/components/umb-grid-selector.html
@@ -6,6 +6,7 @@
{{ defaultItem.name }}
+
(Default {{itemLabel}})
@@ -15,7 +16,8 @@
{{ selectedItem.name }}
-
Set as default
+
+
@@ -33,11 +35,10 @@
Akk {{itemLabel}}s are added
-
+
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 0cfe76cd7a..a1385102e4 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
@@ -7,17 +7,15 @@
-
+
-
diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs
index 1e59aa1c93..28f7e898cf 100644
--- a/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs
@@ -28,6 +28,15 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "template")]
public string TemplateAlias { get; set; }
+
+
+
+ [DataMember(Name = "templateId")]
+ public int TemplateId { get; set; }
+
+
+
+
[DataMember(Name = "allowedTemplates")]
public IDictionary AllowedTemplates { get; set; }
@@ -58,4 +67,4 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "isBlueprint")]
public bool IsBlueprint { get; set; }
}
-}
\ No newline at end of file
+}