示例#1
0
        private void CreateTabHeader(FWListElement tabNav, int tabNumber, FWTabItem item)
        {
            var listItem = tabNav.Add(new FWListItemElement());
            {
                listItem.AddCssClass("nav-item m-tabs__item");

                var anchor = listItem.Add(new FWAnchorElement($"#{item.Id}"));
                anchor.AddCssClass("nav-link m-tabs__link");
                anchor.Add(item.Title);
                anchor.Attributes.Add("data-toggle", "tab");
                anchor.Attributes.Add("role", "tab");
                anchor.Attributes.Add("aria-expanded", (tabNumber == _activeTab).ToString().ToLower());
                //Marks the anchor as binded to prevent adding the load screen
                anchor.Attributes.Add("data-binded", "true");
                anchor.Attributes.Add("data-type", "fw-tab-item");
                if (tabNumber == _activeTab)
                {
                    anchor.AddCssClass("active");
                }

                if (item.IsLazyLoaded)
                {
                    anchor.Attributes.Add("data-url", item.Url);
                    anchor.Attributes.Add("data-targetid", item.Id);
                    anchor.Attributes.Add("data-cache", item.Cached.ToString().ToLower());
                }
            }
        }
示例#2
0
        /// <summary>
        /// Adds a tab.
        /// </summary>
        /// <param name="title">The tab title.</param>
        /// <param name="content">The tab html content.</param>
        /// <returns>The fluent configurator object.</returns>
        public FWTabControl AddContentTab(string title, string content)
        {
            var tabNumber = _tabList.Count + 1;

            _tabList.Add(FWTabItem.CreateContentItem(title, content, $"{Id}_{tabNumber}"));
            return(this);
        }
示例#3
0
        /// <summary>
        /// Adds a tab.
        /// </summary>
        /// <param name="title">The tab title.</param>
        /// <param name="url">The url to load the tab content.</param>
        /// <param name="cached">Informs if the tab content should be cached.</param>
        /// <returns>The fluent configurator object.</returns>
        public FWTabControl AddLazyTab(string title, string url, bool cached)
        {
            var tabNumber = _tabList.Count + 1;

            _tabList.Add(FWTabItem.CreateLazyItem(title, url, $"{Id}_{tabNumber}", cached));

            return(this);
        }
示例#4
0
        public static FWTabItem CreateContentItem(string title, string content, string tabId)
        {
            var item = new FWTabItem()
            {
                Title        = title,
                Content      = content,
                IsLazyLoaded = false,
                Id           = tabId
            };

            return(item);
        }
示例#5
0
        public static FWTabItem CreateLazyItem(string title, string url, string tabId, bool cached)
        {
            var item = new FWTabItem()
            {
                Title        = title,
                Url          = url,
                IsLazyLoaded = true,
                Id           = tabId,
                Cached       = cached
            };

            return(item);
        }
示例#6
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);
                }
            }
        }