Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Actions" drop down options do not give context to the user #6301

Merged
merged 14 commits into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@
<umb-dropdown-item class="umb-action" ng-class="{'sep':action.separatorm, '-opens-dialog': action.opensDialog}" ng-repeat="action in actions">
<button type="button" ng-click="executeMenuItem(action)">
<i class="icon icon-{{action.cssclass}}" aria-hidden="true"></i>
<span class="menu-label">{{action.name}}</span>
<!-- Render the text that will be visually displayed -->
<span class="menu-label" aria-hidden="true">{{action.name}}</span>
<!-- Render the textDescription from the language files if it's attached to the action object-->
<span class="sr-only" ng-if="action.textDescription">
<localize key="visuallyHiddenTexts_{{action.alias}}Description" tokens="[currentNode.name]"></localize>
</span>
<!-- Otherwise render a combination of the nodename and the currentNode name-->
<span class="sr-only" ng-if="!action.textDescription">{{action.name}} {{currentNode.name}}</span>
</button>
</umb-dropdown-item>
</umb-dropdown>
Expand Down
10 changes: 9 additions & 1 deletion src/Umbraco.Web.UI/Umbraco/config/lang/da.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@
<key alias="routeErrorCannotRoute">Dette dokument er udgivet, men dets URL kan ikke dirigeres</key>
<key alias="publish">Udgiv</key>
<key alias="published">Udgivet</key>
<key alias="publishedPendingChanges">Udgivet (Afventende ændringer)</key>
<key alias="publishedPendingChanges">Udgivet (Ventede ændringer)</key>
<key alias="publishStatus">Udgivelsesstatus</key>
<key alias="publishDescendantsHelp"><![CDATA[Klik <em>Udgiv med undersider</em> for at udgive <strong>%0%</strong> og alle sider under og dermed gøre deres indhold offentligt tilgængelige.]]></key>
<key alias="publishDescendantsWithVariantsHelp"><![CDATA[Klik <em>Udgiv med undersider</em> for at udgive <strong>de valgte sprog</strong> og de samme sprog for sider under og dermed gøre deres indhold offentligt tilgængelige.]]></key>
Expand Down Expand Up @@ -426,6 +426,7 @@
<key alias="linkinternal">Internt link:</key>
<key alias="linklocaltip">Ved lokalt link, indsæt da en "#" foran linket</key>
<key alias="linknewwindow">Åben i nyt vindue?</key>
<key alias="macroContainerSettings">Makroindstillinger</key>
<key alias="macroDoesNotHaveProperties">Denne makro har ingen egenskaber du kan redigere</key>
<key alias="paste">Indsæt tekst</key>
<key alias="permissionsEdit">Rediger rettigheder for</key>
Expand Down Expand Up @@ -663,6 +664,7 @@
<key alias="icon">Ikon</key>
<key alias="id">Id</key>
<key alias="import">Importer</key>
<key alias="includeFromsubFolders">Inkludér undermapper i søgning</key>
<key alias="excludeFromSubFolders">Søg kun i denne mappe</key>
<key alias="info">Info</key>
<key alias="innerMargin">Indre margen</key>
Expand Down Expand Up @@ -1749,6 +1751,12 @@ Mange hilsner fra Umbraco robotten
<key alias="openBackofficeSearch">Åben backoffice søgning</key>
<key alias="openCloseBackofficeHelp">Åben/Luk backoffice hjælp</key>
<key alias="openCloseBackofficeProfileOptions">Åben/Luk dine profil indstillinger</key>
<key alias="assignDomainDescription">Tilføj domæne på %0%</key>
<key alias="createDescription">Opret ny node under %0%</key>
<key alias="protectDescription">Opsæt offentlig adgang på %0%</key>
<key alias="rightsDescription">Opsæt rettigheder på %0%</key>
<key alias="sortDescription">Juster soterings rækkefølgen for %0%</key>
<key alias="createblueprintDescription">Opret indholds skabelon baseret på %0%</key>
<key alias="currentLanguage">Aktivt sprog</key>
<key alias="switchLanguage">Skift sprog til</key>
<key alias="createNewFolder">Opret ny mappe</key>
Expand Down
10 changes: 9 additions & 1 deletion src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
<key alias="saveToPublish">Save and send for approval</key>
<key alias="saveListView">Save list view</key>
<key alias="schedulePublish">Schedule</key>
<key alias="showPage">Preview</key>
<key alias="saveAndPreview">Save and preview</key>
<key alias="showPageDisabled">Preview is disabled because there's no template assigned</key>
<key alias="styleChoose">Choose style</key>
Expand Down Expand Up @@ -686,6 +687,7 @@
<key alias="icon">Icon</key>
<key alias="id">Id</key>
<key alias="import">Import</key>
<key alias="includeFromsubFolders">Include subfolders in search</key>
<key alias="excludeFromSubFolders">Search only this folder</key>
<key alias="info">Info</key>
<key alias="innerMargin">Inner margin</key>
Expand Down Expand Up @@ -2228,6 +2230,12 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="openBackofficeSearch">Open backoffice search</key>
<key alias="openCloseBackofficeHelp">Open/Close backoffice help</key>
<key alias="openCloseBackofficeProfileOptions">Open/Close your profile options</key>
<key alias="assignDomainDescription">Setup Culture and Hostnames for %0%</key>
<key alias="createDescription">Create new node under %0%</key>
<key alias="protectDescription">Setup Public access on %0%</key>
<key alias="rightsDescription">Setup Permissions on %0%</key>
<key alias="sortDescription">Change sort order for %0%</key>
<key alias="createblueprintDescription">Create Content Template based on %0%</key>
<key alias="openContextMenu">Open context menu for</key>
<key alias="currentLanguage">Current language</key>
<key alias="switchLanguage">Switch language to</key>
Expand All @@ -2243,7 +2251,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="create">Create</key>
<key alias="edit">Edit</key>
<key alias="name">Name</key>
<key alias="addNewRow">Add new row</key>
<key alias="addNewRow">Add new row</key>
<key alias="tabExpand">View more options</key>
</area>
<area alias="references">
Expand Down
14 changes: 13 additions & 1 deletion src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
<key alias="saveToPublish">Send for approval</key>
<key alias="saveListView">Save list view</key>
<key alias="schedulePublish">Schedule</key>
<key alias="showPage">Preview</key>
<key alias="saveAndPreview">Save and preview</key>
<key alias="showPageDisabled">Preview is disabled because there's no template assigned</key>
<key alias="styleChoose">Choose style</key>
Expand Down Expand Up @@ -369,7 +370,8 @@
<key alias="noDocumentTypesAllowedAtRoot"><![CDATA[There are no allowed document types available for creating content here. You must enable these in <strong>Document Types</strong> within the <strong>Settings</strong> section, by changing the <strong>Allow as root</strong> option under <strong>Permissions</strong>.]]></key>
<key alias="noMediaTypes" version="7.0"><![CDATA[There are no allowed media types available for creating media here. You must enable these in <strong>Media Types Types</strong> within the <strong>Settings</strong> section, by editing the <strong>Allowed child node types</strong> under <strong>Permissions</strong>.]]></key>
<key alias="noMediaTypesWithNoSettingsAccess">The selected media in the tree doesn't allow for any other media to be created below it.</key>
<key alias="noMediaTypesEditPermissions">Edit permissions for this media type</key> <key alias="documentTypeWithoutTemplate">Document Type without a template</key>
<key alias="noMediaTypesEditPermissions">Edit permissions for this media type</key>
<key alias="documentTypeWithoutTemplate">Document Type without a template</key>
<key alias="newFolder">New folder</key>
<key alias="newDataType">New data type</key>
<key alias="newJavascriptFile">New JavaScript file</key>
Expand Down Expand Up @@ -570,6 +572,9 @@
<key alias="anchor">#value or ?key=value</key>
<key alias="enterAlias">Enter alias...</key>
<key alias="generatingAlias">Generating alias...</key>
<key alias="a11yCreateItem">Create item</key>
<key alias="a11yEdit">Edit</key>
<key alias="a11yName">Name</key>
</area>
<area alias="editcontenttype">
<key alias="createListView" version="7.2">Create custom list view</key>
Expand Down Expand Up @@ -690,6 +695,7 @@
<key alias="icon">Icon</key>
<key alias="id">Id</key>
<key alias="import">Import</key>
<key alias="includeFromsubFolders">Include subfolders in search</key>
<key alias="excludeFromSubFolders">Search only this folder</key>
<key alias="info">Info</key>
<key alias="innerMargin">Inner margin</key>
Expand Down Expand Up @@ -2244,6 +2250,12 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="openBackofficeSearch">Open backoffice search</key>
<key alias="openCloseBackofficeHelp">Open/Close backoffice help</key>
<key alias="openCloseBackofficeProfileOptions">Open/Close your profile options</key>
<key alias="assignDomainDescription">Setup Culture and Hostnames for %0%</key>
<key alias="createDescription">Create new node under %0%</key>
<key alias="protectDescription">Setup Public access on %0%</key>
<key alias="rightsDescription">Setup Permissions on %0%</key>
<key alias="sortDescription">Change sort order for %0%</key>
<key alias="createblueprintDescription">Create Content Template based on %0%</key>
<key alias="openContextMenu">Open context menu for</key>
<key alias="currentLanguage">Current language</key>
<key alias="switchLanguage">Switch language to</key>
Expand Down
9 changes: 8 additions & 1 deletion src/Umbraco.Web/Models/Trees/MenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web.Actions;
using System.Threading;

