Add otherAttrs option to input template

This commit is contained in:
Andrea Fazzi 2019-12-06 08:39:36 +01:00
parent cd19270aa3
commit 57d0482d52
2 changed files with 3 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"html/template"
"log"
"net/url"
"reflect"
"strings"
@ -154,6 +155,7 @@ func yaml(content string) (interface{}, error) {
if err != nil {
return nil, err
}
log.Println(result)
return result, nil
}

View file

@ -5,7 +5,7 @@
name="{{.options.name}}"
class="{{if .options.inputClass}}{{.options.inputClass}}{{else}}form-control{{end}}"
id="{{.options.id}}"
placeholder="{{.options.placeholder}}" {{if .update}}value="{{.value}}"{{end}} {{if .options.otherAttrs}}{{.options.otherAttrs}}{{end}} {{if .options.required}}required{{end}}>
placeholder="{{.options.placeholder}}" {{if .update}}value="{{.value}}"{{end}} {{if .options.otherAttrs}}{{.options.otherAttrs|html}}{{end}} {{if .options.required}}required{{end}}>
{{if .options.help}}<small class="form-text text-muted">{{.options.help}}</small>{{end}}
</div>
{{end}}