diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/datatype.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/datatype.resource.js index 678e8547d5..efa7cc4e84 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/datatype.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/datatype.resource.js @@ -114,28 +114,8 @@ function dataTypeResource($q, $http, umbDataFormatter, umbRequestHelper) { "GetAll")), "Failed to retrieve data"); }, - - getAllUserConfigured: function () { - - return umbRequestHelper.resourcePromise( - $http.get( - umbRequestHelper.getApiUrl( - "dataTypeApiBaseUrl", - "GetAllUserConfigured")), - "Failed to retrieve data"); - }, - - getAllUserPropertyEditors: function () { - - return umbRequestHelper.resourcePromise( - $http.get( - umbRequestHelper.getApiUrl( - "dataTypeApiBaseUrl", - "GetAllUserPropertyEditors")), - "Failed to retrieve data"); - }, - - getAllTypesAndEditors : function(){ + + getGroupedPropertyEditors : function(){ return umbRequestHelper.resourcePromise( $http.get( umbRequestHelper.getApiUrl( diff --git a/src/Umbraco.Web.UI.Client/src/views/common/overlays/contenttypeeditor/editorpicker/editorpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/overlays/contenttypeeditor/editorpicker/editorpicker.controller.js index 90dc6a2e4e..83968bda9e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/overlays/contenttypeeditor/editorpicker/editorpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/overlays/contenttypeeditor/editorpicker/editorpicker.controller.js @@ -21,14 +21,14 @@ { active: true, id: 1, - label: "Default", + label: "Available Editors", alias: "Default", typesAndEditors: [] }, { active: false, id: 2, - label: "Reuse", + label: "Re-use", alias: "Reuse", userConfigured: [] } @@ -41,14 +41,14 @@ function activate() { - getAllUserConfiguredDataTypes(); - getAllTypesAndEditors(); + getAllDataTypes(); + getGroupedPropertyEditors(); } - function getAllTypesAndEditors() { + function getGroupedPropertyEditors() { - dataTypeResource.getAllTypesAndEditors().then(function(data){ + dataTypeResource.getGroupedPropertyEditors().then(function(data){ vm.tabs[0].typesAndEditors = data; vm.tabsLoaded = vm.tabsLoaded + 1; checkIfTabContentIsLoaded(); @@ -56,9 +56,9 @@ } - function getAllUserConfiguredDataTypes() { + function getAllDataTypes() { - dataTypeResource.getAllUserConfigured().then(function(data){ + dataTypeResource.getAll().then(function (data) { vm.tabs[1].userConfigured = data; vm.tabsLoaded = vm.tabsLoaded + 1; checkIfTabContentIsLoaded(); diff --git a/src/Umbraco.Web/Editors/DataTypeController.cs b/src/Umbraco.Web/Editors/DataTypeController.cs index 1336166c2c..d53e266060 100644 --- a/src/Umbraco.Web/Editors/DataTypeController.cs +++ b/src/Umbraco.Web/Editors/DataTypeController.cs @@ -285,48 +285,6 @@ namespace Umbraco.Web.Editors .Select(Mapper.Map).Where(x => x.IsSystemDataType == false); } - /// - /// Gets the content json for all data types added by the user - /// - /// - /// - /// Permission is granted to this method if the user has access to any of these sections: Content, media, settings, developer, members - /// - [UmbracoApplicationAuthorize( - Constants.Applications.Content, Constants.Applications.Media, Constants.Applications.Members, - Constants.Applications.Settings, Constants.Applications.Developer)] - public IEnumerable GetAllUserConfigured() - { - //find all user configured for re-reference - return Services.DataTypeService - .GetAllDataTypeDefinitions() - //TODO: This is pretty nasty :( - .Where(x => x.Id > 1045) - .Select(Mapper.Map).Where(x => x.IsSystemDataType == false); - - //find all custom editors added by non-core manifests - - //find the rest - } - - /// - /// Gets the content json for all user added property editors - /// - /// - /// - /// Permission is granted to this method if the user has access to any of these sections: Content, media, settings, developer, members - /// - [UmbracoTreeAuthorize( - Constants.Applications.Content, Constants.Applications.Media, Constants.Applications.Members, - Constants.Applications.Settings, Constants.Applications.Developer)] - public IEnumerable GetAllUserPropertyEditors() - { - return PropertyEditorResolver.Current.PropertyEditors - .OrderBy(x => x.Name) - .Where(x => x.ValueEditor.View.IndexOf("app_plugins", StringComparison.InvariantCultureIgnoreCase) >= 0) - .Select(Mapper.Map); - } - /// /// Returns all configured data types and all potential data types that could exist based on unused property editors grouped /// by their property editor defined group. @@ -340,41 +298,17 @@ namespace Umbraco.Web.Editors Constants.Applications.Settings, Constants.Applications.Developer)] public IDictionary> GetGroupedPropertyEditors() { - var datadefs = Services.DataTypeService - .GetAllDataTypeDefinitions() - .ToArray(); - var datatypes = new List(); - - //this is a very specific map - if a property editor does not have prevalue - and there is a datatype already using this type, return that. - //also, we exclude all the system listviews from the list + var propertyEditors = PropertyEditorResolver.Current.PropertyEditors; foreach (var propertyEditor in propertyEditors) { var hasPrevalues = propertyEditor.PreValueEditor.Fields.Any(); - - //check if a data type exists for this property editor - var dataDef = datadefs.FirstOrDefault(x => x.PropertyEditorAlias == propertyEditor.Alias); - - //if no prevalues and a datatype exists with this property editor - if (hasPrevalues == false && dataDef != null) - { - //exclude system list views - if (dataDef.Name.InvariantStartsWith(Constants.Conventions.DataTypes.ListViewPrefix) == false) - { - datatypes.Add(Mapper.Map(dataDef)); - } - } - else - { - //else, just add a clean property editor - var basic = Mapper.Map(propertyEditor); - basic.HasPrevalues = hasPrevalues; - datatypes.Add(basic); - } + var basic = Mapper.Map(propertyEditor); + basic.HasPrevalues = hasPrevalues; + datatypes.Add(basic); } - var grouped = datatypes .GroupBy(x => x.Group.IsNullOrWhiteSpace() ? "" : x.Group.ToLower()) .ToDictionary(group => group.Key, group => group.AsEnumerable());