From d23f5f8124a291b894b8ccba14c1a724299bac9d Mon Sep 17 00:00:00 2001 From: Dave Woestenborghs Date: Wed, 24 Oct 2018 15:31:45 +0200 Subject: [PATCH 1/7] #3419 remove check on number of trees so dictoinary tree shows in the translation section and doesn't return a error when it's moved to the settings section --- src/Umbraco.Web/Trees/ApplicationTreeController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index 273a7afb37..305116a443 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs @@ -41,7 +41,7 @@ namespace Umbraco.Web.Trees var groupedTrees = Services.ApplicationTreeService.GetGroupedApplicationTrees(application, onlyInitialized); var allTrees = groupedTrees.Values.SelectMany(x => x).ToList(); - if (string.IsNullOrEmpty(tree) == false || allTrees.Count <= 1) + if (string.IsNullOrEmpty(tree) == false) { var apptree = !tree.IsNullOrWhiteSpace() ? allTrees.FirstOrDefault(x => x.Alias == tree) From 2af2a9b77fd9d74d50dba598cd076edccf59920b Mon Sep 17 00:00:00 2001 From: Dave Woestenborghs Date: Wed, 24 Oct 2018 15:39:45 +0200 Subject: [PATCH 2/7] #3419 don't show the back button in the edit screen of dictionary...doesn't make sense to go to settings section when the tree is in the translation section --- .../src/views/dictionary/dictionary.edit.controller.js | 10 ++-------- .../src/views/dictionary/edit.html | 3 +-- 2 files changed, 3 insertions(+), 10 deletions(-) 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 8c1e7edb73..1a68afe47c 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 @@ -19,10 +19,8 @@ function DictionaryEditController($scope, $routeParams, $location, dictionaryRes vm.page.menu.currentSection = appState.getSectionState("currentSection"); vm.page.menu.currentNode = null; vm.description = ""; - vm.showBackButton = true; - + vm.save = saveDictionary; - vm.back = back; function loadDictionary() { @@ -102,11 +100,7 @@ function DictionaryEditController($scope, $routeParams, $location, dictionaryRes }); } } - - function back() { - $location.path("settings/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") { 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 41320108e7..b61175f8c9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dictionary/edit.html +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/edit.html @@ -12,8 +12,7 @@ hide-icon="true" hide-description="true" hide-alias="true" - on-back="vm.back()" - show-back-button="vm.showBackButton"> + > From 96c0b701a010aef2760171740414617e81c5edc2 Mon Sep 17 00:00:00 2001 From: Dave Woestenborghs Date: Wed, 24 Oct 2018 18:27:00 +0200 Subject: [PATCH 3/7] #3419 added always show root item to tree attribute --- src/Umbraco.Web/Trees/DictionaryTreeController.cs | 2 +- src/Umbraco.Web/Trees/TreeAttribute.cs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/Trees/DictionaryTreeController.cs b/src/Umbraco.Web/Trees/DictionaryTreeController.cs index ca9a54f873..4362dbbd3c 100644 --- a/src/Umbraco.Web/Trees/DictionaryTreeController.cs +++ b/src/Umbraco.Web/Trees/DictionaryTreeController.cs @@ -13,7 +13,7 @@ namespace Umbraco.Web.Trees [UmbracoTreeAuthorize(Constants.Trees.Dictionary)] [Mvc.PluginController("UmbracoTrees")] [CoreTree(TreeGroup = Constants.Trees.Groups.Settings)] - [Tree(Constants.Applications.Translation, Constants.Trees.Dictionary, null, sortOrder: 0)] + [Tree(Constants.Applications.Translation, Constants.Trees.Dictionary, null, alwaysShowRootItem: true)] public class DictionaryTreeController : TreeController { protected override TreeNode CreateRootNode(FormDataCollection queryStrings) diff --git a/src/Umbraco.Web/Trees/TreeAttribute.cs b/src/Umbraco.Web/Trees/TreeAttribute.cs index 5df0275298..cac1a87bc5 100644 --- a/src/Umbraco.Web/Trees/TreeAttribute.cs +++ b/src/Umbraco.Web/Trees/TreeAttribute.cs @@ -28,13 +28,15 @@ namespace Umbraco.Web.Trees /// The icon open. /// if set to true [initialize]. /// The sort order. + /// Always show the root item public TreeAttribute(string appAlias, string alias, string title, string iconClosed = "icon-folder", string iconOpen = "icon-folder-open", bool initialize = true, - int sortOrder = 0) + int sortOrder = 0, + bool alwaysShowRootItem = false) { ApplicationAlias = appAlias; Alias = alias; @@ -43,6 +45,7 @@ namespace Umbraco.Web.Trees IconOpen = iconOpen; Initialize = initialize; SortOrder = sortOrder; + AlwaysShowRootItem = alwaysShowRootItem; } @@ -54,5 +57,7 @@ namespace Umbraco.Web.Trees public string IconOpen { get; private set; } public bool Initialize { get; private set; } public int SortOrder { get; private set; } + + public bool AlwaysShowRootItem { get; private set; } } } From d5cc658811132c6f89a82722a22721efd4c674d6 Mon Sep 17 00:00:00 2001 From: Dave Woestenborghs Date: Wed, 24 Oct 2018 18:28:52 +0200 Subject: [PATCH 4/7] #3419 added check on tree items count back --- src/Umbraco.Web/Trees/ApplicationTreeController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index 305116a443..273a7afb37 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs @@ -41,7 +41,7 @@ namespace Umbraco.Web.Trees var groupedTrees = Services.ApplicationTreeService.GetGroupedApplicationTrees(application, onlyInitialized); var allTrees = groupedTrees.Values.SelectMany(x => x).ToList(); - if (string.IsNullOrEmpty(tree) == false) + if (string.IsNullOrEmpty(tree) == false || allTrees.Count <= 1) { var apptree = !tree.IsNullOrWhiteSpace() ? allTrees.FirstOrDefault(x => x.Alias == tree) From 25a90ffbf5bf0fb064459c941ae136c2c74ba041 Mon Sep 17 00:00:00 2001 From: Dave Woestenborghs Date: Thu, 25 Oct 2018 08:54:17 +0200 Subject: [PATCH 5/7] #3419 added extra parameter to createSingleRoot node method so it will always show a single tree. If a single tree doesn't have children it does not show --- src/Umbraco.Web/Models/Trees/SectionRootNode.cs | 9 ++++++--- src/Umbraco.Web/Trees/ApplicationTreeController.cs | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/Models/Trees/SectionRootNode.cs b/src/Umbraco.Web/Models/Trees/SectionRootNode.cs index cd4fc3e483..229c363fd2 100644 --- a/src/Umbraco.Web/Models/Trees/SectionRootNode.cs +++ b/src/Umbraco.Web/Models/Trees/SectionRootNode.cs @@ -28,6 +28,7 @@ namespace Umbraco.Web.Models.Trees { private static readonly string RootId = Core.Constants.System.Root.ToString(CultureInfo.InvariantCulture); private bool _isGroup; + private bool _alwaysShow; /// /// Creates a group node for grouped multiple trees @@ -87,13 +88,15 @@ namespace Umbraco.Web.Models.Trees /// /// /// + /// /// - public static TreeRootNode CreateSingleTreeRoot(string nodeId, string getChildNodesUrl, string menuUrl, string title, TreeNodeCollection children) + public static TreeRootNode CreateSingleTreeRoot(string nodeId, string getChildNodesUrl, string menuUrl, string title, TreeNodeCollection children, bool alwaysShowRootNode = false) { return new TreeRootNode(nodeId, getChildNodesUrl, menuUrl) { Children = children, - Name = title + Name = title, + _alwaysShow = alwaysShowRootNode }; } @@ -150,6 +153,6 @@ namespace Umbraco.Web.Models.Trees /// This is used in the UI to configure a full screen section/app /// [DataMember(Name = "containsTrees")] - public bool ContainsTrees => Children.Count > 0; + public bool ContainsTrees => Children.Count > 0 || _alwaysShow; } } diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index 273a7afb37..98db16f0e9 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs @@ -171,12 +171,17 @@ namespace Umbraco.Web.Trees throw new InvalidOperationException("Could not create root node for tree " + configTree.Alias); } + var treeAttribute = configTree.GetTreeAttribute(); + var sectionRoot = TreeRootNode.CreateSingleTreeRoot( rootId, rootNode.Result.ChildNodesUrl, rootNode.Result.MenuUrl, rootNode.Result.Name, - byControllerAttempt.Result); + byControllerAttempt.Result, + treeAttribute.AlwaysShowRootItem); + + //assign the route path based on the root node, this means it will route there when the section is navigated to //and no dashboards will be available for this section From fe0176f97cfe0f8ab97a535e6eac5ca757bafd11 Mon Sep 17 00:00:00 2001 From: Dave Woestenborghs Date: Thu, 25 Oct 2018 08:59:13 +0200 Subject: [PATCH 6/7] Fixed unit test --- src/Umbraco.Tests/UI/LegacyDialogTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Tests/UI/LegacyDialogTests.cs b/src/Umbraco.Tests/UI/LegacyDialogTests.cs index 99391104ab..be9b0d4d7e 100644 --- a/src/Umbraco.Tests/UI/LegacyDialogTests.cs +++ b/src/Umbraco.Tests/UI/LegacyDialogTests.cs @@ -23,7 +23,7 @@ namespace Umbraco.Tests.UI } } - [TestCase(typeof(macroTasks), Constants.Applications.Packages)] + [TestCase(typeof(macroTasks), Constants.Applications.Settings)] [TestCase(typeof(CreatedPackageTasks), Constants.Applications.Packages)] public void Check_Assigned_Apps_For_Tasks(Type taskType, string app) { From 3a0981e02bf0e8d26646ece0d7b423703c4c7f52 Mon Sep 17 00:00:00 2001 From: Dave Woestenborghs Date: Thu, 25 Oct 2018 09:06:53 +0200 Subject: [PATCH 7/7] #3419 fix error in backend for sections with no tree (forms when not installed) --- src/Umbraco.Web/Trees/ApplicationTreeController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index 98db16f0e9..37659d7d66 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs @@ -41,7 +41,7 @@ namespace Umbraco.Web.Trees var groupedTrees = Services.ApplicationTreeService.GetGroupedApplicationTrees(application, onlyInitialized); var allTrees = groupedTrees.Values.SelectMany(x => x).ToList(); - if (string.IsNullOrEmpty(tree) == false || allTrees.Count <= 1) + if (string.IsNullOrEmpty(tree) == false || allTrees.Count == 1) { var apptree = !tree.IsNullOrWhiteSpace() ? allTrees.FirstOrDefault(x => x.Alias == tree)