private FWListItemElement CreatePaginationItem(string cssclass, string title, string content, int page, bool disabled = false) { FWListItemElement li = new FWListItemElement(); FWAnchorElement a = new FWAnchorElement("javascript:;"); a.AddCssClass("fw-pager-link"); a.AddCssClass(cssclass); if (disabled) { a.AddCssClass("fw-pager-link--disabled"); } else { a.Attributes.Add("data-paginate-btn-page", page.ToString()); } if (title != null) { a.Title = title; } a.Add(content); li.Add(a); return(li); }
private FWDivElement HeaderActions() { if (AllowFullscreen) { var fullscreenOpts = new FWListItemElement(); fullscreenOpts.AddCssClass("m-portlet__nav-item"); var anchor = new FWAnchorElement("#"); anchor.Attributes.Add("data-portlet-tool", "fullscreen"); anchor.Attributes.Add("data-expand", ViewResources.Portlet_Fullscreen); anchor.Attributes.Add("data-compress", ViewResources.Portlet_FullscreenUndo); anchor.AddCssClass("m-portlet__nav-link m-portlet__nav-link--icon"); anchor.Add("<i class=\"fa fa-expand\" aria-hidden=\"true\"></i>"); anchor.Add("<i class=\"fa fa-compress\" aria-hidden=\"true\"></i>"); fullscreenOpts.Add(anchor); var acts = GetPortletActions(); acts.Add(fullscreenOpts); } var actions = new FWDivElement(); actions.AddCssClass("m-portlet__head-tools"); if (_actions != null) { actions.Add(_actions.ToString()); } return(actions); }
/// <summary> /// Creates a new menu link. /// </summary> /// <param name="label">The link text.</param> /// <param name="action">The url action.</param> /// <param name="controller">The url controller.</param> /// <param name="routeValues">The url routeValues.</param> /// <param name="icon">The link icon.</param> /// <param name="configureAnchor">Delegate to configurate the item anchor.</param> /// <returns>A user menu fluent configurator.</returns> public void Item(string label, string action, string controller, object routeValues, string icon = null, Action <FWAnchorElement> configureAnchor = null) { FWListItemElement li = new FWListItemElement(); li.AddCssClass("m-nav__item"); FWAnchorElement anchor = new FWAnchorElement(_urlHelper.Action(action, controller, routeValues)); anchor.AddCssClass("m-nav__link"); if (!string.IsNullOrWhiteSpace(icon)) { FWTagBuilder iconSpan = new FWTagBuilder("i"); iconSpan.AddCssClass(icon); anchor.Add(iconSpan); } var anchorSpan = new FWSpanElement(label); anchorSpan.AddCssClass("m-nav__link-text"); anchor.Add(anchorSpan); // Runs any customizations to the item anchor. configureAnchor?.Invoke(anchor); li.Add(anchor); _menuItems.Add(li); }
/// <summary> /// Creates a new menu link. /// </summary> /// <param name="label">The link text.</param> /// <param name="action">The url action.</param> /// <param name="controller">The url controller.</param> /// <param name="routeValues">The url routeValues.</param> /// <param name="icon">The link icon.</param> /// <param name="configureAnchor">Delegate to configurate the item anchor.</param> /// <returns>The fluent FWMenuControl object.</returns> public void Item(string label, string action, string controller, object routeValues, string icon = null, Action <FWAnchorElement> configureAnchor = null) { var menuItem = new FWListItemElement(); menuItem.AddCssClass("m-menu__item"); bool active = false; //Verify if the url is active //if (IsActive(HttpContext.Current.Request.Url.PathAndQuery, link)) //{ // active = true; // menuItem.AddCssClass("active"); // if (this.ItemType != MenuItemType.Main) // { // menuItem.AddCssClass("open"); // SetMenuActive(this._parent); // } //} FWAnchorElement anchor = new FWAnchorElement(_urlHelper.Action(action, controller, routeValues)); anchor.AddCssClass("m-menu__link"); // Adds a title if the link holder is the main menu. This will help distinguish the icons if the menu is minimized. if (ItemType == FWMenuItemType.Main) { anchor.Title = label; } var anchorDot = CreateItemIcon(icon); anchorDot.Add(new FWSpanElement()); anchor.Add(anchorDot); // Adds the span selected to the anchor. if (active) { AddActiveSpan(anchor); } FWSpanElement labelSpan = new FWSpanElement(label); labelSpan.AddCssClass("m-menu__link-text"); anchor.Add(labelSpan); // Runs any customizations to the item anchor. configureAnchor?.Invoke(anchor); menuItem.Add(anchor); this._currentTag.Add(menuItem); }
public IFWMenuBuilder Holder(string label, string icon) { var anchor = new FWAnchorElement("javascript:;"); anchor.AddCssClass("m-nav__link m-dropdown__toggle"); if (!string.IsNullOrWhiteSpace(icon)) { anchor.Add(CreateHolderIcon(icon)); } if (!string.IsNullOrWhiteSpace(label)) { var span = new FWSpanElement(); span.AddCssClass("topbar-text"); span.Add(label); anchor.Add(span); anchor.Add(CreateHolderIcon("fa fa-angle-down")); } _userMenu.Add(anchor); var itemsWrapper = new FWDivElement(); itemsWrapper.AddCssClass("m-dropdown__wrapper"); var modalArrow = itemsWrapper.Add(new FWSpanElement()); modalArrow.AddCssClass("m-dropdown__arrow m-dropdown__arrow--right m-dropdown__arrow--adjust"); var modalArrowIcon = modalArrow.Add(new FWTagBuilder("i")); modalArrowIcon.AddCssClass("fa fa-chevron-up"); var innerDiv = itemsWrapper.Add(new FWDivElement()); innerDiv.AddCssClass("m-dropdown__inner"); var modalBody = innerDiv.Add(new FWDivElement()); modalBody.AddCssClass("m-dropdown__body"); var modalContent = modalBody.Add(new FWDivElement()); modalContent.AddCssClass("m-dropdown__content"); _menuItems = new FWListElement(); _menuItems.AddCssClass("m-nav m-nav--skin-light"); modalContent.Add(_menuItems); _userMenu.Add(itemsWrapper); return(this); }
/// <summary> /// Creates a new menu group. /// </summary> /// <param name="label">The group text.</param> /// <param name="icon">The group icon.</param> /// <returns>The fluent FWMenuControl object.</returns> public IFWMenuBuilder Holder(string label, string icon) { FWMainMenu child = new FWMainMenu(FWMenuItemType.Holder, _urlHelper); _menuHolder = new FWListItemElement(); _menuHolder.AddCssClass("m-menu__item m-menu__item--submenu"); _menuAnchor = new FWAnchorElement("javascript:;"); _menuAnchor.AddCssClass("m-menu__link m-menu__toggle"); _menuAnchor.Add(CreateItemIcon(icon)); _menuAnchor.Add(string.Format("<span class=\"m-menu__link-text\">{0}</span>", label)); _menuArrow = new FWTagBuilder("i") { DataType = "fw-menu-arrow" }; _menuArrow.AddCssClass("fw-menu-arrow"); _menuAnchor.Add(_menuArrow); _menuHolder.Add(_menuAnchor); var subHolder = new FWDivElement(); subHolder.AddCssClass("m-menu__submenu"); if (ItemType != FWMenuItemType.Main) { subHolder.AddCssClass("m-menu__submenu--classic m-menu__submenu--right"); } var subHolderArrow = new FWSpanElement("<span aria-hidden=\"true\"></span>"); subHolderArrow.AddCssClass("fw-submenu-arrow"); subHolder.Add(subHolderArrow); var innerList = new FWListElement(); innerList.AddCssClass("m-menu__subnav"); subHolder.Add(innerList); _menuHolder.Add(subHolder); this._currentTag.Add(_menuHolder); child._currentTag = innerList; child._parent = this; return(child); }