/// <summary> /// Initializes a new instance of the <see cref="FWRazorInjections" />. /// </summary> /// <param name="httpContext">The application http context accessor.</param> /// <param name="tempDataFactory">The tempdata factory.</param> /// <param name="applicationMenu">The application menu.</param> /// <param name="appMenuBuilder">The custom application menu builder.</param> public FWRazorInjections(IHttpContextAccessor httpContext, ITempDataDictionaryFactory tempDataFactory, IFWMenuComponent applicationMenu = null, IFWMenuBuilder appMenuBuilder = null) { _httpContextAccessor = httpContext; _tmpDataFactory = tempDataFactory; _applicationMenu = applicationMenu; _appMenuBuilder = appMenuBuilder; }
/// <summary> /// In a Razor layout page, renders the main menu. /// </summary> /// <param name="urlHelper">The current UrlHelper.</param> /// <returns>The main menu html.</returns> public IHtmlContent RenderMenu(IUrlHelper urlHelper) { if (_applicationMenu == null) { return(new HtmlString(string.Empty)); } IFWMenuBuilder builder = _appMenuBuilder ?? new FWMainMenu(urlHelper); _applicationMenu.Build(builder); return(new HtmlString(builder.ToHtml())); }
/// <summary> /// Creates a new menu. /// </summary> /// <param name="builder">The concrete builder.</param> public IFWMenuBuilder Build(IFWMenuBuilder builder) { int level = Level; builders[Level] = builder; foreach (var item in Items) { var innerBuilder = item.Build(builders[item.Level]); if (innerBuilder != null) { builders[item.Level + 1] = innerBuilder; } } return(builder); }
public IFWMenuBuilder Build(IFWMenuBuilder builder) { builder.Item(Text, Action, Controller, RouteValues, Icon, Configure); return(null); }
public IFWMenuBuilder Build(IFWMenuBuilder builder) { builder.Separator(); return(null); }
public IFWMenuBuilder Build(IFWMenuBuilder builder) { return(builder.Holder(Text, Icon)); }
public IFWMenuBuilder Build(IFWMenuBuilder builder) { builder.Label(Text); return(null); }