namespace Umbraco.Web.Models.Trees
{
Expand All @@ -28,12 +29,15 @@ public MenuItem(string alias, string name)
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>
Expand Down Expand Up @@ -74,6 +78,9 @@ public MenuItem(IAction action, string name = "")
[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>
Expand Down
11 changes: 8 additions & 3 deletions src/Umbraco.Web/Models/Trees/MenuItemList.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web.Actions;
Expand Down Expand Up @@ -75,7 +76,7 @@ public MenuItem Add<T>(ILocalizedTextService textService, bool hasSeparator = fa
}
return null;
}

internal MenuItem CreateMenuItem<T>(string name, bool hasSeparator = false, bool opensDialog = false)
where T : IAction
{
Expand All @@ -96,14 +97,18 @@ internal MenuItem CreateMenuItem<T>(ILocalizedTextService textService, bool hasS
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;
}

}
}
2 changes: 1 addition & 1 deletion src/Umbraco.Web/Trees/ContentTreeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private void EnsureName(IEntitySlim entity, string culture)
private void AddActionNode<TAction>(IUmbracoEntity item, MenuItemCollection menu, bool hasSeparator = false, bool opensDialog = false)
where TAction : IAction
{
var menuItem = menu.Items.Add<TAction>(Services.TextService.Localize("actions", _actions.GetAction<TAction>().Alias), hasSeparator, opensDialog);
var menuItem = menu.Items.Add<TAction>(Services.TextService, hasSeparator, opensDialog);
}

public IEnumerable<SearchResultEntity> Search(string query, int pageSize, long pageIndex, out long totalFound, string searchFrom = null)
Expand Down