Ejemplo n.º 1
0
        private FWDivElement CreateGridFooter()
        {
            var rowFooter = new FWDivElement();

            rowFooter.AddCssClass("fw-pager clearfix");

            _paginator.CreatePagination(rowFooter);

            var paginationInfo = new FWDivElement();

            paginationInfo.AddCssClass("fw-pager-info");

            if (_paginator.Total > 0)
            {
                var paginationSize = CreateGridDisplayResultsSelect();
                paginationInfo.Add(paginationSize);

                //Creates the items displayed information.
                var elements = new FWSpanElement();
                elements.AddCssClass("fw-pager-detail");
                elements.Add(string.Format(ViewResources.Grid_Label_Displayed, _paginator.CurrentMin, _paginator.CurrentMax, _paginator.Total));
                paginationInfo.Add(elements);
            }
            else
            {
                var elements = new FWSpanElement();
                elements.AddCssClass("fw-pager-detail");
                elements.Add(ViewResources.Grid_No_Results);
                paginationInfo.Add(elements);
            }

            rowFooter.Add(paginationInfo);

            return(rowFooter);
        }
Ejemplo 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);
        }
Ejemplo n.º 3
0
        private void AddButtonContent(FWButtonElement button)
        {
            if (!string.IsNullOrWhiteSpace(_icon))
            {
                if (!string.IsNullOrWhiteSpace(Text))
                {
                    //Adds the button icon and text
                    button.AddCssClass("m-btn--icon");
                    var iconSpan = new FWSpanElement();
                    iconSpan.Add(CreateIcon());

                    iconSpan.Add(new FWSpanElement(Text));

                    button.Add(iconSpan);
                }
                else
                {
                    button.AddCssClass("m-btn--icon m-btn--icon-only");
                    button.Add(CreateIcon());
                }
            }
            else
            {
                //Adds the button text
                button.Add(Text);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns></returns>
        protected override IFWHtmlElement CreateControl()
        {
            FWLabelElement label = new FWLabelElement();

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

            label.For = _propertyName;

            if (_isRequired)
            {
                FWSpanElement span = new FWSpanElement();
                span.AddCssClass("required");
                span.Attributes.Add("aria-required", "true");
                span.Add("*");
                label.Add(span);
            }

            if (!string.IsNullOrWhiteSpace(_displayName))
            {
                label.Add(_displayName);

                if (_tooltip != null)
                {
                    label.Add($" <i class=\"fa fa-info-circle\" data-toggle=\"tooltip\" data-skin=\"dark\" title=\"{_tooltip}\"></i>");
                }
            }

            return(label);
        }
Ejemplo n.º 5
0
        private static FWSpanElement CreateHolderIcon(string icon)
        {
            var iconSpan = new FWSpanElement();

            iconSpan.AddCssClass("m-nav__link-icon");

            var iconTag = iconSpan.Add(new FWTagBuilder("i"));

            iconTag.AddCssClass(icon);

            return(iconSpan);
        }
Ejemplo n.º 6
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>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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        private FWDivElement CreateTimelineEntry(FWTimelineEntry entry)
        {
            var div        = new FWDivElement();
            var entryState = entry.State.GetDescription();

            div.AddCssClass($"m-timeline-3__item m-timeline-3__item--{entryState}");

            // Adds the entry date
            var entryDate = new FWSpanElement(entry.Date.ToShortTimeString());

            entryDate.AddCssClass("m-timeline-3__item-time");
            div.Add(entryDate);

            // Adds the entry text.
            var text = new FWDivElement();

            if (entry.Url != null)
            {
                text.Add($"<a href=\"{entry.Url(_requestContext.Url)}\">");
            }

            text.AddCssClass("m-timeline-3__item-desc");
            var textSpan = new FWSpanElement(entry.Text);

            textSpan.AddCssClass("m-timeline-3__item-text");
            text.Add(textSpan);

            // Adds the entry source.
            text.Add("<br />");
            var sourceSpan = new FWSpanElement();

            sourceSpan.AddCssClass("m-timeline-3__item-user-name");
            var innerSpan = sourceSpan.Add(new FWSpanElement(entry.Source));

            innerSpan.AddCssClass("m-link m-link--metal m-timeline-3__item-link");
            text.Add(sourceSpan);

            if (entry.Url != null)
            {
                text.Add("</a>");
            }

            div.Add(text);

            return(div);
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        private FWDivElement CreateItemHeader(FWAccordionItem item, int itemNumber)
        {
            var accItem = new FWDivElement
            {
                Id       = $"{item.Id}_head",
                DataType = "fw-accordion-item"
            };

            accItem.AddCssClass("m-accordion__item-head collapsed");
            accItem.Attributes.Add("role", "tab");
            accItem.Attributes.Add("href", $"#{item.Id}_body");
            accItem.Attributes.Add("data-toggle", "collapse");
            accItem.Attributes.Add("aria-expanded", "false");

            // Adds the header icon
            if (item.Icon != null)
            {
                var iconspan = new FWSpanElement();
                iconspan.AddCssClass("m-accordion__item-icon");
                iconspan.Add($"<i class=\"{item.Icon}\"></i>");
                accItem.Add(iconspan);
            }

            // Adds the header title
            var itemTitle = accItem.Add(new FWSpanElement());

            itemTitle.AddCssClass("m-accordion__item-title");
            itemTitle.Add(item.Title);

            // Adds the header status (open-closed) icon
            var statusIcon = accItem.Add(new FWSpanElement());

            statusIcon.Add("<i class=\"fa fa-chevron-down\"></i>");
            statusIcon.Add("<i class=\"fa fa-chevron-up\"></i>");

            if (item.IsLazyLoaded)
            {
                accItem.Attributes.Add("data-url", item.Url);
                accItem.Attributes.Add("data-targetid", $"{item.Id}_body");
                accItem.Attributes.Add("data-cache", item.Cached.ToString().ToLower());
            }

            return(accItem);
        }
Ejemplo n.º 12
0
        private void CreateGridSelection(FWPortletControl detailGrid)
        {
            detailGrid.Attributes.Add("data-allowselect", "true");

            //Adds the selection legend
            var legend = new FWElementGroup();

            var legendIcon = new FWSpanElement();

            legendIcon.AddCssClass("text-warning");
            legendIcon.Add("<i class=\"fa fa-square\"></i>");
            legend.Add(legendIcon);
            var legendText = new FWSpanElement();

            legendText.Add(ViewResources.Selected);
            legend.Add(legendText);
            detailGrid.AddAction(legend.ToString());

            //Adds the hidden post input
            var postInputHolder = new FWDivElement()
            {
                DataType = "fw-grid-selection",
                Id       = _selectionName ?? Id
            };

            if (_selection != null)
            {
                StringBuilder sb = new StringBuilder("[");
                //Adds the selected items to the grid
                foreach (var item in _selection)
                {
                    if (sb.Length > 1)
                    {
                        sb.Append(",");
                    }
                    sb.Append(item.ToString());
                }
                sb.Append("]");
                postInputHolder.Attributes.Add("data-selected", sb.ToString());
            }

            detailGrid.Add(postInputHolder);
        }
Ejemplo n.º 13
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);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns>The IFWHtmlElement object representation of the control.</returns>
        protected override IFWHtmlElement CreateControl()
        {
            var element = new FWDivElement()
            {
                DataType = "fw-display"
            };

            element.AddCssClass("fw-display");
            element.MergeAttributes(Attributes);
            if (!string.IsNullOrWhiteSpace(CustomCss))
            {
                element.AddCssClass(CustomCss);
            }

            if (DisplayLabel)
            {
                element.Add(_metadata.DisplayName);
            }

            var span = new FWSpanElement()
            {
                DataType = "fw-display-text"
            };

            if (DataBind)
            {
                DataBind.Add(FWBindConfiguration.TEXT, Name);
                span.DataBind = DataBind.CreateBind();
            }
            else if (_model != null)
            {
                string text = GetPropertyValue();
                //Adds the text value to the element. In case text is null, adds the default ToString value.
                span.Add(text);
            }

            element.Add(span);

            return(element);
        }
Ejemplo n.º 15
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);
        }