Enables list view column templates
* add template property * Apply template to column value * Removed trailing newline
This commit is contained in:
committed by
Elitsa Marinovska
parent
3573df3531
commit
89fc8133d2
@@ -18,6 +18,7 @@
|
||||
<td style="width:20px;"></td>
|
||||
<th style="width:220px;">Alias</th>
|
||||
<th>Header</th>
|
||||
<th><localize key="template_template">Template</localize></th>
|
||||
<td style="width:100px;"></td>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -36,15 +37,20 @@
|
||||
<td>
|
||||
<ng-form name="headerForm" ng-if="!val.isSystem">
|
||||
<input type="text" name="header" ng-model="val.header" required />
|
||||
<span ng-messages="headerForm.header.$error" show-validation-on-submit >
|
||||
<span ng-messages="headerForm.header.$error" show-validation-on-submit>
|
||||
<span class="help-inline" ng-message="required">Required</span>
|
||||
</span>
|
||||
</ng-form>
|
||||
|
||||
|
||||
<span ng-if="val.isSystem">
|
||||
<localize key="{{getLocalizedKey(val.alias)}}">{{val.alias}}</localize>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<ng-form name="templateForm" ng-if="!val.isSystem">
|
||||
<input type="text" name="template" ng-model="val.nameTemplate" />
|
||||
</ng-form>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-danger" ng-click="removeField(val)">Remove</button>
|
||||
</td>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function listViewController($scope, $routeParams, $injector, $timeout, currentUserResource, notificationsService, iconHelper, editorState, localizationService, appState, $location, listViewHelper, navigationService, editorService, overlayService, languageResource, mediaHelper) {
|
||||
function listViewController($scope, $interpolate, $routeParams, $injector, $timeout, currentUserResource, notificationsService, iconHelper, editorState, localizationService, appState, $location, listViewHelper, navigationService, editorService, overlayService, languageResource, mediaHelper) {
|
||||
|
||||
//this is a quick check to see if we're in create mode, if so just exit - we cannot show children for content
|
||||
// that isn't created yet, if we continue this will use the parent id in the route params which isn't what
|
||||
@@ -168,6 +168,11 @@ function listViewController($scope, $routeParams, $injector, $timeout, currentUs
|
||||
allowBulkDelete: $scope.model.config.bulkActionPermissions.allowBulkDelete,
|
||||
cultureName: $routeParams.cculture ? $routeParams.cculture : $routeParams.mculture
|
||||
};
|
||||
_.each($scope.options.includeProperties, function (property) {
|
||||
property.nameExp = !!property.nameTemplate
|
||||
? $interpolate(property.nameTemplate)
|
||||
: undefined;
|
||||
});
|
||||
|
||||
//watch for culture changes in the query strings and update accordingly
|
||||
$scope.$watch(function () {
|
||||
@@ -699,6 +704,13 @@ function listViewController($scope, $routeParams, $injector, $timeout, currentUs
|
||||
value = value.substring(0, value.length - 3);
|
||||
}
|
||||
|
||||
if (e.nameExp) {
|
||||
var newValue = e.nameExp({ value });
|
||||
if (newValue && (newValue = $.trim(newValue))) {
|
||||
value = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
// set what we've got on the result
|
||||
result[alias] = value;
|
||||
});
|
||||
|
||||
@@ -77,6 +77,9 @@ namespace Umbraco.Web.PropertyEditors
|
||||
[JsonProperty("header")]
|
||||
public string Header { get; set; }
|
||||
|
||||
[JsonProperty("nameTemplate")]
|
||||
public string Template { get; set; }
|
||||
|
||||
[JsonProperty("isSystem")]
|
||||
public int IsSystem { get; set; } // TODO: bool
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user