Example #1
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var li = context.CreateTagBuilder("li");

            if (DisabledValue)
            {
                li.AddCssClass("disabled");
            }
            else
            {
                if (ActiveValue)
                {
                    li.AddCssClass("active");
                }
            }

            li.WriteStartTag(writer);

            var link = context.CreateTagBuilder(DisabledValue ? "span" : "a");

            if (!DisabledValue)
            {
                link.MergeAttribute("href", HrefValue);
            }

            link.WriteStartTag(writer);

            return(link.GetEndTag() + li.GetEndTag());
        }
Example #2
0
 public AnyContent BeginControls(IBootstrapContext context)
 {
     this.WriteSelfStart(context.Writer, context);
     var area = context.CreateWriter<FormGroupControls, AnyContent>().WithoutLabel(LabelValue == null).BeginContent();
     area.OnDisposing(() => WriteSelfEnd(context.Writer, context));
     return area;
 }
Example #3
0
        protected override void WriteSelf(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var formGroup = context.PeekNearest <FormGroup>();

            if (formGroup != null && controlContext == null)
            {
                controlContext = formGroup.ControlContextValue;
            }

            var input = context.CreateTagBuilder("p");

            input.AddCssClass("form-control-static");
            if (controlContext != null)
            {
                input.MergeAttribute("id", controlContext.Name);
                var value = controlContext.Value;
                if (value != null)
                {
                    input.SetInnerText(value.ToString());
                }
            }
            if (DisabledValue)
            {
                // nothing - already read-only :)
            }

            ApplyCss(input);
            ApplyAttributes(input);

            writer.Write(input.GetFullTag());
        }
Example #4
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("option");

            if (ValueValue != null)
            {
                tb.MergeAttribute("value", ValueValue.ToString());
            }
            if (DisabledValue)
            {
                tb.MergeAttribute("disabled", "disabled");
            }

            var formGroup      = context.PeekNearest <Select>();
            var controlContext = formGroup == null ? null : formGroup.ControlContextValue;

            if (controlContext != null && controlContext.Value != null && ValueValue != null && ValueValue.ToString().Equals(controlContext.Value.ToString()))
            {
                tb.MergeAttribute("selected", "selected");
            }

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            return(tb.GetEndTag());
        }
Example #5
0
        protected override void WriteSelfStart(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("form");

            if (TypeValue != FormType.DefaultNone)
            {
                tb.AddCssClass(TypeValue.ToCssClass());
            }
            if (MethodValue != SubmitMethod.Get)
            {
                tb.MergeAttribute("method", MethodValue.ToString().ToLowerInvariant());
            }
            if (EnctypeValue != FormEnctype.NoValue)
            {
                tb.MergeAttribute("enctype", EnctypeValue.ToEnctype());
            }
            if (!string.IsNullOrEmpty(HrefValue))
            {
                tb.MergeAttribute("action", HrefValue);
            }

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            context.Push(this);
        }
Example #6
0
 protected override void WriteSelf(System.IO.TextWriter writer, IBootstrapContext context)
 {
     if (value == null)
     {
         return;
     }
     var block = value as IWritable;
     if (block != null)
     {
         block.WriteTo(writer, context);
         return;
     }
     var str = value as string;
     if (str != null)
     {
         if (writeWithoutEncoding)
         {
             writer.Write(str);
         }
         else
         {
             writer.Write(context.HtmlEncode(str));
         }
         return;
     }
     writer.Write(value);
 }
Example #7
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var li = context.CreateTagBuilder("li");

            if (DisabledValue)
            {
                li.AddCssClass("disabled");
            }
            else
            {
                if (ActiveValue)
                {
                    li.AddCssClass("active");
                }
            }

            li.WriteStartTag(writer);

            var link = context.CreateTagBuilder(DisabledValue ? "span" : "a");
            if (!DisabledValue)
            {
                link.MergeAttribute("href", HrefValue);
            }

            link.WriteStartTag(writer);

            return link.GetEndTag() + li.GetEndTag();
        }
