Ways Grails scaffolding of default GSP templates should be improved

I recently completed Dave Klein’s Grails Quick start guide and two thing that really jumps out at me.

Firstly. The way you manually have to tweak the GSPs to navigate across relationships.

To set the scene, here’s the Domain model from Dave’s book:

Courtesy of Intellij9.

In Dave’s book you could navigate to from an event to the messages for the event.

To do this,  a call from tekEvent show.gsp to  Messages list.gsp, was manually inserted as follows:

Picking up on the messages list controller action, you now have modified code like so (the original is commented out)

MessagesController list action

This was to facilitate ‘restricting’ the Messages just show for the single Event instance.

Then in our list.gsp, we now have to drop event as a repeating item in the list and put some content pertaining to it in the header section of the page.

I don’t see why  Grails isn’t automating the generation of this stuff based on the domain model and relationships.

I know that you might also want a list view for all Messages too, but I’m wondering if this sort of stuff could be done with some conditional tags in the list views or some sort of naming convention like listByEvent.gsp in the Messages views.


Secondly. I’m not too keen on drop downs being used for selecting a file to file relationship from a combo box, based on a ToString value, which most books tend to suggest. I think this is a rather naive approach.

I know you can do stuff like auto complete too, but I’d have thought some sort of select.gsp should be easy to incorporate that resembles the list.gsp, but returns an instance from a pop-up.

Then at the top of the list you could have fields to filter by. Basically input fields above the column repeated below. Above the column a set of combo boxes for things like EQ, ST, CT, GE, NE etc.

(ST=Start, CT=Contains)

Possibly also use  some sort of query that searches across all domain properties via the Searchable plug-in.

Advertisements

About this entry