Issue Details (XML | Word | Printable)

Key: GRAILS-756
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Graeme Rocher
Reporter: Daiji Takamori
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Grails

Support custom editors for scaffolding views

Created: 10/Feb/07 01:14 PM   Updated: 26/Jun/09 05:25 AM   Resolved: 26/Jun/09 05:25 AM
Return to search
Component/s: Scaffolding
Affects Version/s: 0.4.1
Fix Version/s: 1.1.1

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive src.zip (9 kB)



 Description  « Hide

It would be nice to be able to scaffold a view and have specific fields (i.e. password, icon picker, etc) where the editor could be customized to the user's liking, without needing to customize the scaffolding views to support this feature.



Daiji Takamori added a comment - 10/Feb/07 11:37 PM

Here is a sample implementation of this feature that could probably use a bit more work. I decided today to experiment with making scaffolding more useful "out of the box" and more usable on a regular basis.

The idea is that you can have custom editors for a given type, and that you can override it on a per-domain level or even a per-property level (that last bit should be using a different path than what I've used here, but I think there's enough here to get the gist of it). This kinda relates to what is described in http://grails.org/Data+Binding+and+PropertyEditors .

Largely the work involved a refactoring of DefaultGrailsTemplateGenerator.groovy from src/scaffolding/org/codehaus/groovy/grails/scaffolding to be more flexible.

The end result is that the templated editors become much more readable, and the convenience to app developers is nice. A potential downside is some exposure of internal Grails workings; but then again, that was already there in what was in the scaffolding already.

I should admit that there's some stuff in here that goes beyond what is described in the bug. It also has a feature to hide certain fields in the show and list views by defining a "hidden" property (yeah, I think a different name would be better, but this was a bangup prototype)..

Anyway, I hope you find this prototyping work useful. It probably wouldn't take much to turn this into production code.


Daiji Takamori added a comment - 10/Feb/07 11:45 PM

Btw, in case it's not clear, the files in the zip are currently designed to go in the src directory of an Grails application. It was developed using version 0.4.1.


Daiji Takamori added a comment - 11/Feb/07 09:56 AM

More information (rationale, examples) placed in the sandbox at

http://grails.org/Scaffolding+of+field+editors


Daiji Takamori added a comment - 12/Feb/07 07:33 AM

For now, the most updated version of the modification will be maintained at the sandbox page. I updated it just now again to handle some bugfixes.


Daiji Takamori added a comment - 21/Aug/07 08:05 AM

Noting for public reference that the patch indicated here has been re-implemented as the ScaffoldTags plugin, which uses tag-driven scaffold templates to invoke the renderer templates. http://grails.org/ScaffoldTags+Plugin


Graeme Rocher added a comment - 26/Jun/09 05:25 AM

Grails supports the use of Spring PropertyEditors via the getAsText and setAsText methods which can be used as of 1.1.1