private FWDivElement CreateItemElement(ModelMetadata itemMetadata, object item, object itemModel, string index)
        {
            var detailControlItem = new FWDivElement();

            detailControlItem.Attributes.Add("data-type", "fw-detailcontrol-item");

            //Checks to see if the property is hidden
            if (!itemMetadata.AdditionalValues.ContainsKey(nameof(FWHiddenAttribute)))
            {
                // Checks if the property has a size.
                if (itemMetadata.AdditionalValues.ContainsKey(nameof(FWSizeAttribute)))
                {
                    // Sets the size of the line and then, marks all inner controls as full width.
                    var sizeAttr = itemMetadata.AdditionalValues[nameof(FWSizeAttribute)] as List <FWSizeAttribute>;
                    foreach (var size in sizeAttr)
                    {
                        detailControlItem.AddCssClass(FWGridSizeHelper.GetCss(size.Size, size.Device));
                        if (!_totalColumnSize.ContainsKey(size.Device))
                        {
                            _totalColumnSize[size.Device] = 0;
                        }
                        _totalColumnSize[size.Device] += (int)size.Size;
                    }
                }
            }
            else
            {
                detailControlItem.AddCssClass("hidden");
            }

            return(detailControlItem);
        }
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns>The control IFWHtmlElement interface.</returns>
        protected override IFWHtmlElement CreateControl()
        {
            var element = new FWDivElement();

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

            element.Id       = Id;
            element.DataType = "fw-textarea";
            element.AddCssClass("m-form__group form-group");

            if (DisplayLabel)
            {
                var label = new FWLabelControl(Name, DisplayName, IsRequired, Tooltip);
                label.AddCssClass("control-label");
                element.Add(label.ToString());
            }

            FWTextareaElement input = CreateInput();

            element.Add(input);

            return(element);
        }
Example #3
0
        private IFWHtmlElement CreateGrid()
        {
            FWPortletControl grid = new FWPortletControl(Id, FWStringLocalizer.GetViewResource(Id));

            grid.DataType("fw-grid");
            grid.Attributes.Add("data-key", _cacheKey);

            grid.Attributes.AddRange(Attributes);
            if (!string.IsNullOrWhiteSpace(CustomCss))
            {
                grid.AddCssClass(CustomCss);
            }
            // Clears custom attributes and css to prevent adding to the base table control.
            Attributes.Clear();
            ClearCss();

            grid.Attributes.Add("data-url", RequestContext.Url.Action("Load", "FWGrid", new { area = string.Empty }));

            //Adds the grid body to the control.
            FWDivElement detailGridBody = CreateGridBody();

            grid.Add(detailGridBody);

            if (_allowSelect)
            {
                CreateGridSelection(grid);
            }

            return(grid);
        }
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns></returns>
        protected override IFWHtmlElement CreateControl()
        {
            FWDivElement element = new FWDivElement();

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

            element.Id       = Id;
            element.DataType = "fw-select";
            element.AddCssClass("m-form__group form-group");
            element.Attributes.Add("data-language", FWGlobalizationHelper.CurrentLocaleName);

            if (DisplayLabel)
            {
                FWLabelControl label = new FWLabelControl(Name, DisplayName, IsRequired, Tooltip);
                label.AddCssClass("control-label");
                element.Add(label.ToString());
            }

            FWSelectElement select = CreateSelect();

            element.Add(select);

            return(element);
        }
Example #5
0
        private IFWHtmlElement CreateList()
        {
            FWPortletControl list = new FWPortletControl(Id, FWStringLocalizer.GetViewResource(Id))
            {
                Id = Id
            };

            list.DataType("fw-list");
            list.Attributes.Add("data-key", _cacheKey);

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

            list.Attributes.Add("data-url", RequestContext.Url.Action("Load", "FWList", new { area = string.Empty }));

            // Adds the list body to the control.
            FWDivElement detailListBody = CreateListItems();

            list.Add(detailListBody);

            return(list);
        }
        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);
        }
