예제 #1
0
 private void SetMenuActive(FWMainMenu menu)
 {
     menu._menuHolder.AddCssClass("active open");
     menu._menuArrow.AddCssClass("open");
     if (menu._parent != null)
     {
         SetMenuActive(menu._parent);
     }
 }
예제 #2
0
        /// <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);
        }
예제 #3
0
        private void AddActiveSpan(FWAnchorElement anchor)
        {
            var spanSelected = new FWSpanElement();

            spanSelected.AddCssClass("selected");

            if (this._parent == null)
            {
                anchor.Add(spanSelected);
            }
            else
            {
                FWMainMenu parent = this;
                while (parent._parent != null)
                {
                    parent = parent._parent;
                }
                parent._menuAnchor.Add(spanSelected);
            }
        }