private FWTagBuilder CreateIcon()
        {
            var tag = new FWTagBuilder("i");

            tag.AddCssClass(_icon);
            return(tag);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        private FWTagBuilder CreateItemIcon(string icon)
        {
            var iconTag = new FWTagBuilder("i");

            if (ItemType == FWMenuItemType.Main || icon != null)
            {
                iconTag.AddCssClass($"m-menu__link-icon {icon}");
            }
            else
            {
                iconTag.AddCssClass("m-menu__link-bullet");
            }
            return(iconTag);
        }
Esempio n. 4
0
        /// <summary>
        /// Create a new menu Label.
        /// </summary>
        /// <param name="label">The label text.</param>
        /// <returns>The fluent FWMenuControl object.</returns>
        public void Label(string label)
        {
            var menuLabel = new FWListItemElement();

            menuLabel.AddCssClass("m-menu__section");

            var h3 = new FWTagBuilder("h4");

            h3.Add(label);

            menuLabel.Add(h3);

            this._currentTag.Add(menuLabel);
        }
Esempio n. 5
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);
        }
        private void CreatePortletHeader(FWDivElement header)
        {
            header.AddCssClass("m-portlet__head");

            var caption = new FWDivElement();

            caption.AddCssClass("m-portlet__head-caption");

            var title = new FWDivElement();

            title.AddCssClass("m-portlet__head-title");

            if (!string.IsNullOrWhiteSpace(_icon))
            {
                var iconSpan = new FWSpanElement();
                iconSpan.AddCssClass("m-portlet__head-icon");

                FWTagBuilder i = new FWTagBuilder("i");
                i.AddCssClass(_icon);
                iconSpan.Add(i);

                caption.Add(iconSpan);
            }

            var headerTitle = new FWTagBuilder("h3");

            {
                if (_required)
                {
                    headerTitle.Add("<span aria-required=\"true\" class=\"required\">*</span>");
                }

                headerTitle.AddCssClass("m-portlet__head-text");
                headerTitle.Add(_header);

                title.Add(headerTitle);
            }

            caption.Add(title);
            header.Add(caption);

            var actions = HeaderActions();

            header.Add(actions);
        }
Esempio n. 7
0
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns>The control IFWHtmlElement interface.</returns>
        protected override IFWHtmlElement CreateControl()
        {
            var modal = new FWDivElement();

            modal.MergeAttributes(Attributes);
            if (!string.IsNullOrWhiteSpace(CustomCss))
            {
                modal.AddCssClass(CustomCss);
            }

            modal.Id       = Id;
            modal.DataType = "fw-modal";
            modal.AddCssClass("modal fade");
            modal.Attributes.Add("role", "dialog");
            modal.Attributes.Add("aria-labelledby", $"{Id}Label");

            var dialog = modal.Add(new FWDivElement());

            dialog.AddCssClass($"modal-dialog modal-dialog-centered modal-{_size.GetDescription()}");
            dialog.Attributes.Add("role", "document");

            FWTagBuilder content = dialog.Add(new FWDivElement());

            content.AddCssClass("modal-content");

            content.Add(CreateModalHeader());

            var holder = content;

            if (FormUrl != null)
            {
                holder = content.Add(new FWTagBuilder("form"));
                holder.Attributes.Add("method", "post");
                holder.Attributes.Add("action", FormUrl);
            }

            holder.Add(CreateModalBody());

            if (Footer != null)
            {
                holder.Add(CreateModalFooter());
            }

            return(modal);
        }
Esempio n. 8
0
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns>The control IFWHtmlElement interface.</returns>
        protected override IFWHtmlElement CreateControl()
        {
            var element = new FWDivElement()
            {
                Id       = Id,
                DataType = "fw-chart"
            };

            element.MergeAttributes(Attributes);
            if (!string.IsNullOrWhiteSpace(CustomCss))
            {
                element.AddCssClass(CustomCss);
            }

            element.Attributes.Add("data-url", _requestContext.Url.Action("Load", "FWChart", new { area = string.Empty }));

            var canvas = new FWTagBuilder("canvas");

            element.Add(canvas);

            return(element);
        }
Esempio n. 9
0
        public IFWCompositeElement Create(FWInputElement input)
        {
            var iconPlaceholder = new FWDivElement();

            iconPlaceholder.AddCssClass("m-input-icon m-input-icon--left");

            var span = new FWSpanElement();

            span.AddCssClass("m-input-icon__icon m-input-icon__icon--left");

            var innerSpan = new FWSpanElement();
            var i         = new FWTagBuilder("i");

            i.AddCssClass(Icon);
            innerSpan.Add(i);

            span.Add(innerSpan);

            iconPlaceholder.Add(span);
            iconPlaceholder.Add(input);

            return(iconPlaceholder);
        }
Esempio n. 10
0
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns>The IFWHtmlElement object representation of the control.</returns>
        protected override IFWHtmlElement CreateControl()
        {
            if (_autoGenerateColumns)
            {
                GenerateColumnsFromMetadata();
            }

            // Reorder the columns
            Columns = Columns.OrderBy(f => f.Order).ToList();

            var table = new FWTagBuilder("table")
            {
                DataType = "fw-table"
            };

            table.AddCssClass("table table-responsive-sm m-table m-table--head-separator-metal");

            table.Attributes.AddRange(Attributes);
            if (!string.IsNullOrWhiteSpace(CustomCss))
            {
                table.AddCssClass(CustomCss);
            }

            //Creates the table header
            FWTagBuilder head = new FWTagBuilder("thead");

            head.AddCssClass("thead-default");

            var tableHead = new FWTagBuilder("tr");

            if (!AutoSizeColumns)
            {
                tableHead.AddCssClass("row");
            }

            if (_color.HasValue)
            {
                tableHead.AddCssClass(_color.Value.GetDescription());
            }
            tableHead.Attributes.Add("role", "row");

            //Iterates through the columns to add the header
            foreach (var column in Columns)
            {
                //Creates a new <th> element
                FWTableCellElement headercell = CreateHeaderCell(column);
                tableHead.Add(headercell);
            }

            //Adds the header to the table
            head.Add(tableHead);
            table.Add(head);

            TableBody = new FWTagBuilder("tbody");

            //Iterates through the columns to add the values to the table
            if (Data != null)
            {
                LineIndex = 0;
                foreach (var dataitem in Data)
                {
                    if (CheckEndOfTable())
                    {
                        break;
                    }

                    var line = CreateLine(dataitem);
                    line.Attributes.Add("data-control-child", "table");
                    if (!AutoSizeColumns)
                    {
                        line.AddCssClass("row");
                    }

                    foreach (var column in Columns)
                    {
                        //Create a new <td> element
                        var cell = CreateLineCell(dataitem, column);
                        line.Add(cell);
                    }
                    TableBody.Add(line);

                    LineIndex++;
                }
            }

            //Adds the body to the table
            table.Add(TableBody);

            return(table);
        }