Example #7
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);
        }
        private FWInputElement CreateDatepickerInput(FWDivElement element)
        {
            FWInputElement input = CreateInput(element);

            input.AddCssClass("form-control datetimepicker-input");

            if (!string.IsNullOrWhiteSpace(_placeholder))
            {
                input.Attributes.Add("placeholder", _placeholder);
            }

            input.Attributes.Add("data-rule-required", IsRequired.ToString().ToLower());
            input.Attributes.Add("data-msg-required", string.Format(ViewResources.Validation_Required, DisplayName));

            if (DataBind)
            {
                DataBind.AddMainBind(FWBindConfiguration.DATEPICKER);
                input.DataBind = DataBind.CreateBind();
            }
            else if (Model != null)
            {
                input.Value = (!_hasTimePicker) ?
                              ((DateTime)Model).ToString("yyyy-MM-dd") :
                              ((DateTime)Model).ToString("yyyy-MM-ddTHH:mm:ss");
            }

            if (IsReadOnly)
            {
                input.Attributes.Add("readonly", "readonly");
            }

            return(input);
        }
        private void AddDropzoneLayout(FWDivElement body)
        {
            body.AddCssClass("dropzone m-dropzone");
            body.Attributes.Add("data-theme", "dropzone");
            body.Attributes.Add("data-remove", ViewResources.Btn_Upload_Remove);

            body.Add($"<div class=\"dz-message\">{GetModelResource("ChooseFiles")}</div>");
        }
Example #10
0
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns>The control IFWHtmlElement interface.</returns>
        protected override IFWHtmlElement CreateControl()
        {
            var element = new FWDivElement();

            element.AddCssClass("g-recaptcha");
            element.Attributes.Add("data-sitekey", _sitekey);

            return(element);
        }
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns>The IFWHtmlElement object representation of the control.</returns>
        protected override IFWHtmlElement CreateControl()
        {
            CreateLineActions();

            var detailControl = new FWPortletControl(Id, GetModelResource(OriginalId));

            detailControl.AddCssClass("fw-detail-table");
            detailControl.DataType("fw-detailcontrol");

            detailControl.Attributes.Add("data-model", ListType.Name);

            detailControl.AddAction(FWDetailHelper.CreateUndoButton());

            detailControl.Required(Metadata.IsRequired);

            detailControl.Footer(FWDetailHelper.CreateAddButton().ToString());

            detailControl.Attributes.AddRange(Attributes);
            if (!string.IsNullOrWhiteSpace(CustomCss))
            {
                detailControl.AddCssClass(CustomCss);
            }
            // Clears custom attributes and css to prevent adding to the base table control.
            Attributes.Clear();
            ClearCss();

            var grid = base.CreateControl() as FWTagBuilder;

            grid.DataType = "fw-detailcontrol-body";
            grid.Attributes.Add("role", "grid");

            detailControl.Add(grid);

            if (Metadata.IsRequired)
            {
                var validationDiv = new FWDivElement();
                {
                    validationDiv.DataType = "fw-detailvalidation";
                    validationDiv.AddCssClass("m-form__group form-group");

                    //Creates the validation input
                    var validationInput = new FWInputElement("DetailValidation", FWInputType.Hidden);
                    validationInput.Attributes.Add("data-rule-requireddetail", Metadata.IsRequired.ToString().ToLower());
                    validationInput.Attributes.Add("data-msg-requireddetail", string.Format(ViewResources.Validation_Required_Detail, GetModelResource(OriginalId)));
                    validationInput.Attributes.Add("data-skipvalidation", "false");

                    validationDiv.Add(validationInput);

                    detailControl.Add(validationDiv);
                }
            }

            detailControl.Add(RegisterTemplate());

            return(detailControl);
        }
        private FWDivElement CreateDropzone()
        {
            var dropzone = new FWDivElement();

            dropzone.Attributes.Add("data-type", "body");
            dropzone.Attributes.Add("data-name", Name);
            dropzone.Attributes.Add("action", RequestContext.Url.Action("Upload", "FWUpload", new { area = string.Empty }));

            return(dropzone);
        }
Example #13
0
        /// <summary>
        /// Creates the framework control.
        /// </summary>
        /// <param name="context">Contains information associated with the current HTML tag.</param>
        /// <param name="output">A stateful HTML element used to generate an HTML tag.</param>
        /// <returns>The control instance.</returns>
        protected override IFWHtmlElement RenderControl(TagHelperContext context, TagHelperOutput output)
        {
            var element = new FWDivElement
            {
                DataType = "upload-template"
            };

            element.Add(ChildContent.GetContent());
            return(element);
        }
