Skip to content

Commit

Permalink
Merge pull request #337 from gpc/grails4.x
Browse files Browse the repository at this point in the history
display tag template
  • Loading branch information
sbglasius authored Jan 6, 2024
2 parents 70a8ab1 + 6cec048 commit a410714
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ class FormFieldsTagLib {
* @attr order A comma-separated list of properties to include in provided order
* @attr except A comma-separated list of properties to exclude
* @attr theme Theme name
* @attr template OPTIONAL The template used when rendering the domainClass
*/
def display = { attrs, body ->
attrs = beanStack.innerAttributes + attrs
Expand All @@ -327,13 +328,15 @@ class FormFieldsTagLib {

String property = attrs.remove(PROPERTY_ATTR)
String templatesFolder = attrs.remove(TEMPLATES_ATTR)
String theme = attrs.remove(THEME_ATTR)
String theme = attrs.remove(THEME_ATTR)

if (property == null) {
PersistentEntity domainClass = resolveDomainClass(bean)
if (domainClass) {
String template = attrs.remove('template') ?: 'list'

List properties = resolvePersistentProperties(domainClass, attrs)
out << render(template: "/templates/_fields/list", model: [domainClass: domainClass, domainProperties: properties]) { prop ->
out << render(template: "/templates/_fields/$template", model: [domainClass: domainClass, domainProperties: properties]) { prop ->
BeanPropertyAccessor propertyAccessor = resolveProperty(bean, prop.name)
Map model = buildModel(propertyAccessor, attrs, 'HTML')
out << raw(renderDisplayWidget(propertyAccessor, model, attrs, templatesFolder, theme))
Expand Down

0 comments on commit a410714

Please sign in to comment.