-
-
Notifications
You must be signed in to change notification settings - Fork 967
7.1.x Scaffolding Display Constraint Expansion #15266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 7.1.x
Are you sure you want to change the base?
Conversation
|
Looks useful! I find the |
There already is an editable constraint that controls whether a field is read-only in forms. "input" and "output" directly correspond to the view types:
Using I chose NONE because it is similar to display: 'none' is a css rule which is pretty common.
|
| * @return The display type controlling where this property is shown in scaffolded views | ||
| * @since 7.1 | ||
| */ | ||
| DisplayType getDisplayType() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So to date, everything has been an optional / minor breaking change. But changing constrained means that this will be a breaking change, no? @matrei what are your thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdaugherty is adding a constraint breaking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the constraint isn't, but changing the base interface that's applied to every object I assume would be breaking. We need to test this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sbglasius is going to test this change with his side project to ensure it's backwards compatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should test this, we don't want to have to recompile/re-release plugins for 7.1 compatibility.
| package grails.gorm.validation | ||
|
|
||
| /** | ||
| * Enum representing the display behavior for a constrained property in scaffolded views. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The library being changed here doesn't have anything to do with scaffolding. Wouldn't it be better to introduce a constraint specific to scaffolding?
The more I think about this this seems very view-centric and it's being added to the domain layer. This just feels wrong from a separation perspective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdaugherty I am just expanding on the existing constraint which currently supports true/false and actually fixing it for when true is set. it can now be a boolean or an enum value.
| if (constrained && !constrained.display) { | ||
| DisplayType displayType = constrained?.displayType | ||
|
|
||
| if (displayType == DisplayType.ALL || displayType == DisplayType.OUTPUT_ONLY) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property is being used by fields, but documented as a scaffolding constraint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdaugherty That's how the documentation has always read, no?
@codeconsole Yes, that's a valid point. I'm fine with the naming as it is. |
Modify display constraint so that
For instance, let's say you have
String passwordyou would wantdisplay: INPUT_ONLYFor
Date dateCreated, perhaps ideal configuration isdisplay: OUTPUT_ONLYThis is backwards compatible with
display: boolean