private static ElementDescriptor SubMenuAsElementDescriptor(
            this HtmlHelper html, IMenuImmutable subMenu, INakedObject nakedObject, bool isEdit)
        {
            string tagType = "div";
            string value   = CommonHtmlHelper.WrapInDiv(subMenu.Name, IdHelper.MenuNameLabel).ToString();
            RouteValueDictionary attributes = new RouteValueDictionary(new {
                @class = IdHelper.SubMenuName,
                @id    = subMenu.Id
            });
            var visibleSubMenuItems = subMenu.MenuItems.Select(item => html.MenuItemAsElementDescriptor(item, nakedObject, isEdit));

            if (visibleSubMenuItems.Any(x => x != null))
            {
                return(new ElementDescriptor {
                    TagType = tagType,
                    Value = value,
                    Attributes = attributes,
                    Children = visibleSubMenuItems.WrapInCollection("div", new { @class = IdHelper.SubMenuItemsName })
                });
            }
            else
            {
                return(null);
            }
        }
        public static MvcHtmlString ActionResult(this HtmlHelper html, ActionResultModel model)
        {
            INakedObject nakedObject = html.Framework().NakedObjectManager.CreateAdapter(model.Result, null, null);
            string       title       = GetCollectionTitle(nakedObject, html);

            title = model.Action.Name + ": " + (string.IsNullOrWhiteSpace(title) ? nakedObject.Spec.UntitledName : title);
            return(CommonHtmlHelper.WrapInDiv(title, IdHelper.ObjectName));
        }
        /// <summary>
        ///     Display name of object with icon
        /// </summary>
        public static MvcHtmlString Object(this HtmlHelper html, object model)
        {
            INakedObject nakedObject = html.Framework().NakedObjectManager.CreateAdapter(model, null, null);
            string       title       = nakedObject.Spec.IsCollection ? GetCollectionTitle(nakedObject, html) : nakedObject.TitleString();

            title = string.IsNullOrWhiteSpace(title) ? nakedObject.Spec.UntitledName : title;
            return(CommonHtmlHelper.WrapInDiv(html.ObjectIcon(nakedObject) + title, IdHelper.ObjectName));
        }
        public static MvcHtmlString ActionResult(this HtmlHelper html, ActionResultModel model)
        {
            var    nakedObject = html.Facade().GetObject(model.Result);
            string title       = GetCollectionTitle(nakedObject, html);

            title = model.Action.Name + ": " + (string.IsNullOrWhiteSpace(title) ? nakedObject.Specification.UntitledName : title);
            return(CommonHtmlHelper.WrapInDiv(title, IdConstants.ObjectName));
        }
        /// <summary>
        ///     Display name of object with icon
        /// </summary>
        public static MvcHtmlString Object(this HtmlHelper html, object model)
        {
            var nakedObject = html.Facade().GetObject(model);

            string title = nakedObject.Specification.IsCollection ? GetCollectionTitle(nakedObject, html) : nakedObject.TitleString;

            title = string.IsNullOrWhiteSpace(title) ? nakedObject.Specification.UntitledName : title;
            return(CommonHtmlHelper.WrapInDiv(html.ObjectIcon(nakedObject) + title, IdConstants.ObjectName));
        }
 public static MvcHtmlString Tab(this HtmlHelper html, string linkText, string actionName, object model)
 {
     return(CommonHtmlHelper.WrapInDiv(html.ObjectIconAndLink(linkText, actionName, model, true), "nof-tab"));
 }
 /// <summary>
 ///     Display link to object with icon
 /// </summary>
 public static MvcHtmlString Object(this HtmlHelper html, string linkText, string actionName, object model)
 {
     return(CommonHtmlHelper.WrapInDiv(html.ObjectIconAndLink(linkText, actionName, model), IdHelper.ObjectName));
 }