codeconsole opened a new issue, #14215:
URL: https://github.com/apache/grails-core/issues/14215

   Following the work done on grails/fields#257 
   
   You would except to be able to do something like this:
   ` <f:display bean="challenge" except="[]" />`
   
   and see id, dateCreated, and dateUpdated
   
   Furthermore, I believe you would expect 
`FormFieldsTagLib.resolvePersistentProperties` to call 
domainModelService.geOutputProperties(domainClass)` 
   
   as it is defined as `The list of {@link DomainProperty} instances that are 
to be visible`
   
   I realize that there should be some synergy between the edit and the view 
page and such a change could be followed by requiring attrs.except like was 
done for grails/fields#257   However, it is a feature I am constantly looking 
for because I have no way of knowing the dateCreated and dateUpdated as well as 
the id (unless I look at the url).   
   
   Since the display tag already calls 
`FormFieldsTagLib.resolvePersistentProperties` implementing this fix is as 
simple as
   
   1. Creating an `enum FormFieldsTagLib.PropertiesType = { LIST, OUTPUT, INPUT 
}`
   2. Changing
   `private List<PersistentProperty> 
resolvePersistentProperties(PersistentEntity domainClass, Map attrs, boolean 
list = false) {`
   to 
   `private List<PersistentProperty> 
resolvePersistentProperties(PersistentEntity domainClass, Map attrs, 
PropertiesType propertiesType = PropertiesType.INPUT ) {`
   
   and modifying the method
   `
                        properties = propertiesType == PropertiesType.LIST ? 
domainModelService.getListOutputProperties(domainClass) :  propertiesType == 
PropertiesType.INPUT ? 
    domainModelService.getInputProperties(domainClass) : 
domainModelService.getOutputProperties(domainClass)
                        // If 'except' is not set, but 'list' is, exclude 'id', 
'dateCreated' and 'lastUpdated' by default
                        List<String> blacklist = attrs.containsKey('except') ? 
getList(attrs.except) : (propertiesType == PropertiesType.LIST  ? ['id', 
'dateCreated', 'lastUpdated'] : [])
   `
   
   Then changing the existing calls to  
`FormFieldsTagLib.resolvePersistentProperties`
   in 2 locations 
   
   `def display = { attrs, body ->`
   
   `resolvePersistentProperties(domainClass, attrs, PropertiesType.OUTPUT)`
   
   and 
   `private List<String> resolvePropertyNames(PersistentEntity domainClass, Map 
attrs) { `
   
   `List<String> properties = resolvePersistentProperties(domainClass, attrs, 
PropertiesType.INPUT)*.name`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to