Example #8
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("option");

            if (ValueValue != null)
            {
                tb.MergeAttribute("value", ValueValue.ToString());
            }
            if (DisabledValue)
            {
                tb.MergeAttribute("disabled", "disabled");
            }

            var formGroup = context.PeekNearest<Select>();
            var controlContext = formGroup == null ? null : formGroup.ControlContextValue;
            if (controlContext != null && controlContext.Value != null && ValueValue != null && ValueValue.ToString().Equals(controlContext.Value.ToString()))
            {
                tb.MergeAttribute("selected", "selected");
            }

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            return tb.GetEndTag();
        }
Example #9
0
        protected override void WriteSelfStart(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("div");

            tb.AddCssClass("btn-group");
            tb.AddCssClass(SizeValue.ToButtonGroupCssClass());
            if (VerticalValue)
            {
                tb.AddCssClass("btn-group-vertical");
            }
            if (JustifiedValue)
            {
                tb.AddCssClass("btn-group-justified");
            }
            if (DropUpValue)
            {
                tb.AddCssClass("dropup");
            }
            tb.MergeAttribute("role", "group");

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            context.Push(this);

            if (content != null)
            {
                content.WriteTo(writer, context);
            }
        }
Example #10
0
 void IWritable.WriteTo(TextWriter writer, IBootstrapContext context)
 {
     if (Item != null)
     {
         Item.WriteTo(writer, context);
     }
 }
Example #11
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("div");

            tb.AddCssClass(Type.ToCssClass());
            if (Closable)
            {
                tb.AddCssClass("alert-dismissable");
            }
            tb.MergeAttribute("role", "alert");

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            if (Closable)
            {
                var dsmb = context.CreateTagBuilder("button");
                dsmb.MergeAttribute("type", "button");
                dsmb.MergeAttribute("class", "close");
                dsmb.MergeAttribute("data-dismiss", "alert");
                dsmb.MergeAttribute("aria-hidden", "true");
                dsmb.InnerHtml = "&times;";
                dsmb.WriteFullTag(writer);
            }

            return(tb.GetEndTag());
        }
Example #12
0
        protected override void WriteSelf(System.IO.TextWriter writer, IBootstrapContext context)
        {
            if (value == null)
            {
                return;
            }
            var block = value as IWritable;

            if (block != null)
            {
                block.WriteTo(writer, context);
                return;
            }
            var str = value as string;

            if (str != null)
            {
                if (writeWithoutEncoding)
                {
                    writer.Write(str);
                }
                else
                {
                    writer.Write(context.HtmlEncode(str));
                }
                return;
            }
            writer.Write(value);
        }
Example #13
0
        protected override void WriteSelf(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var formGroup = context.PeekNearest<FormGroup>();
            if (formGroup != null && ControlContextValue == null)
            {
                ControlContextValue = formGroup.ControlContextValue;
            }

            ITagBuilder div = null;
            if (!InlineValue)
            {
                div = context.CreateTagBuilder("div");
                div.AddCssClass("checkbox");
                div.WriteStartTag(writer);
            }

            var lbl = context.CreateTagBuilder("label");
            if (InlineValue)
            {
                lbl.AddCssClass("checkbox-inline");
            }
            lbl.WriteStartTag(writer);

            var input = context.CreateTagBuilder("input");
            input.MergeAttribute("type", "checkbox");
            if (ControlContextValue != null)
            {
                input.MergeAttribute("id", ControlContextValue.Name);
                input.MergeAttribute("name", ControlContextValue.Name);
                input.MergeAttribute("value", "true");
                var controlValue = ControlContextValue.Value;
                if (controlValue != null && bool.Parse(controlValue.ToString()))
                {
                    input.MergeAttribute("checked", "checked");
                }
            }
            if (DisabledValue)
            {
                input.MergeAttribute("disabled", "disabled");
            }

            ApplyCss(input);
            ApplyAttributes(input);

            ////input.MergeAttributes(helper.HtmlHelper.GetUnobtrusiveValidationAttributes(context.ExpressionText, context.Metadata));

            input.WriteFullTag(writer);

            writer.Write(" "); // writing space to separate text from checkbox itself

            writer.Write(context.HtmlEncode(TextValue));

            lbl.WriteEndTag(writer);

            if (div != null)
            {
                div.WriteEndTag(writer);
            }
        }
