/// <summary> /// Initializes a new instance of the <see cref="NavBarHelper" /> class. /// </summary> /// <param name="helper">The helper.</param> /// <param name="menuList">The menu list.</param> /// <param name="position">The position.</param> public NavBarHelper(HtmlHelper helper, IEnumerable <MenuItem> menuList, BrandPosition brandPosition, NavBarDisplay displayType, NavBarPosition navbarPosition, object htmlAttributes) { this.helper = helper; this.menuList = menuList; this.brandPosition = brandPosition; this.navbarPosition = navbarPosition; this.htmlAttributes = htmlAttributes; this.displayType = displayType; }
/// <summary> /// Renders a Twitter Bootstrap NavBar component. /// </summary> /// <param name="helper">The HTML helper.</param> /// <param name="menuList">The menu list.</param> /// <param name="brandPosition">The brand position.</param> /// <param name="navbarPosition"> </param> /// <param name="htmlAttributes">The HTML attributes.</param> /// <param name="displayType"> </param> /// <returns></returns> public static MvcHtmlString NavBar(this HtmlHelper helper, IEnumerable <MenuItem> menuList, BrandPosition brandPosition = BrandPosition.None, NavBarDisplay displayType = NavBarDisplay.Normal, NavBarPosition navbarPosition = NavBarPosition.Default, object htmlAttributes = null) { var navBar = new NavBarHelper(helper, menuList, brandPosition, displayType, navbarPosition, htmlAttributes); return(MvcHtmlString.Create(navBar.Render())); }
/// <summary> /// Gets the nav bar position CSS class. /// </summary> /// <param name="navbarPosition">The navbar position.</param> /// <returns></returns> private string GetNavBarPositionCssClass(NavBarPosition navbarPosition) { switch (navbarPosition) { case NavBarPosition.Top: return("navbar-fixed-top"); case NavBarPosition.Bottom: return("navbar-fixed-bottom"); default: return(string.Empty); } }
/// <summary> /// Renders a Twitter Bootstrap NavBar component. /// </summary> /// <param name="helper">The HTML helper.</param> /// <param name="menuList">The menu list.</param> /// <param name="brandPosition">The brand position.</param> /// <param name="htmlAttributes">The HTML attributes.</param> /// <returns></returns> public static MvcHtmlString NavBar(this HtmlHelper helper, IEnumerable<MenuItem> menuList, BrandPosition brandPosition=BrandPosition.None, NavBarDisplay displayType=NavBarDisplay.Normal, NavBarPosition navbarPosition=NavBarPosition.Default, object htmlAttributes=null) { var navBar = new NavBarHelper(helper, menuList, brandPosition, displayType, navbarPosition, htmlAttributes); return new MvcHtmlString(navBar.Render()); }