Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions grails-app/taglib/grails/plugin/formfields/FormFieldsTagLib.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,20 @@ class FormFieldsTagLib {
}
}

// TODO: https://github.com/gpc/fields/issues/392
boolean datePicker = model.type in [Date, Calendar, java.sql.Date, java.sql.Time, LocalDate, LocalDateTime]
if (!datePicker) {
attrs.remove('selectDateClass')
}
boolean checkBox = model.type in [boolean, Boolean]
String checkBoxClass = attrs.remove('checkBoxClass')
if (checkBox && checkBoxClass) {
attrs['class'] = checkBoxClass
}

if (model.type in [String, null]) {
return renderStringInput(model, attrs)
} else if (model.type in [boolean, Boolean]) {
} else if (checkBox) {
return g.checkBox(attrs)
} else if (model.type.isPrimitive() || model.type in Number) {
return renderNumericInput(propertyAccessor, model, attrs)
Expand All @@ -714,7 +725,7 @@ class FormFieldsTagLib {
return renderAssociationInput(model, attrs)
} else if (oneToMany) {
return renderOneToManyInput(model, attrs)
} else if (model.type in [Date, Calendar, java.sql.Date, java.sql.Time, LocalDate, LocalDateTime]) {
} else if (datePicker) {
return renderDateTimeInput(model, attrs)
} else if (model.type in [byte[], Byte[], Blob]) {
return g.field(attrs + [type: "file"])
Expand Down
Loading