Fixes initial part with legacy trees and legacy actions - now a modal window can launch - but now we need to get the legacy umb client manager js tree stuff hooked in.

This commit is contained in:
Shannon
2013-10-14 18:47:34 +11:00
parent df25edfaf6
commit d9c42e2aca
7 changed files with 124 additions and 28 deletions

View File

@@ -28,6 +28,21 @@ namespace Umbraco.Web.Models.Trees
/// </summary>
internal const string ActionViewKey = "actionView";
/// <summary>
/// Used to specify the js method to execute for the menu item
/// </summary>
internal const string JsActionKey = "jsAction";
/// <summary>
/// Adds the required meta data to the menu item so that angular knows to attempt to call the Js method.
/// </summary>
/// <param name="menuItem"></param>
/// <param name="jsToExecute"></param>
public static void LaunchLegacyJs(this MenuItem menuItem, string jsToExecute)
{
menuItem.SetJsAction(jsToExecute);
}
/// <summary>
/// Sets the menu item to display a dialog based on an angular view path
/// </summary>
@@ -52,6 +67,11 @@ namespace Umbraco.Web.Models.Trees
menuItem.SetActionUrl(url);
}
private static void SetJsAction(this MenuItem menuItem, string jsToExecute)
{
menuItem.AdditionalData[JsActionKey] = jsToExecute;
}
/// <summary>
/// Puts a dialog title into the meta data to be displayed on the dialog of the menu item (if there is one)
/// instead of the menu name

View File

@@ -169,11 +169,11 @@ namespace Umbraco.Web.Models.Trees
if (attribute.MethodName.IsNullOrWhiteSpace())
{
//if no method name is supplied we will assume that the menu action is the type name of the current menu class
menuItem.AdditionalData.Add("jsAction", string.Format("{0}.{1}", attribute.ServiceName, this.GetType().Name));
menuItem.AdditionalData.Add(MenuItemExtensions.JsActionKey, string.Format("{0}.{1}", attribute.ServiceName, this.GetType().Name));
}
else
{
menuItem.AdditionalData.Add("jsAction", string.Format("{0}.{1}", attribute.ServiceName, attribute.MethodName));
menuItem.AdditionalData.Add(MenuItemExtensions.JsActionKey, string.Format("{0}.{1}", attribute.ServiceName, attribute.MethodName));
}
}
}