private static ElementDescriptor CustomMenuItemAsDescriptor(HtmlHelper html, CustomMenuItem customItem) { return html.ObjectActionAsElementDescriptor(customItem, false); }
internal static ElementDescriptor ObjectActionAsElementDescriptor(this HtmlHelper html, CustomMenuItem menuItem, bool isEdit) { string controllerName = menuItem.Controller; string actionName = menuItem.Action; string actionLabel = menuItem.Name ?? menuItem.Action; object routeValues = menuItem.RouteValues; return new ElementDescriptor { TagType = "form", Value = GetSubmitButton(null, actionLabel, IdConstants.ActionInvokeAction, new RouteValueDictionary(new { action = "action" })).WrapInDivTag(), Attributes = new RouteValueDictionary(new { action = html.GenerateUrl(Action(actionName), controllerName, new RouteValueDictionary(routeValues)), method = "post", id = html.IdHelper().MakeId(controllerName, actionName), @class = IdConstants.ActionName }) }; }