Adds nametemplates for grid editors (#6634)
* Adds nametemplates for grid editors
This commit is contained in:
committed by
Elitsa Marinovska
parent
131273bb5c
commit
56f33e1006
@@ -6,6 +6,7 @@ namespace Umbraco.Core.Configuration.Grid
|
||||
public interface IGridEditorConfig
|
||||
{
|
||||
string Name { get; }
|
||||
string NameTemplate { get; }
|
||||
string Alias { get; }
|
||||
string View { get; }
|
||||
string Render { get; }
|
||||
|
||||
@@ -18,6 +18,9 @@ namespace Umbraco.Core.PropertyEditors
|
||||
[JsonProperty("name", Required = Required.Always)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("nameTemplate")]
|
||||
public string NameTemplate { get; set; }
|
||||
|
||||
[JsonProperty("alias", Required = Required.Always)]
|
||||
public string Alias { get; set; }
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -7,12 +7,14 @@
|
||||
},
|
||||
{
|
||||
"name": "Image",
|
||||
"nameTemplate": "{{ 'Image: ' + (value.udi | ncNodeName) }}",
|
||||
"alias": "media",
|
||||
"view": "media",
|
||||
"icon": "icon-picture"
|
||||
},
|
||||
{
|
||||
"name": "Macro",
|
||||
"nameTemplate": "{{ 'Macro: ' + value.macroAlias }}",
|
||||
"alias": "macro",
|
||||
"view": "macro",
|
||||
"icon": "icon-settings-alt"
|
||||
@@ -25,6 +27,7 @@
|
||||
},
|
||||
{
|
||||
"name": "Headline",
|
||||
"nameTemplate": "{{ 'Headline: ' + value }}",
|
||||
"alias": "headline",
|
||||
"view": "textstring",
|
||||
"icon": "icon-coin",
|
||||
@@ -43,4 +46,4 @@
|
||||
"markup": "<blockquote>#value#</blockquote>"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user