diff --git a/src/Umbraco.Core/ContentApps/DictionaryContentAppFactory.cs b/src/Umbraco.Core/ContentApps/DictionaryContentAppFactory.cs deleted file mode 100644 index b1fb31d2aac6..000000000000 --- a/src/Umbraco.Core/ContentApps/DictionaryContentAppFactory.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Cms.Core.Models; -using Umbraco.Cms.Core.Models.ContentEditing; -using Umbraco.Cms.Core.Models.Membership; - -namespace Umbraco.Cms.Core.ContentApps -{ - internal class DictionaryContentAppFactory : IContentAppFactory - { - private const int Weight = -100; - - private ContentApp _dictionaryApp; - - public ContentApp GetContentAppFor(object source, IEnumerable userGroups) - { - switch (source) - { - case IDictionaryItem _: - return _dictionaryApp ??= new ContentApp - { - Alias = "dictionaryContent", - Name = "Content", - Icon = "icon-document", - View = "views/dictionary/views/content/content.html", - Weight = Weight - }; - default: - return null; - } - } - } -} diff --git a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs index 7241704e62fd..1d66e874be6c 100644 --- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs +++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs @@ -44,8 +44,7 @@ internal static void AddAllCoreCollectionBuilders(this IUmbracoBuilder builder) .Append() .Append() .Append() - .Append() - .Append(); + .Append(); // all built-in finders in the correct order, // devs can then modify this list on application startup diff --git a/src/Umbraco.Core/Manifest/ManifestContentAppFactory.cs b/src/Umbraco.Core/Manifest/ManifestContentAppFactory.cs index 0bb555f16f09..d865bb01aac4 100644 --- a/src/Umbraco.Core/Manifest/ManifestContentAppFactory.cs +++ b/src/Umbraco.Core/Manifest/ManifestContentAppFactory.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; @@ -70,10 +70,6 @@ public ContentApp GetContentAppFor(object o,IEnumerable user partA = "contentType"; partB = contentType.Alias; break; - case IDictionaryItem _: - partA = "dictionary"; - partB = "*"; //Not really a different type for dictionary items - break; default: return null; diff --git a/src/Umbraco.Core/Models/ContentEditing/DictionaryDisplay.cs b/src/Umbraco.Core/Models/ContentEditing/DictionaryDisplay.cs index d8cfaf110462..41e49ba34deb 100644 --- a/src/Umbraco.Core/Models/ContentEditing/DictionaryDisplay.cs +++ b/src/Umbraco.Core/Models/ContentEditing/DictionaryDisplay.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Runtime.Serialization; @@ -17,7 +17,6 @@ public DictionaryDisplay() { Notifications = new List(); Translations = new List(); - ContentApps = new List(); } /// @@ -38,11 +37,5 @@ public DictionaryDisplay() /// [DataMember(Name = "translations")] public List Translations { get; private set; } - - /// - /// Apps for the dictionary item - /// - [DataMember(Name = "apps")] - public List ContentApps { get; private set; } } } diff --git a/src/Umbraco.Core/Models/Mapping/CommonMapper.cs b/src/Umbraco.Core/Models/Mapping/CommonMapper.cs index 45c3c2598f8e..3cfcc8908559 100644 --- a/src/Umbraco.Core/Models/Mapping/CommonMapper.cs +++ b/src/Umbraco.Core/Models/Mapping/CommonMapper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Umbraco.Cms.Core.ContentApps; @@ -47,7 +47,7 @@ public ContentTypeBasic GetContentType(IContentBase source, MapperContext contex return contentTypeBasic; } - public IEnumerable GetContentApps(IEntity source) + public IEnumerable GetContentApps(IUmbracoEntity source) { var apps = _contentAppDefinitions.GetContentAppsFor(source).ToArray(); diff --git a/src/Umbraco.Core/Models/Mapping/DictionaryMapDefinition.cs b/src/Umbraco.Core/Models/Mapping/DictionaryMapDefinition.cs index 96c1aef21db2..4c000f0173b9 100644 --- a/src/Umbraco.Core/Models/Mapping/DictionaryMapDefinition.cs +++ b/src/Umbraco.Core/Models/Mapping/DictionaryMapDefinition.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Umbraco.Cms.Core.Mapping; @@ -14,12 +14,10 @@ namespace Umbraco.Cms.Core.Models.Mapping public class DictionaryMapDefinition : IMapDefinition { private readonly ILocalizationService _localizationService; - private readonly CommonMapper _commonMapper; - public DictionaryMapDefinition(ILocalizationService localizationService, CommonMapper commonMapper) + public DictionaryMapDefinition(ILocalizationService localizationService) { _localizationService = localizationService; - _commonMapper = commonMapper; } public void DefineMaps(IUmbracoMapper mapper) @@ -46,7 +44,6 @@ private void Map(IDictionaryItem source, DictionaryDisplay target, MapperContext target.Name = source.ItemKey; target.ParentId = source.ParentId ?? Guid.Empty; target.Udi = Udi.Create(Constants.UdiEntityType.DictionaryItem, source.Key); - target.ContentApps.AddRange(_commonMapper.GetContentApps(source)); // build up the path to make it possible to set active item in tree // TODO: check if there is a better way diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.edit.controller.js index 2f6fb2d3a81f..416d2c3a6536 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.edit.controller.js @@ -1,4 +1,4 @@ -/** +/** * @ngdoc controller * @name Umbraco.Editors.Dictionary.EditController * @function @@ -7,131 +7,128 @@ * The controller for editing dictionary items */ function DictionaryEditController($scope, $routeParams, $location, dictionaryResource, navigationService, appState, editorState, contentEditingHelper, formHelper, notificationsService, localizationService) { - - var vm = this; - - //setup scope vars - vm.nameDirty = false; - vm.header = {}; - vm.header.editorfor = "template_insertDictionaryItem"; - vm.header.setPageTitle = true; - - vm.page = {}; - vm.page.navigation = {}; - vm.page.loading = false; - vm.page.nameLocked = false; - vm.page.menu = {}; - vm.page.menu.currentSection = appState.getSectionState("currentSection"); - vm.page.menu.currentNode = null; - vm.description = ""; - vm.showBackButton = true; - vm.maxlength = 1000; - - vm.save = saveDictionary; - vm.back = back; - vm.change = change; - - function loadDictionary() { - - vm.page.loading = true; - - //we are editing so get the content item from the server - dictionaryResource.getById($routeParams.id) - .then(function (data) { - bindDictionary(data); - vm.page.navigation = data.apps; - data.apps[0].active = true; - vm.page.loading = false; - }); - } - - function createTranslationProperty(translation) { - return { - alias: translation.isoCode, - label: translation.displayName, - hideLabel: false + + var vm = this; + + //setup scope vars + vm.nameDirty = false; + vm.header = {}; + vm.header.editorfor = "template_insertDictionaryItem"; + vm.header.setPageTitle = true; + + vm.page = {}; + vm.page.loading = false; + vm.page.nameLocked = false; + vm.page.menu = {}; + vm.page.menu.currentSection = appState.getSectionState("currentSection"); + vm.page.menu.currentNode = null; + vm.description = ""; + vm.showBackButton = true; + vm.maxlength = 1000; + + vm.save = saveDictionary; + vm.back = back; + vm.change = change; + + function loadDictionary() { + + vm.page.loading = true; + + //we are editing so get the content item from the server + dictionaryResource.getById($routeParams.id) + .then(function (data) { + bindDictionary(data); + vm.page.loading = false; + }); } - } - - function bindDictionary(data) { - localizationService.localize("dictionaryItem_description").then(function (value) { - vm.description = value.replace("%0%", data.name); - }); - // create data for umb-property displaying - for (var i = 0; i < data.translations.length; i++) { - data.translations[i].property = createTranslationProperty(data.translations[i]); - change(data.translations[i]); + function createTranslationProperty(translation) { + return { + alias: translation.isoCode, + label: translation.displayName, + hideLabel : false + } } - contentEditingHelper.handleSuccessfulSave({ - scope: $scope, - savedContent: data - }); - - // set content - vm.content = data; + function bindDictionary(data) { + localizationService.localize("dictionaryItem_description").then(function (value) { + vm.description = value.replace("%0%", data.name); + }); - //share state - editorState.set(vm.content); + // create data for umb-property displaying + for (var i = 0; i < data.translations.length; i++) { + data.translations[i].property = createTranslationProperty(data.translations[i]); + change(data.translations[i]); + } - navigationService.syncTree({ tree: "dictionary", path: data.path, forceReload: true }).then(function (syncArgs) { - vm.page.menu.currentNode = syncArgs.node; - }); - } + contentEditingHelper.handleSuccessfulSave({ + scope: $scope, + savedContent: data + }); - function onInit() { - loadDictionary(); - } + // set content + vm.content = data; - function saveDictionary() { - if (formHelper.submitForm({ scope: $scope, statusMessage: "Saving..." })) { + //share state + editorState.set(vm.content); - vm.page.saveButtonState = "busy"; + navigationService.syncTree({ tree: "dictionary", path: data.path, forceReload: true }).then(function (syncArgs) { + vm.page.menu.currentNode = syncArgs.node; + }); + } - dictionaryResource.save(vm.content, vm.nameDirty) - .then(function (data) { + function onInit() { + loadDictionary(); + } - formHelper.resetForm({ scope: $scope }); + function saveDictionary() { + if (formHelper.submitForm({ scope: $scope, statusMessage: "Saving..." })) { - bindDictionary(data); + vm.page.saveButtonState = "busy"; - vm.page.saveButtonState = "success"; - }, - function (err) { + dictionaryResource.save(vm.content, vm.nameDirty) + .then(function (data) { - formHelper.resetForm({ scope: $scope, hasErrors: true }); + formHelper.resetForm({ scope: $scope }); - contentEditingHelper.handleSaveError({ - err: err - }); + bindDictionary(data); - notificationsService.error(err.data.message); + vm.page.saveButtonState = "success"; + }, + function (err) { - vm.page.saveButtonState = "error"; - }); - } - } + formHelper.resetForm({ scope: $scope, hasErrors: true }); - function back() { - $location.path(vm.page.menu.currentSection + "/dictionary/list"); - } + contentEditingHelper.handleSaveError({ + err: err + }); + + notificationsService.error(err.data.message); - function change(translation) { - if (translation.translation) { - var charsCount = translation.translation.length; - translation.nearMaxLimit = charsCount > Math.max(vm.maxlength * .8, vm.maxlength - 50); + vm.page.saveButtonState = "error"; + }); + } + } + + function back() { + $location.path(vm.page.menu.currentSection + "/dictionary/list"); } - } - $scope.$watch("vm.content.name", function (newVal, oldVal) { - //when the value changes, we need to set the name dirty - if (newVal && (newVal !== oldVal) && typeof (oldVal) !== "undefined") { - vm.nameDirty = true; + function change(translation) { + if (translation.translation) { + var charsCount = translation.translation.length; + translation.nearMaxLimit = charsCount > Math.max(vm.maxlength * .8, vm.maxlength - 50); + } } - }); - onInit(); + $scope.$watch("vm.content.name", function (newVal, oldVal) { + //when the value changes, we need to set the name dirty + if (newVal && (newVal !== oldVal) && typeof(oldVal) !== "undefined") { + vm.nameDirty = true; + } + }); + + onInit(); } angular.module("umbraco").controller("Umbraco.Editors.Dictionary.EditController", DictionaryEditController); diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/edit.html b/src/Umbraco.Web.UI.Client/src/views/dictionary/edit.html index 01c3a628e968..f59491c69396 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dictionary/edit.html +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/edit.html @@ -1,45 +1,63 @@ -
- - -
- - - - - - - - - - - - - - - - - - - - - -
+
+ + +
+ + + + + + + + +

+ + + +
+

+ {{ translation.displayName }} + %0% characters left. +

+
+
+
+
+
+ + + + + + + + + + + +
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/views/content/content.html b/src/Umbraco.Web.UI.Client/src/views/dictionary/views/content/content.html deleted file mode 100644 index 4e97626c4fba..000000000000 --- a/src/Umbraco.Web.UI.Client/src/views/dictionary/views/content/content.html +++ /dev/null @@ -1,20 +0,0 @@ - - -

- - - -
-

- {{ translation.displayName }} - %0% characters left. -

-
-
-
-