Grails

Support custom editors for scaffolding views

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.4.1
  • Fix Version/s: 1.1.1
  • Component/s: Scaffolding
  • Labels:
    None

Description

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.

Activity

Hide
Daiji Takamori added a comment -

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.

Show
Daiji Takamori added a comment - 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.
Hide
Daiji Takamori added a comment -

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.

Show
Daiji Takamori added a comment - 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.
Hide
Daiji Takamori added a comment -

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

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

Show
Daiji Takamori added a comment - More information (rationale, examples) placed in the sandbox at http://grails.org/Scaffolding+of+field+editors
Hide
Daiji Takamori added a comment -

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.

Show
Daiji Takamori added a comment - 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.
Hide
Daiji Takamori added a comment -

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

Show
Daiji Takamori added a comment - 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
Hide
Graeme Rocher added a comment -

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

Show
Graeme Rocher added a comment - Grails supports the use of Spring PropertyEditors via the getAsText and setAsText methods which can be used as of 1.1.1

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: