diff --git a/src/Umbraco.Web.UI.Client/src/views/packages/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/packages/edit.controller.js
index bed3341c6b..0a44192041 100644
--- a/src/Umbraco.Web.UI.Client/src/views/packages/edit.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/packages/edit.controller.js
@@ -1,7 +1,7 @@
(function () {
"use strict";
- function EditController($scope, $location, $routeParams, umbRequestHelper, entityResource, stylesheetResource, languageResource, packageResource, dictionaryResource, editorService, formHelper) {
+ function EditController($scope, $location, $routeParams, umbRequestHelper, entityResource, packageResource, editorService, formHelper) {
const vm = this;
@@ -73,7 +73,7 @@
});
// get all stylesheets
- stylesheetResource.getAll().then(stylesheets => {
+ entityResource.getAll("Stylesheet").then(stylesheets => {
vm.stylesheets = stylesheets;
});
@@ -87,7 +87,7 @@
});
// get all languages
- languageResource.getAll().then(languages => {
+ entityResource.getAll("Language").then(languages => {
// a package stores the id as a string so we
// need to convert all ids to string for comparison
languages.forEach(language => {
@@ -97,7 +97,7 @@
});
// get all dictionary items
- dictionaryResource.getList().then(dictionaryItems => {
+ entityResource.getAll("DictionaryItem").then(dictionaryItems => {
// a package stores the id as a string so we
// need to convert all ids to string for comparison
dictionaryItems.forEach(dictionaryItem => {
diff --git a/src/Umbraco.Web/Editors/DictionaryController.cs b/src/Umbraco.Web/Editors/DictionaryController.cs
index cd3141c7b9..9d01cc9d64 100644
--- a/src/Umbraco.Web/Editors/DictionaryController.cs
+++ b/src/Umbraco.Web/Editors/DictionaryController.cs
@@ -219,7 +219,7 @@ namespace Umbraco.Web.Editors
///
/// The list.
///
- private void GetChildItemsForList(IDictionaryItem dictionaryItem, int level, List list)
+ private void GetChildItemsForList(IDictionaryItem dictionaryItem, int level, ICollection list)
{
foreach (var childItem in Services.LocalizationService.GetDictionaryItemChildren(dictionaryItem.Key).OrderBy(ItemSort()))
{
@@ -231,6 +231,6 @@ namespace Umbraco.Web.Editors
}
}
- private Func ItemSort() => item => item.ItemKey;
+ private static Func ItemSort() => item => item.ItemKey;
}
}
diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs
index 993489855f..396615a339 100644
--- a/src/Umbraco.Web/Editors/EntityController.cs
+++ b/src/Umbraco.Web/Editors/EntityController.cs
@@ -839,8 +839,6 @@ namespace Umbraco.Web.Editors
return UmbracoObjectTypes.MediaType;
case UmbracoEntityTypes.DocumentType:
return UmbracoObjectTypes.DocumentType;
- case UmbracoEntityTypes.Stylesheet:
- return UmbracoObjectTypes.Stylesheet;
case UmbracoEntityTypes.Member:
return UmbracoObjectTypes.Member;
case UmbracoEntityTypes.DataType:
@@ -912,13 +910,31 @@ namespace Umbraco.Web.Editors
case UmbracoEntityTypes.User:
- long total;
- var users = Services.UserService.GetAll(0, int.MaxValue, out total);
+ var users = Services.UserService.GetAll(0, int.MaxValue, out _);
var filteredUsers = ExecutePostFilter(users, postFilter, postFilterParams);
return Mapper.Map, IEnumerable>(filteredUsers);
- case UmbracoEntityTypes.Domain:
+ case UmbracoEntityTypes.Stylesheet:
+
+ if (!postFilter.IsNullOrWhiteSpace() || (postFilterParams != null && postFilterParams.Count > 0))
+ throw new NotSupportedException("Filtering on stylesheets is not currently supported");
+
+ return Services.FileService.GetStylesheets().Select(Mapper.Map);
+
case UmbracoEntityTypes.Language:
+
+ if (!postFilter.IsNullOrWhiteSpace() || (postFilterParams != null && postFilterParams.Count > 0))
+ throw new NotSupportedException("Filtering on languages is not currently supported");
+
+ return Services.LocalizationService.GetAllLanguages().Select(Mapper.Map);
+ case UmbracoEntityTypes.DictionaryItem:
+
+ if (!postFilter.IsNullOrWhiteSpace() || (postFilterParams != null && postFilterParams.Count > 0))
+ throw new NotSupportedException("Filtering on languages is not currently supported");
+
+ return GetAllDictionaryItems();
+
+ case UmbracoEntityTypes.Domain:
default:
throw new NotSupportedException("The " + typeof(EntityController) + " does not currently support data for the type " + entityType);
}
@@ -937,5 +953,36 @@ namespace Umbraco.Web.Editors
}
return entities;
}
+
+
+ #region Methods to get all dictionary items
+ private IEnumerable GetAllDictionaryItems()
+ {
+ var list = new List();
+
+ foreach (var dictionaryItem in Services.LocalizationService.GetRootDictionaryItems().OrderBy(DictionaryItemSort()))
+ {
+ var item = Mapper.Map(dictionaryItem);
+ list.Add(item);
+ GetChildItemsForList(dictionaryItem, list);
+ }
+
+ return list;
+ }
+
+ private static Func DictionaryItemSort() => item => item.ItemKey;
+
+ private void GetChildItemsForList(IDictionaryItem dictionaryItem, ICollection list)
+ {
+ foreach (var childItem in Services.LocalizationService.GetDictionaryItemChildren(dictionaryItem.Key).OrderBy(DictionaryItemSort()))
+ {
+ var item = Mapper.Map(childItem);
+ list.Add(item);
+
+ GetChildItemsForList(childItem, list);
+ }
+ }
+ #endregion
+
}
}
diff --git a/src/Umbraco.Web/Models/ContentEditing/UmbracoEntityTypes.cs b/src/Umbraco.Web/Models/ContentEditing/UmbracoEntityTypes.cs
index 04d06845d9..fcf7271673 100644
--- a/src/Umbraco.Web/Models/ContentEditing/UmbracoEntityTypes.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/UmbracoEntityTypes.cs
@@ -86,8 +86,11 @@ namespace Umbraco.Web.Models.ContentEditing
///
/// Property Group
///
- PropertyGroup
+ PropertyGroup,
- //TODO: Dictionary?
+ ///
+ /// Dictionary Item
+ ///
+ DictionaryItem
}
}
diff --git a/src/Umbraco.Web/Models/Mapping/CodeFileMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/CodeFileMapperProfile.cs
index 94c43f8f11..b3f5f0374c 100644
--- a/src/Umbraco.Web/Models/Mapping/CodeFileMapperProfile.cs
+++ b/src/Umbraco.Web/Models/Mapping/CodeFileMapperProfile.cs
@@ -9,6 +9,18 @@ namespace Umbraco.Web.Models.Mapping
{
public CodeFileMapperProfile()
{
+ CreateMap()
+ .ForMember(dest => dest.Id, opt => opt.MapFrom(sheet => sheet.Id))
+ .ForMember(dest => dest.Alias, opt => opt.MapFrom(sheet => sheet.Alias))
+ .ForMember(dest => dest.Key, opt => opt.MapFrom(sheet => sheet.Key))
+ .ForMember(dest => dest.Name, opt => opt.MapFrom(sheet => sheet.Name))
+ .ForMember(dest => dest.ParentId, opt => opt.UseValue(-1))
+ .ForMember(dest => dest.Path, opt => opt.MapFrom(sheet => sheet.Path))
+ .ForMember(dest => dest.Trashed, opt => opt.Ignore())
+ .ForMember(dest => dest.AdditionalData, opt => opt.Ignore())
+ .ForMember(dest => dest.Udi, opt => opt.Ignore())
+ .ForMember(dest => dest.Icon, opt => opt.Ignore());
+
CreateMap()
.ForMember(dest => dest.FileType, opt => opt.Ignore())
.ForMember(dest => dest.Notifications, opt => opt.Ignore())
diff --git a/src/Umbraco.Web/Models/Mapping/DictionaryMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/DictionaryMapperProfile.cs
index ebd675f572..b3af04603c 100644
--- a/src/Umbraco.Web/Models/Mapping/DictionaryMapperProfile.cs
+++ b/src/Umbraco.Web/Models/Mapping/DictionaryMapperProfile.cs
@@ -17,6 +17,18 @@ namespace Umbraco.Web.Models.Mapping
{
public DictionaryMapperProfile(ILocalizationService localizationService)
{
+ CreateMap()
+ .ForMember(dest => dest.Id, opt => opt.MapFrom(sheet => sheet.Id))
+ .ForMember(dest => dest.Alias, opt => opt.MapFrom(sheet => sheet.ItemKey))
+ .ForMember(dest => dest.Key, opt => opt.MapFrom(sheet => sheet.Key))
+ .ForMember(dest => dest.Name, opt => opt.MapFrom(sheet => sheet.ItemKey))
+ .ForMember(dest => dest.ParentId, opt => opt.Ignore())
+ .ForMember(dest => dest.Path, opt => opt.Ignore())
+ .ForMember(dest => dest.Trashed, opt => opt.Ignore())
+ .ForMember(dest => dest.AdditionalData, opt => opt.Ignore())
+ .ForMember(dest => dest.Udi, opt => opt.Ignore())
+ .ForMember(dest => dest.Icon, opt => opt.Ignore());
+
CreateMap()
.ForMember(x => x.Translations, expression => expression.Ignore())
.ForMember(x => x.Notifications, expression => expression.Ignore())
diff --git a/src/Umbraco.Web/Models/Mapping/LanguageMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/LanguageMapperProfile.cs
index f820d5ae54..ea29b671a6 100644
--- a/src/Umbraco.Web/Models/Mapping/LanguageMapperProfile.cs
+++ b/src/Umbraco.Web/Models/Mapping/LanguageMapperProfile.cs
@@ -12,6 +12,18 @@ namespace Umbraco.Web.Models.Mapping
{
public LanguageMapperProfile()
{
+ CreateMap()
+ .ForMember(dest => dest.Id, opt => opt.MapFrom(x => x.Id))
+ .ForMember(dest => dest.Name, opt => opt.MapFrom(x => x.CultureName))
+ .ForMember(dest => dest.Key, opt => opt.MapFrom(x => x.Key))
+ .ForMember(dest => dest.Alias, opt => opt.MapFrom(x => x.IsoCode))
+ .ForMember(dest => dest.ParentId, opt => opt.UseValue(-1))
+ .ForMember(dest => dest.Path, opt => opt.Ignore())
+ .ForMember(dest => dest.Trashed, opt => opt.Ignore())
+ .ForMember(dest => dest.AdditionalData, opt => opt.Ignore())
+ .ForMember(dest => dest.Udi, opt => opt.Ignore())
+ .ForMember(dest => dest.Icon, opt => opt.Ignore());
+
CreateMap()
.ForMember(l => l.Name, expression => expression.MapFrom(x => x.CultureInfo.DisplayName));