Adds nametemplates for grid editors (#6634)

* Adds nametemplates for grid editors
This commit is contained in:
Søren Kottal
2019-10-25 12:35:15 +02:00
committed by Elitsa Marinovska
parent 131273bb5c
commit 56f33e1006
5 changed files with 21 additions and 5 deletions

View File

@@ -8,7 +8,8 @@ angular.module("umbraco")
angularHelper,
$element,
eventsService,
editorService
editorService,
$interpolate
) {
// Grid status variables
@@ -661,7 +662,6 @@ angular.module("umbraco")
return ((spans / $scope.model.config.items.columns) * 100).toFixed(8);
};
$scope.clearPrompt = function (scopedObject, e) {
scopedObject.deletePrompt = false;
e.preventDefault();
@@ -680,6 +680,10 @@ angular.module("umbraco")
$scope.showRowConfigurations = !$scope.showRowConfigurations;
};
$scope.getTemplateName = function (control) {
if (control.editor.nameExp) return control.editor.nameExp(control)
return control.editor.name;
}
// *********************************************
// Initialization
@@ -923,6 +927,11 @@ angular.module("umbraco")
localizationService.localize("grid_" + value.alias, undefined, value.name).then(function (v) {
value.name = v;
});
// setup nametemplate
value.nameExp = !!value.nameTemplate
? $interpolate(value.nameTemplate)
: undefined;
});
$scope.contentReady = true;

View File

@@ -182,7 +182,7 @@
<div class="umb-control-click-overlay" ng-show="control !== active && !sortMode"></div>
<div class="umb-control-collapsed umb-control-handle" ng-show="sortMode">
{{control.editor.name}}
{{ getTemplateName(control) }}
</div>
<div class="umb-control-inner" ng-hide="sortMode">
@@ -190,7 +190,7 @@
<div class="umb-control-bar umb-control-handle">
<div class="umb-control-title" ng-if="control === active">
{{control.editor.name}}
{{ getTemplateName(control) }}
</div>
<div class="umb-tools" ng-if="control === active">