Example #14
0
        public AnyContent BeginControls(IBootstrapContext context)
        {
            this.WriteSelfStart(context.Writer, context);
            var area = context.CreateWriter <FormGroupControls, AnyContent>().WithoutLabel(LabelValue == null).BeginContent();

            area.OnDisposing(() => WriteSelfEnd(context.Writer, context));
            return(area);
        }
        protected override void WriteSelf(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("li");
            tb.AddCssClass("divider");
            tb.MergeAttribute("role", "presentation");

            tb.WriteFullTag(writer);
        }
Example #16
0
 protected override void WriteSelfEnd(System.IO.TextWriter writer, IBootstrapContext context)
 {
     if (FooterValue != null)
     {
         FooterValue.WriteTo(writer, context);
     }
     writer.Write("</table>");
 }
Example #17
0
        public virtual T BeginContent(System.IO.TextWriter writer, IBootstrapContext context)
        {
            WriteSelfStart(writer, context);
            var retVal = CreateContentContext(context);

            retVal.OnDisposing(() => WriteSelfEnd(writer, context));
            return(retVal);
        }
Example #18
0
 protected override void WriteSelfEnd(System.IO.TextWriter writer, IBootstrapContext context)
 {
     if (PanelFooterValue != null)
     {
         PanelFooterValue.WriteTo(writer, context);
     }
     writer.Write(endTag);
 }
Example #19
0
 protected override void WriteSelfStart(System.IO.TextWriter writer, IBootstrapContext context)
 {
     endTag = WriteSelfStartTag(writer, context);
     if (content != null)
     {
         content.WriteTo(writer, context);
     }
 }
Example #20
0
        protected override void WriteSelf(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("li");

            tb.AddCssClass("divider");
            tb.MergeAttribute("role", "presentation");

            tb.WriteFullTag(writer);
        }
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("li");
            tb.AddCssClass("dropdown-header");
            tb.MergeAttribute("role", "presentation");

            tb.WriteStartTag(writer);

            return tb.GetEndTag();
        }
Example #22
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder(TagName);

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            return(tb.GetEndTag());
        }
        protected override void WriteSelf(System.IO.TextWriter writer, IBootstrapContext context)
        {
            if (CurrentPageValue < 1)
            {
                throw new ArgumentOutOfRangeException("CurrentPage must be 1 or greater");
            }
            if (TotalPagesValue < 1)
            {
                throw new ArgumentOutOfRangeException("TotalPages must be 1 or greater");
            }
            if (CurrentPageValue > TotalPagesValue)
            {
                throw new ArgumentOutOfRangeException(string.Format("CurrentPage ({0}) must be less or equal to TotalPages ({1})", CurrentPageValue, TotalPagesValue));
            }

            var pageStart = (PageButtonsCountBackValue == -1) ? 1 : Math.Max(1, CurrentPageValue - PageButtonsCountBackValue);
            var pageEnd = (PageButtonsCountForwardValue == -1) ? TotalPagesValue : Math.Min(TotalPagesValue, CurrentPageValue + PageButtonsCountForwardValue);

            using (Paginator.BeginContent(writer, context))
            {
                if (!HidePreviousNextButtonsValue)
                {
                    var p = Math.Max(1, CurrentPageValue - 1);
                    var pi = new PaginatorItem()
                    {
                        DisabledValue = (p == CurrentPageValue),
                        HrefValue = string.Format(HrefTemplateValue, p)
                    };
                    pi.AddContent(ButtonPreviousTextValue);
                    pi.WriteTo(writer, context);
                }
                for (var i = pageStart; i <= pageEnd; i++)
                {
                    var pi = new PaginatorItem()
                    {
                        ActiveValue = (i == CurrentPageValue),
                        HrefValue = string.Format(HrefTemplateValue, i)
                    };
                    pi.AddContent(string.Format(ButtonPageTextTemplateValue, i));
                    pi.WriteTo(writer, context);
                }
                if (!HidePreviousNextButtonsValue)
                {
                    var p = Math.Min(TotalPagesValue, CurrentPageValue + 1);
                    var pi = new PaginatorItem()
                    {
                        DisabledValue = (p == CurrentPageValue),
                        HrefValue = string.Format(HrefTemplateValue, p)
                    };
                    pi.AddContent(ButtonNextTextValue);
                    pi.WriteTo(writer, context);
                }
            }
        }
