Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.

Commit a410714

Browse files
authored
Merge pull request #337 from gpc/grails4.x
display tag template
2 parents 70a8ab1 + 6cec048 commit a410714

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

grails-app/taglib/grails/plugin/formfields/FormFieldsTagLib.groovy

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ class FormFieldsTagLib {
319319
* @attr order A comma-separated list of properties to include in provided order
320320
* @attr except A comma-separated list of properties to exclude
321321
* @attr theme Theme name
322+
* @attr template OPTIONAL The template used when rendering the domainClass
322323
*/
323324
def display = { attrs, body ->
324325
attrs = beanStack.innerAttributes + attrs
@@ -327,13 +328,15 @@ class FormFieldsTagLib {
327328

328329
String property = attrs.remove(PROPERTY_ATTR)
329330
String templatesFolder = attrs.remove(TEMPLATES_ATTR)
330-
String theme = attrs.remove(THEME_ATTR)
331+
String theme = attrs.remove(THEME_ATTR)
331332

332333
if (property == null) {
333334
PersistentEntity domainClass = resolveDomainClass(bean)
334335
if (domainClass) {
336+
String template = attrs.remove('template') ?: 'list'
337+
335338
List properties = resolvePersistentProperties(domainClass, attrs)
336-
out << render(template: "/templates/_fields/list", model: [domainClass: domainClass, domainProperties: properties]) { prop ->
339+
out << render(template: "/templates/_fields/$template", model: [domainClass: domainClass, domainProperties: properties]) { prop ->
337340
BeanPropertyAccessor propertyAccessor = resolveProperty(bean, prop.name)
338341
Map model = buildModel(propertyAccessor, attrs, 'HTML')
339342
out << raw(renderDisplayWidget(propertyAccessor, model, attrs, templatesFolder, theme))

0 commit comments

Comments
 (0)