Example #14
0
        private FWDivElement CreateModalFooter()
        {
            var footer = new FWDivElement();

            footer.AddCssClass("modal-footer");
            footer.Attributes.Add("data-type", "footer");

            footer.Add(Footer);

            return(footer);
        }
Example #15
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);
        }
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns>The control IFWHtmlElement interface.</returns>
        protected override IFWHtmlElement CreateControl()
        {
            var element = new FWDivElement();

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

            element.Id       = Id;
            element.DataType = "fw-fileupload";

            element.Attributes.Add("data-maxfiles", _maxFiles.ToString());
            element.Attributes.Add("data-maxfilesdsc", ViewResources.Upload_File_Limit);
            element.Attributes.Add("data-maxfilesize", _maxFileSize.ToString());
            element.Attributes.Add("data-maxfilesizedsc", ViewResources.Upload_File_Size_Limit);
            if (_allowedMimes != null)
            {
                element.Attributes.Add("data-allowedmimes", string.Join(",", _allowedMimes));
                element.Attributes.Add("data-allowedmimesdsc", ViewResources.Upload_File_Invalid);
            }

            if (DisplayLabel)
            {
                FWLabelControl label = new FWLabelControl(Name, DisplayName, IsRequired, Tooltip);
                label.AddCssClass("control-label");
                element.Add(label.ToString());
            }

            FWDivElement dropzone = CreateDropzone();

            switch (_layout)
            {
            case FWUploadLayout.Input:
                AddInputLayout(dropzone);
                break;

            case FWUploadLayout.Dropzone:
                AddDropzoneLayout(dropzone);
                break;

            default:
                dropzone.Attributes.Add("data-theme", "custom");
                dropzone.Add(LayoutBody);
                break;
            }

            element.Add(dropzone.ToString());

            return(element);
        }
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns></returns>
        protected override IFWHtmlElement CreateControl()
        {
            var element = new FWDivElement();

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

            element.Id       = Id;
            element.DataType = "fw-datepicker";

            element.AddCssClass("m-form__group form-group date date-picker");

            if (DisplayLabel)
            {
                var label = new FWLabelControl(Name, DisplayName, IsRequired, Tooltip);
                label.AddCssClass("control-label");
                element.Add(label.ToString());
            }

            var input = CreateDatepickerInput(element);
            //Adds the control icon
            var icon            = new FWTextboxIcon(_iconName);
            var iconPlaceholder = icon.Create(input);

            element.Add(iconPlaceholder.ToString());

            if (_minDate.HasValue)
            {
                element.Attributes.Add("data-mindate", _minDate.Value.ToString("yyyy-MM-dd"));
            }

            if (_maxDate.HasValue)
            {
                element.Attributes.Add("data-maxdate", _maxDate.Value.ToString("yyyy-MM-dd"));
            }

            if (_minDateControl != null)
            {
                element.Attributes.Add("data-mindate-target", _minDateControl);
            }

            if (_maxDateControl != null)
            {
                element.Attributes.Add("data-maxdate-target", _maxDateControl);
            }

            return(element);
        }
Example #18
0
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns>The control IFWHtmlElement interface.</returns>
        protected override IFWHtmlElement CreateControl()
        {
            FWDivElement container;
            var          element = container = new FWDivElement();

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

            element.Id       = Id;
            element.DataType = "fw-textbox";
            element.AddCssClass("m-form__group form-group");

            if (DisplayLabel)
            {
                FWLabelControl label = new FWLabelControl(Name, DisplayName, IsRequired, Tooltip);
                label.AddCssClass("control-label");
                element.Add(label.ToString());
            }

            if (_autocompleteUrl != null)
            {
                ConfigureAutocomplete(element);

                // Adds a div wrapper to the control.
                container = element.Add(new FWDivElement());
                container.AddCssClass("m-typeahead");
            }

            FWInputElement input = CreateInput();

            if (!string.IsNullOrWhiteSpace(_mask))
            {
                ConfigureMask(input);
            }

            if (_icon != null)
            {
                container.Add(_icon.Create(input).ToString());
            }
            else
            {
                container.Add(input);
            }

            return(element);
        }
