Beispiel #1
0
func (r *FormRenderer) EndInput(w io.Writer, field *form.Field, pos int) error {
	var err error
	if field.HasAddOns() && pos == -1 {
		_, err = io.WriteString(w, "</div>")
	}
	return err
}
Beispiel #2
0
func (r *FormRenderer) BeginInput(w io.Writer, field *form.Field, placeholder string, pos int) error {
	var err error
	if field.HasAddOns() && pos == -1 {
		div := html.Div()
		div.Attrs = html.Attrs{"class": "input-group"}
		div.Open = true
		_, err = div.WriteTo(w)
	}
	return err
}
Beispiel #3
0
func (r *FormRenderer) BeginField(w io.Writer, field *form.Field) error {
	attrs := html.Attrs{"class": "form-group"}
	if field.Err() != nil {
		attrs["class"] += " has-error"
	}
	div := html.Div()
	div.Attrs = attrs
	div.Open = true
	_, err := div.WriteTo(w)
	if err == nil && field.Type == form.CHECKBOX {
		cb := html.Div()
		cb.Attrs = html.Attrs{"class": "checkbox"}
		cb.Open = true
		_, err = cb.WriteTo(w)
	}
	return err
}