Removes IActions that shouldn't be IActions

This commit is contained in:
Shannon
2018-10-29 23:23:21 +11:00
parent bae9bb6108
commit cb9843b023
19 changed files with 67 additions and 152 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Umbraco.Core;
using Umbraco.Core.Services;
namespace Umbraco.Web.Models.Trees
{
@@ -28,9 +29,17 @@ namespace Umbraco.Web.Models.Trees
/// </summary>
public virtual string AngularServiceMethodName { get; } = null;
[SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")]
protected ActionMenuItem()
: base()
protected ActionMenuItem(string alias, string name) : base(alias, name)
{
Initialize();
}
protected ActionMenuItem(string alias, ILocalizedTextService textService) : base(alias, textService)
{
Initialize();
}
private void Initialize()
{
//add the current type to the metadata
if (AngularServiceMethodName.IsNullOrWhiteSpace())

View File

@@ -11,17 +11,16 @@ namespace Umbraco.Web.Models.Trees
public override string AngularServiceName => "umbracoMenuActions";
public CreateChildEntity(string name, bool seperatorBefore = false)
: base(ActionNew.ActionAlias, name)
{
Alias = ActionNew.ActionAlias;
Icon = "add"; Name = name;
SeperatorBefore = seperatorBefore;
}
public CreateChildEntity(ILocalizedTextService textService, bool seperatorBefore = false)
: base(ActionNew.ActionAlias, textService)
{
Alias = ActionNew.ActionAlias;
Icon = "add";
Name = textService.Localize($"actions/{Alias}");
SeperatorBefore = seperatorBefore;
}
}

View File

@@ -1,4 +1,6 @@
namespace Umbraco.Web.Models.Trees
using Umbraco.Core.Services;
namespace Umbraco.Web.Models.Trees
{
/// <summary>
/// Represents the export member menu item
@@ -6,5 +8,10 @@
public sealed class ExportMember : ActionMenuItem
{
public override string AngularServiceName => "umbracoMenuActions";
public ExportMember(ILocalizedTextService textService) : base("export", textService)
{
Icon = "download-alt";
}
}
}

View File

@@ -31,6 +31,14 @@ namespace Umbraco.Web.Models.Trees
Name = name;
}
public MenuItem(string alias, ILocalizedTextService textService)
: this()
{
Alias = alias;
Name = textService.Localize($"actions/{Alias}");
}
/// <summary>
/// Create a menu item based on an <see cref="IAction"/> definition
/// </summary>

View File

@@ -38,28 +38,6 @@ namespace Umbraco.Web.Models.Trees
return item;
}
/// <summary>
/// Adds a menu item based on an <see cref="IAction"/>
/// </summary>
/// <param name="name">The text to display for the menu item, will default to the IAction alias if not specified</param>
/// <typeparam name="T"></typeparam>
public MenuItem Add<T>(string name)
where T : IAction
{
return Add<T>(name, false);
}
/// <summary>
/// Adds a menu item based on an <see cref="IAction"/>
/// </summary>
/// <param name="textService">The <see cref="ILocalizedTextService"/> used to localize the action name based on it's alias</param>
/// <typeparam name="T"></typeparam>
public MenuItem Add<T>(ILocalizedTextService textService)
where T : IAction
{
return Add<T>(textService, false);
}
/// <summary>
/// Adds a menu item with a dictionary which is merged to the AdditionalData bag
/// </summary>

View File

@@ -11,18 +11,16 @@ namespace Umbraco.Web.Models.Trees
public override string AngularServiceName => "umbracoMenuActions";
public RefreshNode(string name, bool seperatorBefore = false)
: base("refreshNode", name)
{
Alias = "refreshNode";
Icon = "refresh";
Name = name;
SeperatorBefore = seperatorBefore;
}
public RefreshNode(ILocalizedTextService textService, bool seperatorBefore = false)
: base("refreshNode", textService)
{
Alias = "refreshNode";
Icon = "refresh";
Name = textService.Localize($"actions/{Alias}");
SeperatorBefore = seperatorBefore;
}
}