Merge pull request #3420 from dawoe/temp-3419

V8- #3419 - Fix dictionary tree
This commit is contained in:
Shannon Deminick
2018-10-26 13:39:42 +11:00
committed by GitHub
7 changed files with 24 additions and 18 deletions

View File

@@ -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)
{

View File

@@ -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") {

View File

@@ -12,8 +12,7 @@
hide-icon="true"
hide-description="true"
hide-alias="true"
on-back="vm.back()"
show-back-button="vm.showBackButton">
>
</umb-editor-header>
<umb-editor-container class="form-horizontal">

View File

@@ -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;
/// <summary>
/// Creates a group node for grouped multiple trees
@@ -87,13 +88,15 @@ namespace Umbraco.Web.Models.Trees
/// <param name="menuUrl"></param>
/// <param name="title"></param>
/// <param name="children"></param>
/// <param name="alwaysShowRootNode"></param>
/// <returns></returns>
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
/// </remarks>
[DataMember(Name = "containsTrees")]
public bool ContainsTrees => Children.Count > 0;
public bool ContainsTrees => Children.Count > 0 || _alwaysShow;
}
}

View File

@@ -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)
@@ -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

View File

@@ -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)

View File

@@ -28,13 +28,15 @@ namespace Umbraco.Web.Trees
/// <param name="iconOpen">The icon open.</param>
/// <param name="initialize">if set to <c>true</c> [initialize].</param>
/// <param name="sortOrder">The sort order.</param>
/// <param name="alwaysShowRootItem">Always show the root item</param>
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; }
}
}