1
0
Fork 0

Config includes all fields now

unless field has "ignored" attribute
This commit is contained in:
Gregory Eremin 2015-01-23 13:57:43 +07:00
parent 2ce470432c
commit ab364e1908
1 changed files with 14 additions and 12 deletions

View File

@ -86,17 +86,7 @@ loop_over_fields:
}
)
if title != "" || len(attrs) > 0 || len(options) > 0 {
// Substitute field name for title if none set
if kind != reflect.Struct {
cf.Value = val.Interface()
}
if title == "" {
cf.Title = field.Name
}
if len(options) > 0 {
cf.Options = strings.Split(options, sep)
}
if len(attrs) > 0 {
for _, attr := range strings.Split(attrs, sep) {
if attr == aRequired {
cf.IsRequired = true
@ -109,9 +99,21 @@ loop_over_fields:
}
}
fields = append(fields, cf)
}
// Substitute field name for title if none set
if kind != reflect.Struct {
cf.Value = val.Interface()
}
if title == "" {
cf.Title = field.Name
}
if len(options) > 0 {
cf.Options = strings.Split(options, sep)
}
fields = append(fields, cf)
// Recursion here
if kind == reflect.Struct {
subconf := &config{