Example #24
0
        protected override void WriteSelfStart(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("div");

            tb.AddCssClass("row");

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);
        }
Example #25
0
        protected override void WriteSelfStart(System.IO.TextWriter writer, IBootstrapContext context)
        {
            writer.Write("<nav>");

            var tb = context.CreateTagBuilder("ul");

            tb.AddCssClass("pagination");
            tb.AddCssClass(SizeValue.ToCssClass());

            tb.WriteStartTag(writer);
        }
Example #26
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder(TagName);

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            return tb.GetEndTag();
        }
Example #27
0
        protected override void WriteSelf(System.IO.TextWriter writer, IBootstrapContext context)
        {
            if (CurrentPageValue < 1)
            {
                throw new ArgumentOutOfRangeException("CurrentPage must be 1 or greater");
            }
            if (TotalPagesValue < 1)
            {
                throw new ArgumentOutOfRangeException("TotalPages must be 1 or greater");
            }
            if (CurrentPageValue > TotalPagesValue)
            {
                throw new ArgumentOutOfRangeException(string.Format("CurrentPage ({0}) must be less or equal to TotalPages ({1})", CurrentPageValue, TotalPagesValue));
            }

            var pageStart = (PageButtonsCountBackValue == -1) ? 1 : Math.Max(1, CurrentPageValue - PageButtonsCountBackValue);
            var pageEnd   = (PageButtonsCountForwardValue == -1) ? TotalPagesValue : Math.Min(TotalPagesValue, CurrentPageValue + PageButtonsCountForwardValue);

            using (Paginator.BeginContent(writer, context))
            {
                if (!HidePreviousNextButtonsValue)
                {
                    var p  = Math.Max(1, CurrentPageValue - 1);
                    var pi = new PaginatorItem()
                    {
                        DisabledValue = (p == CurrentPageValue),
                        HrefValue     = string.Format(HrefTemplateValue, p)
                    };
                    pi.AddContent(ButtonPreviousTextValue);
                    pi.WriteTo(writer, context);
                }
                for (var i = pageStart; i <= pageEnd; i++)
                {
                    var pi = new PaginatorItem()
                    {
                        ActiveValue = (i == CurrentPageValue),
                        HrefValue   = string.Format(HrefTemplateValue, i)
                    };
                    pi.AddContent(string.Format(ButtonPageTextTemplateValue, i));
                    pi.WriteTo(writer, context);
                }
                if (!HidePreviousNextButtonsValue)
                {
                    var p  = Math.Min(TotalPagesValue, CurrentPageValue + 1);
                    var pi = new PaginatorItem()
                    {
                        DisabledValue = (p == CurrentPageValue),
                        HrefValue     = string.Format(HrefTemplateValue, p)
                    };
                    pi.AddContent(ButtonNextTextValue);
                    pi.WriteTo(writer, context);
                }
            }
        }
Example #28
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("li");

            tb.AddCssClass("dropdown-header");
            tb.MergeAttribute("role", "presentation");

            tb.WriteStartTag(writer);

            return(tb.GetEndTag());
        }
Example #29
0
 public void WriteTo(TextWriter writer, IBootstrapContext context)
 {
     WriteSelf(writer, context);
     if (WriteWhitespaceSuffix)
     {
         writer.Write(" ");
     }
     if (next != null)
     {
         next.WriteTo(writer, context);
     }
 }
Example #30
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("div");
            tb.AddCssClass("panel-heading");

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            return tb.GetEndTag();
        }
Example #31
0
 public void WriteTo(TextWriter writer, IBootstrapContext context)
 {
     WriteSelf(writer, context);
     if (WriteWhitespaceSuffix)
     {
         writer.Write(" ");
     }
     if (next != null)
     {
         next.WriteTo(writer, context);
     }
 }
