make template selector work
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -106,11 +106,12 @@
|
||||
</umb-control-group>
|
||||
|
||||
<umb-control-group label="@template_template" description="{{template.description}}">
|
||||
<umb-node-preview
|
||||
name="content.template"
|
||||
allow-open="allowOpen"
|
||||
on-open="openTemplate(template)">
|
||||
</umb-node-preview>
|
||||
<select
|
||||
class="input-block-level"
|
||||
ng-model="content.template"
|
||||
ng-options="key as value for (key, value) in availableTemplates"
|
||||
ng-change="updateTemplate(content.template)">
|
||||
</select>
|
||||
</umb-control-group>
|
||||
|
||||
<umb-control-group label="{{ idSection.name }}">
|
||||
|
||||
Reference in New Issue
Block a user