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); }
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 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>"); }