Example #32
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("span");

            tb.AddCssClass(TypeValue.ToCssClass());

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            return(tb.GetEndTag());
        }
Example #33
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("div");
            tb.AddCssClass(SizeValue.ToCssClass());
            tb.AddCssClass(OffsetValue.ToOffsetCssClass());

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            return tb.GetEndTag();
        }
Example #34
0
        protected override void WriteSelfStart(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("dl");

            if (HorizontalValue)
            {
                tb.AddCssClass("dl-horizontal");
            }

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);
        }
Example #35
0
        protected override void WriteSelfStart(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder(GetTagName());

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            if (content != null)
            {
                content.WriteTo(writer, context);
            }
        }
Example #36
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var form      = context.PeekNearest <IFormContext>();
            var formGroup = context.PeekNearest <FormGroup>();

            if (form != null && form.TypeValue == FormType.Inline)
            {
                return(string.Empty);
            }

            ITagBuilder tb  = null;
            ITagBuilder tb2 = null;

            if (form != null && form.TypeValue == FormType.Horizontal)
            {
                tb = context.CreateTagBuilder("div");
                tb.AddCssClass(form.ControlsWidthValue.ToCssClass());
                if (WithoutLabelValue)
                {
                    tb.AddCssClass(form.ControlsWidthValue.Invert().ToOffsetCssClass());
                }

                ApplyCss(tb);
                ApplyAttributes(tb);

                tb.WriteStartTag(writer);
            }

            if (formGroup != null && formGroup.WithSizedControlValue)
            {
                tb2 = context.CreateTagBuilder("div");
                tb2.AddCssClass("row");
                tb2.WriteStartTag(writer);
            }

            if (tb != null && tb2 != null)
            {
                return(tb2.GetEndTag() + tb.GetEndTag());
            }
            if (tb2 != null)
            {
                return(tb2.GetEndTag());
            }
            if (tb != null)
            {
                return(tb.GetEndTag());
            }
            return(string.Empty);
        }
Example #37
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("th");

            if (ColorValue != TableRowCellColor.DefaultNone)
            {
                tb.AddCssClass(ColorValue.ToCssClass());
            }

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            return(tb.GetEndTag());
        }
Example #38
0
        protected override void WriteSelfStart(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("ul");

            tb.AddCssClass("dropdown-menu");
            if (RightAlignValue)
            {
                tb.AddCssClass("dropdown-menu-right");
            }
            tb.MergeAttribute("role", "menu");

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);
        }
Example #39
0
        protected override void WriteSelfStart(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("div");

            tb.AddCssClass("btn-toolbar");
            tb.MergeAttribute("role", "toolbar");

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            if (content != null)
            {
                content.WriteTo(writer, context);
            }
        }
Example #40
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var form = context.PeekNearest <IFormContext>();
            var tb   = context.CreateTagBuilder("div");

            tb.AddCssClass("form-group");
            if (ControlContextValue != null)
            {
                if (ControlContextValue.HasErrors)
                {
                    tb.AddCssClass("has-error");
                }
                else if (ControlContextValue.HasWarning)
                {
                    tb.AddCssClass("has-warning");
                }
            }

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            context.Push(this);

            if (LabelValue != null)
            {
                LabelValue.WriteTo(writer, context);
            }

            if (ControlValue != null)
            {
                using (context.CreateWriter <FormGroupControls, AnyContent>().WithoutLabel(LabelValue == null).BeginContent(writer))
                {
                    ControlValue.WriteTo(writer, context);
                }
            }

            if (form != null && form.TypeValue == FormType.Inline)
            {
                return("</div> "); // trailing space is important for inline forms! Bootstrap does not provide spacing between groups in css!
            }

            return("</div>");
        }
Example #41
0
        protected override void WriteSelfStart(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("tr");

            if (ColorValue != TableRowCellColor.DefaultNone)
            {
                tb.AddCssClass(ColorValue.ToCssClass());
            }

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            if (content != null)
            {
                content.WriteTo(writer, context);
            }
        }
