// Use special creator extensions to create input group addons so we can control the output more closely (I.e., no labels, form groups, etc.) public static ComponentBuilder <TConfig, Input> Input <TConfig>(this ComponentWrapper <TConfig, InputGroup> wrapper, string name = null, object value = null, string valueFormat = null, FormInputType inputType = FormInputType.Text) where TConfig : BootstrapConfig { return(new ComponentBuilder <TConfig, Input>(wrapper.Config, new Input(wrapper, inputType)) .SetName(name) .SetValue(value, valueFormat) .EnsureFormGroup(false)); }
// This is a very special extension - it allows adding a child using fluent style and switches the current chaining object to the child // behind the scenes the parent start is immediately output and the child ends the parent when it ends (so that the while hierarchy gets output) public static ComponentWrapper <TConfig, TTag> WithChild <TConfig, TTag>(this ComponentBuilder <TConfig, TTag> builder) where TConfig : BootstrapConfig where TTag : Tag { ComponentWrapper <TConfig, TTag> wrapper = builder.Begin(); wrapper.WithChild = true; return(wrapper); }
public static ComponentBuilder <MvcBootstrapConfig <TModel>, Input> InputFor <TModel, TValue>( this ComponentWrapper <MvcBootstrapConfig <TModel>, InputGroup> wrapper, Expression <Func <TModel, TValue> > expression, FormInputType inputType = FormInputType.Text) { ModelMetadata metadata = ModelMetadata.FromLambdaExpression(expression, wrapper.GetConfig().HtmlHelper.ViewData); string expressionText = ExpressionHelper.GetExpressionText(expression); string name = GetControlName(wrapper, expressionText); return(wrapper.Input(name, metadata.Model, metadata.EditFormatString, inputType)); }
public static ComponentBuilder <TConfig, CheckedControl> CheckBox <TConfig>(this ComponentWrapper <TConfig, InputGroupAddon> wrapper, string name = null, bool isChecked = false) where TConfig : BootstrapConfig { return(new ComponentBuilder <TConfig, CheckedControl>(wrapper.Config, new CheckedControl(wrapper, Css.Checkbox) { SuppressLabelWrapper = true }) .SetName(name) .SetChecked(isChecked) .EnsureFormGroup(false) .SetInline(true)); }