"Actions" drop down options do not give context to the user (#6301)
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Actions;
|
||||
using System.Threading;
|
||||
|
||||
namespace Umbraco.Web.Models.Trees
|
||||
{
|
||||
@@ -28,12 +29,15 @@ namespace Umbraco.Web.Models.Trees
|
||||
Name = name;
|
||||
}
|
||||
|
||||
|
||||
public MenuItem(string alias, ILocalizedTextService textService)
|
||||
: this()
|
||||
{
|
||||
var values = textService.GetAllStoredValues(Thread.CurrentThread.CurrentUICulture);
|
||||
values.TryGetValue($"visuallyHiddenTexts/{alias}_description", out var textDescription);
|
||||
|
||||
Alias = alias;
|
||||
Name = textService.Localize($"actions/{Alias}");
|
||||
TextDescription = textDescription;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -74,6 +78,9 @@ namespace Umbraco.Web.Models.Trees
|
||||
[Required]
|
||||
public string Alias { get; set; }
|
||||
|
||||
[DataMember(Name = "textDescription")]
|
||||
public string TextDescription { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ensures a menu separator will exist before this menu item
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Actions;
|
||||
@@ -75,7 +76,7 @@ namespace Umbraco.Web.Models.Trees
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
internal MenuItem CreateMenuItem<T>(string name, bool hasSeparator = false, bool opensDialog = false)
|
||||
where T : IAction
|
||||
{
|
||||
@@ -96,14 +97,18 @@ namespace Umbraco.Web.Models.Trees
|
||||
var item = Current.Actions.GetAction<T>();
|
||||
if (item == null) return null;
|
||||
|
||||
var values = textService.GetAllStoredValues(Thread.CurrentThread.CurrentUICulture);
|
||||
values.TryGetValue($"visuallyHiddenTexts/{item.Alias}Description", out var textDescription);
|
||||
|
||||
var menuItem = new MenuItem(item, textService.Localize($"actions/{item.Alias}"))
|
||||
{
|
||||
SeparatorBefore = hasSeparator,
|
||||
OpensDialog = opensDialog
|
||||
OpensDialog = opensDialog,
|
||||
TextDescription = textDescription,
|
||||
};
|
||||
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user