예제 #1
0
        public void Dispose()
        {
            var newTabs = context.ViewOverrides == null ? tabs :
                          context.ViewOverrides.ExpandTabs(tabs, containerId, helper, context);

            if (newTabs.IsNullOrEmpty())
            {
                return;
            }

            TextWriter writer = helper.ViewContext.Writer;

            var first = newTabs.FirstOrDefault(a => a.Active) ?? newTabs.FirstOrDefault();

            using (Surround(writer, new HtmlTag("ul", context.Compose(containerId)).Class("nav nav-tabs")))
                foreach (var t in newTabs)
                {
                    t.WriteHeader(writer, first, context);
                }

            using (Surround(writer, new HtmlTag("div").Class("tab-content")))
                foreach (var t in newTabs)
                {
                    t.WriteBody(writer, first, context);
                }
        }
예제 #2
0
 public virtual void WriteBody(TextWriter writer, Tab first, TypeContext context)
 {
     using (TabContainer.Surround(writer, new HtmlTag("div", context.Compose(this.Id)).Class("tab-pane fade").Class(this == first ? "in active" : null)))
         this.Body.WriteTo(writer);
 }
예제 #3
0
 public virtual void WriteHeader(TextWriter writer, Tab first, TypeContext context)
 {
     using (TabContainer.Surround(writer, new HtmlTag("li").Class(this == first ? "active" : null)))
         using (TabContainer.Surround(writer, new HtmlTag("a").Attr("href", "#" + context.Compose(this.Id)).Attr("data-toggle", "tab").Attr("title", this.ToolTip)))
             this.Title.WriteTo(writer);
 }