Example #19
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 FWDivElement CreateActionButtons()
        {
            var actions = new FWDivElement();

            actions.AddCssClass("fw-actions");
            foreach (var actionSizes in _totalColumnSize)
            {
                // Calculates the remaining grid size in the last row.
                var colSize = FWGridSizeHelper.GRID_COLUMNS - (actionSizes.Value % FWGridSizeHelper.GRID_COLUMNS);
                actions.AddCssClass($"col-{FWGridSizeHelper.GetDeviceName(actionSizes.Key)}-{colSize}");
            }

            actions.Add(FWDetailHelper.CreateRemoveButton().ToString());

            return(actions);
        }
        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);
        }
Example #22
0
        private void ConfigureAutocomplete(FWDivElement element)
        {
            element.Attributes.Add("data-autocomplete-url", _autocompleteUrl);
            element.Attributes.Add("data-autocomplete-limit", _autocompleteLimit.ToString());
            if (_autocompleteForceSelection)
            {
                element.Attributes.Add("data-autocomplete-force", "true");
            }

            FWInputElement hidden = new FWInputElement($"{Id}Value", FWInputType.Hidden);

            element.Add(hidden);

            // TODO: Metronic 5 does not allow icons inside autocomplete combos yet
            //if (_icon == null)
            //    Icon("fa fa-search");
        }
        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);
        }
        /// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns></returns>
        protected override IFWHtmlElement CreateControl()
        {
            var portlet = new FWDivElement();

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

            portlet.Id       = Id;
            portlet.DataType = _datatype ?? "fw-portlet";
            portlet.AddCssClass("m-portlet m-portlet--mobile");

            if (_color.HasValue)
            {
                portlet.AddCssClass(_color.Value.GetDescription());
            }

            var header = new FWDivElement
            {
                DataType = "fw-header"
            };

            if (_header != null)
            {
                CreatePortletHeader(header);
            }
            portlet.Add(header);

            var body = portlet.Add(new FWDivElement());

            body.AddCssClass("m-portlet__body");
            body.DataType = "fw-portlet-body";
            body.Add(ChildBody);

            if (_footer != null)
            {
                FWDivElement footer = portlet.Add(new FWDivElement());
                footer.AddCssClass("m-portlet__foot");
                footer.Add(_footer);
            }

            return(portlet);
        }
Example #25
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);
        }
Example #26
0
        private FWDivElement CreateModalBody()
        {
            var body = new FWDivElement();

            body.AddCssClass("modal-body");
            body.Attributes.Add("data-type", "body");

            if (string.IsNullOrWhiteSpace(ContentUrl))
            {
                body.Add(Body);
            }
            else
            {
                body.Attributes.Add("data-url", ContentUrl);
            }

            return(body);
        }
Example #27
0
        private void CreateTabBody(FWDivElement tabBody, int tabNumber, FWTabItem item)
        {
            var bodyItem = tabBody.Add(new FWDivElement());
            {
                bodyItem.AddCssClass("tab-pane");
                bodyItem.Attributes.Add("role", "tabpanel");
                if (tabNumber == _activeTab)
                {
                    bodyItem.AddCssClass("active");
                }
                bodyItem.Id = item.Id;

                if (!item.IsLazyLoaded)
                {
                    bodyItem.Add(item.Content);
                }
            }
        }
Example #28
0
        private FWDivElement CreateGridDisplayResultsSelect()
        {
            var divSize = new FWDivElement();

            divSize.AddCssClass("btn-group bootstrap-select fw-pager-size");

            var select = new FWSelectElement("select_display");

            select.AddCssClass("form-control input-sm input-xsmall input-inline");
            select.Add("10", "10", _paginator.Display == 10);
            select.Add("20", "20", _paginator.Display == 20);
            select.Add("50", "50", _paginator.Display == 50);
            select.Add("30", "30", _paginator.Display == 30);
            select.Add("100", "100", _paginator.Display == 100);
            divSize.Add(select);

            return(divSize);
        }
Example #29
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);
        }
Example #30
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);
        }