Example #42
0
        protected override void WriteSelf(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("i");
            tb.AddCssClass(TypeValue.ToCssClass());

            ApplyCss(tb);
            ApplyAttributes(tb);

            if (!NoSpacingValue)
            {
                writer.Write(" ");
            }

            tb.WriteFullTag(writer);

            if (!NoSpacingValue)
            {
                writer.Write(" ");
            }
        }
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("li");
            tb.MergeAttribute("role", "presentation");
            if (DisabledValue)
            {
                tb.AddCssClass("disabled");
            }

            tb.WriteStartTag(writer);

            var a = context.CreateTagBuilder("a");
            a.MergeAttribute("role", "menuitem");
            a.MergeAttribute("tabindex", "-1");
            a.MergeAttribute("href", DisabledValue ? "#" : HrefValue);

            a.WriteStartTag(writer);

            return "</a></li>";
        }
Example #44
0
        public virtual T BeginContent(System.IO.TextWriter writer, IBootstrapContext context)
        {
            WriteSelfStart(writer);
            if (context != null)
            {
                context.PushParent(this);
            }

            var retVal = CreateContentContext(context);

            retVal.OnDisposing(() =>
            {
                if (context != null)
                {
                    context.PopParent(this);
                }
                WriteSelfEnd(writer);
            });
            return(retVal);
        }
Example #45
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var tb = context.CreateTagBuilder("fieldset");

            if (DisabledValue)
            {
                tb.MergeAttribute("disabled", "disabled");
            }

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            if (LegendValue != null)
            {
                LegendValue.WriteTo(writer, context);
            }

            return "</fieldset>";
        }
Example #46
0
        protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context)
        {
            var bg = context.PeekNearest<ButtonGroup>();
            if (bg == null)
            {
                WriteWhitespaceSuffix = true;
            }
            else
            {
                SizeValue = bg.SizeValue;
            }

            var withHref = !string.IsNullOrEmpty(HrefValue);
            var tb = context.CreateTagBuilder(withHref ? "a" : "button");

            tb.AddCssClass(TypeValue.ToCssClass());
            tb.AddCssClass(SizeValue.ToButtonCssClass());

            if (DisabledValue)
            {
                tb.AddCssClass("disabled");
            }
            if (BlockSizeValue)
            {
                tb.AddCssClass("btn-block");
            }
            if (withHref)
            {
                tb.MergeAttribute("href", HrefValue);
            }

            ApplyCss(tb);
            ApplyAttributes(tb);

            tb.WriteStartTag(writer);

            return withHref ? "</a>" : "</button>";
        }
 public DummyDisposableContent(IBootstrapContext context)
 {
     // Nothing
 }
Example #48
0
 public SelectContent(IBootstrapContext context)
     : base(context)
 {
     // Nothing
 }
 private static IWriter2<SelectOption, AnyContent> SelectListItemToSelectOption(IBootstrapContext context, SelectListItem item)
 {
     return context.CreateWriter<SelectOption, AnyContent>().Value(item.Value).Disabled(item.Disabled).Content(item.Text);
 }
Example #50
0
 protected override AnyContent CreateContentContext(IBootstrapContext context)
 {
     return new AnyContent(context);
 }
Example #51
0
 public BootstrapHelper(IBootstrapContext context)
 {
     this.Context = context;
 }
 public ButtonToolbarContent(IBootstrapContext context)
 {
     this.Context = context;
 }
 public TableSectionContent(IBootstrapContext context)
 {
     this.Context = context;
 }
 public DefinitionListContent(IBootstrapContext context)
 {
     this.Context = context;
 }
Example #55
0
 public FormContentBase(IBootstrapContext context)
 {
     this.Context = context;
 }
 public SelectOptGroupContent(IBootstrapContext context)
 {
     this.Context = context;
 }
Example #57
0
 public ListContent(IBootstrapContext context)
 {
     this.Context = context;
 }
Example #58
0
 public GridRowContent(IBootstrapContext context)
 {
     this.Context = context;
 }
Example #59
0
 public TableRowContent(IBootstrapContext context)
 {
     this.Context = context;
 }
 protected override void WriteSelf(System.IO.TextWriter writer, IBootstrapContext context)
 {
     writer.Write(string.Empty);
 }