apache / apache/grails-core

allow templates for collections/associations containing certain types

Open
#14,240 2 comments 0 reactions 0 assignees View on GitHub
relates-to: grails-fields
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

if you want to adjust all fields for a certain hasMany association or a collection property, there is no direct way with the existing template lookup.
e.g. domain A and B both got a hasMany = [cs: C], then you would need to customize _fields/a/cs/_input.gsp and _fields/b/cs/_input.gsp.

sticking with the existing templates-for-types convention option, i could imagine something like
_fields/collection/myAssociatedDomainClass/_input.gsp
_fields/set/myAssociatedDomainClass/_input.gsp
_fields/collection/enum/_input.gsp
and so on.

the enum example shows that it would be nice if this does not only apply to domain-associations but also to properties that are GrailsDomainClassProperty.basicCollectionType.

rob, if you do not got the necessary spare time but any thoughts on this, comment please. maybe i can find some time in the next weeks to tackle this.

zyro

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing templates-for-types lookup and how collection and association properties are classified. Check GrailsDomainClassProperty.basicCollectionType alongside hasMany associations, then evaluate the proposed _fields/collection/... and _fields/set/... paths. Done means one type-based template convention can customize both associations and basic collection properties without per-domain templates.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.