diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbtooltip.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbtooltip.directive.js index 34006a3cec..ef7006be2c 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbtooltip.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbtooltip.directive.js @@ -69,7 +69,7 @@ Use this directive to render a tooltip. (function() { 'use strict'; - function TooltipDirective($timeout) { + function TooltipDirective() { function link(scope, el, attr, ctrl) { @@ -77,14 +77,6 @@ Use this directive to render a tooltip. scope.tooltipStyles.left = 0; scope.tooltipStyles.top = 0; - function activate() { - - $timeout(function() { - setTooltipPosition(scope.event); - }); - - } - function setTooltipPosition(event) { var container = $("#contentwrapper"); @@ -141,7 +133,7 @@ Use this directive to render a tooltip. } - activate(); + setTooltipPosition(scope.event); } diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 600bfc9775..38f43f344f 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -166,6 +166,7 @@ + diff --git a/src/Umbraco.Web/Models/Trees/MenuItem.cs b/src/Umbraco.Web/Models/Trees/MenuItem.cs index 9dd5524f76..9d4c76eea1 100644 --- a/src/Umbraco.Web/Models/Trees/MenuItem.cs +++ b/src/Umbraco.Web/Models/Trees/MenuItem.cs @@ -3,11 +3,8 @@ using System.Runtime.Serialization; using Umbraco.Web.Trees; using System.Collections.Generic; using Umbraco.Core; -using Umbraco.Core.Models.Entities; using Umbraco.Core.Services; using Umbraco.Web.Actions; -using Umbraco.Web.Composing; - namespace Umbraco.Web.Models.Trees { @@ -157,7 +154,7 @@ namespace Umbraco.Web.Models.Trees public void LaunchDialogView(string view, string dialogTitle) { SetDialogTitle(dialogTitle); - AdditionalData[ActionViewKey] = view; + SetActionView(view); } /// @@ -186,6 +183,15 @@ namespace Umbraco.Web.Models.Trees AdditionalData[DialogTitleKey] = dialogTitle; } + /// + /// Configures the menu item to launch a specific view + /// + /// + private void SetActionView(string view) + { + AdditionalData[ActionViewKey] = view; + } + /// /// Configures the menu item to launch a URL with the specified action (dialog or new window) /// @@ -197,33 +203,6 @@ namespace Umbraco.Web.Models.Trees AdditionalData[ActionUrlMethodKey] = method; } - internal void ConvertLegacyMenuItem(IUmbracoEntity item, string nodeType, string currentSection) - { - // try to get a URL/title from the legacy action, - // in some edge cases, item can be null so we'll just convert those to "-1" and "" for id and name since these edge cases don't need that. - var attempt = LegacyTreeDataConverter.GetUrlAndTitleFromLegacyAction(Action, - item == null ? "-1" : item.Id.ToInvariantString(), - nodeType, - item == null ? "" : item.Name, currentSection); - if (attempt) - { - var action = attempt.Result; - LaunchDialogUrl(action.Url, action.DialogTitle); - } - else - { - // if that doesn't work, try to get the legacy confirm view - var attempt2 = LegacyTreeDataConverter.GetLegacyConfirmView(Action); - if (attempt2) - { - var view = attempt2.Result; - var textService = Current.Services.TextService; - LaunchDialogView(view, textService.Localize("defaultdialogs/confirmdelete") + " '" + (item == null ? "" : item.Name) + "' ?"); - } - } - } - #endregion - } } diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs index 1609e966e5..b90e1964b8 100644 --- a/src/Umbraco.Web/Trees/ContentTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTreeController.cs @@ -214,7 +214,9 @@ namespace Umbraco.Web.Trees // set names according to variations foreach (var entity in result) + { EnsureName(entity, cultureVal); + } return result; } @@ -235,7 +237,8 @@ namespace Umbraco.Web.Trees AddActionNode(item, menu, true); AddActionNode(item, menu, opensDialog: true); AddActionNode(item, menu, opensDialog: true); - AddActionNode(item, menu, true, convert: true, opensDialog: true); + AddActionNode(item, menu, true, opensDialog: true); + if (EmailSender.CanSendRequiredEmail) { menu.Items.Add(new MenuItem("notify", Services.TextService) @@ -267,7 +270,6 @@ namespace Umbraco.Web.Trees return menu; } - /// /// set name according to variations @@ -279,12 +281,17 @@ namespace Umbraco.Web.Trees if (culture == null) { if (string.IsNullOrWhiteSpace(entity.Name)) + { entity.Name = "[[" + entity.Id + "]]"; + } + return; } if (!(entity is IDocumentEntitySlim docEntity)) + { throw new InvalidOperationException($"Cannot render a tree node for a culture when the entity isn't {typeof(IDocumentEntitySlim)}, instead it is {entity.GetType()}"); + } // we are getting the tree for a given culture, // for those items that DO support cultures, we need to get the proper name, IF it exists @@ -304,16 +311,15 @@ namespace Umbraco.Web.Trees } if (string.IsNullOrWhiteSpace(entity.Name)) + { entity.Name = "[[" + entity.Id + "]]"; + } } - // TODO: Remove the need for converting to legacy - private void AddActionNode(IUmbracoEntity item, MenuItemCollection menu, bool hasSeparator = false, bool convert = false, bool opensDialog = false) + private void AddActionNode(IUmbracoEntity item, MenuItemCollection menu, bool hasSeparator = false, bool opensDialog = false) where TAction : IAction { - var menuItem = menu.Items.Add(Services.TextService.Localize("actions", _actions.GetAction().Alias), hasSeparator); - if (convert) menuItem.ConvertLegacyMenuItem(item, "content", "content"); - menuItem.OpensDialog = opensDialog; + var menuItem = menu.Items.Add(Services.TextService.Localize("actions", _actions.GetAction().Alias), hasSeparator, opensDialog); } public IEnumerable Search(string query, int pageSize, long pageIndex, out long totalFound, string searchFrom = null) diff --git a/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs b/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs deleted file mode 100644 index 4936ce6541..0000000000 --- a/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using Umbraco.Core; -using Umbraco.Core.Services; -using Umbraco.Web.Actions; - -using Umbraco.Web.Composing; - -namespace Umbraco.Web.Trees -{ - /// - /// Converts the legacy tree data to the new format - /// - internal class LegacyTreeDataConverter - { - // TODO: remove this whole class when everything is angularized - - /// - /// This will look at the legacy IAction's JsFunctionName and convert it to a confirmation dialog view if possible - /// - /// - /// - internal static Attempt GetLegacyConfirmView(IAction action) - { - switch (action) - { - case ActionDelete actionDelete: - return Attempt.Succeed( - Current.Configs.Global().Path.EnsureEndsWith('/') + "views/common/dialogs/legacydelete.html"); - } - - return Attempt.Fail(); - } - - /// - /// This will look at a legacy IAction's JsFunctionName and convert it to a URL if possible. - /// - /// - /// - /// - /// - /// - internal static Attempt GetUrlAndTitleFromLegacyAction(IAction action, string nodeId, string nodeType, string nodeName, string currentSection) - { - switch (action) - - { - case ActionNew actionNew: - return Attempt.Succeed( - new LegacyUrlAction( - "create.aspx?nodeId=" + nodeId + "&nodeType=" + nodeType + "&nodeName=" + nodeName + "&rnd=" + DateTime.UtcNow.Ticks, - Current.Services.TextService.Localize("actions/create"))); - } - return Attempt.Fail(); - } - - internal class LegacyUrlAction - { - public LegacyUrlAction(string url, string dialogTitle) - : this(url, dialogTitle, ActionUrlMethod.Dialog) - { - - } - - public LegacyUrlAction(string url, string dialogTitle, ActionUrlMethod actionMethod) - { - Url = url; - ActionMethod = actionMethod; - DialogTitle = dialogTitle; - } - - public string Url { get; private set; } - public ActionUrlMethod ActionMethod { get; private set; } - public string DialogTitle { get; private set; } - } - } -} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index c235f8652a..a7ed8f5e12 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -257,7 +257,6 @@ -