Sort the dictionary items alphabetically
This commit is contained in:
committed by
Sebastiaan Janssen
parent
80f9fed3f3
commit
8e423d9c75
@@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using System.Net.Http.Formatting;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Actions;
|
||||
|
||||
@@ -52,10 +53,12 @@ namespace Umbraco.Web.Trees
|
||||
|
||||
var nodes = new TreeNodeCollection();
|
||||
|
||||
Func<IDictionaryItem, string> ItemSort() => item => item.ItemKey;
|
||||
|
||||
if (id == Constants.System.Root.ToInvariantString())
|
||||
{
|
||||
nodes.AddRange(
|
||||
Services.LocalizationService.GetRootDictionaryItems().Select(
|
||||
Services.LocalizationService.GetRootDictionaryItems().OrderBy(ItemSort()).Select(
|
||||
x => CreateTreeNode(
|
||||
x.Id.ToInvariantString(),
|
||||
id,
|
||||
@@ -71,7 +74,7 @@ namespace Umbraco.Web.Trees
|
||||
if (parentDictionary == null)
|
||||
return nodes;
|
||||
|
||||
nodes.AddRange(Services.LocalizationService.GetDictionaryItemChildren(parentDictionary.Key).ToList().OrderByDescending(item => item.Key).Select(
|
||||
nodes.AddRange(Services.LocalizationService.GetDictionaryItemChildren(parentDictionary.Key).ToList().OrderBy(ItemSort()).Select(
|
||||
x => CreateTreeNode(
|
||||
x.Id.ToInvariantString(),
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user