diff --git a/src/SeoToolkit.Umbraco.Common.Core/Composers/SeoToolkitComposer.cs b/src/SeoToolkit.Umbraco.Common.Core/Composers/SeoToolkitComposer.cs index 31e33f28..804981c3 100644 --- a/src/SeoToolkit.Umbraco.Common.Core/Composers/SeoToolkitComposer.cs +++ b/src/SeoToolkit.Umbraco.Common.Core/Composers/SeoToolkitComposer.cs @@ -1,8 +1,4 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Core.Composing; using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Extensions; @@ -12,7 +8,6 @@ using SeoToolkit.Umbraco.Common.Core.Repositories.SeoSettingsRepository; using SeoToolkit.Umbraco.Common.Core.Sections; using SeoToolkit.Umbraco.Common.Core.Services.SeoSettingsService; -using Umbraco.Cms.Core.Services; namespace SeoToolkit.Umbraco.Common.Core.Composers { diff --git a/src/SeoToolkit.Umbraco.Common.Core/Controllers/InfoTreeController.cs b/src/SeoToolkit.Umbraco.Common.Core/Controllers/InfoTreeController.cs new file mode 100644 index 00000000..f29933ba --- /dev/null +++ b/src/SeoToolkit.Umbraco.Common.Core/Controllers/InfoTreeController.cs @@ -0,0 +1,41 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Umbraco.Cms.Core; +using Umbraco.Cms.Core.Events; +using Umbraco.Cms.Core.Services; +using Umbraco.Cms.Core.Trees; +using Umbraco.Cms.Web.BackOffice.Trees; + +namespace SeoToolkit.Umbraco.Common.Core.Controllers +{ + //This controller is only here to prevent single node trees if you only download one package + [Tree("SeoToolkit", "info", TreeTitle = "Info", TreeGroup = "SeoToolkit", SortOrder = 99)] + public class InfoTreeController : TreeController + { + public InfoTreeController(ILocalizedTextService localizedTextService, UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection, IEventAggregator eventAggregator) : base(localizedTextService, umbracoApiControllerTypeCollection, eventAggregator) + { + } + + protected override ActionResult CreateRootNode(FormCollection queryStrings) + { + var root = base.CreateRootNode(queryStrings); + + root.Value.Icon = "icon-info"; + root.Value.HasChildren = false; + root.Value.RoutePath = $"SeoToolkit"; + root.Value.MenuUrl = null; + + return root.Value; + } + + protected override ActionResult GetTreeNodes(string id, FormCollection queryStrings) + { + return TreeNodeCollection.Empty; + } + + protected override ActionResult GetMenuForNode(string id, FormCollection queryStrings) + { + return null; + } + } +} diff --git a/src/SeoToolkit.Umbraco.Common.Core/SeoToolkit.Umbraco.Common.Core.csproj b/src/SeoToolkit.Umbraco.Common.Core/SeoToolkit.Umbraco.Common.Core.csproj index e72967f5..2ddfe5c9 100644 --- a/src/SeoToolkit.Umbraco.Common.Core/SeoToolkit.Umbraco.Common.Core.csproj +++ b/src/SeoToolkit.Umbraco.Common.Core/SeoToolkit.Umbraco.Common.Core.csproj @@ -1,4 +1,4 @@ - + net6.0 SeoToolkit Common Core diff --git a/src/SeoToolkit.Umbraco.ScriptManager.Core/Controllers/ScriptManagerTreeController.cs b/src/SeoToolkit.Umbraco.ScriptManager.Core/Controllers/ScriptManagerTreeController.cs index ac0b08c6..3385271b 100644 --- a/src/SeoToolkit.Umbraco.ScriptManager.Core/Controllers/ScriptManagerTreeController.cs +++ b/src/SeoToolkit.Umbraco.ScriptManager.Core/Controllers/ScriptManagerTreeController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using NUglify.JavaScript.Syntax; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Actions; using Umbraco.Cms.Core.Events;