Makes it possible to change the icon for list view content apps
This commit is contained in:
committed by
Sebastiaan Janssen
parent
b8e5146baa
commit
8f300761ef
@@ -0,0 +1,31 @@
|
||||
function iconPreValsController($scope, editorService) {
|
||||
|
||||
if (!$scope.model.value) {
|
||||
$scope.model.value = "icon-list";
|
||||
}
|
||||
|
||||
$scope.openIconPicker = function () {
|
||||
var iconPicker = {
|
||||
icon: $scope.model.value.split(' ')[0],
|
||||
color: $scope.model.value.split(' ')[1],
|
||||
submit: function (model) {
|
||||
if (model.icon) {
|
||||
if (model.color) {
|
||||
$scope.model.value = model.icon + " " + model.color;
|
||||
} else {
|
||||
$scope.model.value = model.icon;
|
||||
}
|
||||
$scope.iconForm.$setDirty();
|
||||
}
|
||||
editorService.close();
|
||||
},
|
||||
close: function () {
|
||||
editorService.close();
|
||||
}
|
||||
};
|
||||
editorService.iconPicker(iconPicker);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.PrevalueEditors.IconPickerController", iconPreValsController);
|
||||
@@ -0,0 +1,11 @@
|
||||
<div ng-controller="Umbraco.PrevalueEditors.IconPickerController">
|
||||
<ng-form data-element="editor-icon" name="iconForm">
|
||||
<div class="umb-panel-header-icon" ng-if="!hideIcon" ng-click="openIconPicker()" ng-class="{'-placeholder': model.value==='' || model.value===null}"
|
||||
title="{{model.value}}">
|
||||
<i class="icon {{model.value}}" ng-if="model.value!=='' && model.value!==null"></i>
|
||||
<div class="umb-panel-header-icon-text" ng-if="model.value==='' || model.value===null">
|
||||
<localize key="settings_addIcon"></localize>
|
||||
</div>
|
||||
</div>
|
||||
</ng-form>
|
||||
</div>
|
||||
@@ -100,6 +100,15 @@ namespace Umbraco.Web.ContentApps
|
||||
if (configTabName != null && String.IsNullOrWhiteSpace(configTabName.ToString()) == false)
|
||||
contentApp.Name = configTabName.ToString();
|
||||
}
|
||||
|
||||
//Override Icon if icon is provided
|
||||
if (listViewConfig.ContainsKey("icon"))
|
||||
{
|
||||
var configIcon = listViewConfig["icon"];
|
||||
if (configIcon != null && String.IsNullOrWhiteSpace(configIcon.ToString()) == false)
|
||||
contentApp.Icon = configIcon.ToString();
|
||||
}
|
||||
|
||||
// if the list view is configured to show umbContent first, update the list view content app weight accordingly
|
||||
if(listViewConfig.ContainsKey("showContentFirst") &&
|
||||
listViewConfig["showContentFirst"]?.ToString().TryConvertTo<bool>().Result == true)
|
||||
|
||||
@@ -60,6 +60,9 @@ namespace Umbraco.Web.PropertyEditors
|
||||
Description = "The bulk actions that are allowed from the list view")]
|
||||
public BulkActionPermissionSettings BulkActionPermissions { get; set; } = new BulkActionPermissionSettings(); // TODO: managing defaults?
|
||||
|
||||
[ConfigurationField("icon", "Content app icon", "views/propertyeditors/listview/icon.prevalues.html", Description = "The icon of the listview content app")]
|
||||
public string Icon { get; set; }
|
||||
|
||||
[ConfigurationField("tabName", "Content app name", "textstring", Description = "The name of the listview content app (default if empty: 'Child Items')")]
|
||||
public string TabName { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user