Grails JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile
Grails Scaffolding Plugin
  • Grails Scaffolding Plugin
  • GPSCAFFOLD-39

enhanced scaffolding templates

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Labels:
    None
  • Environment:
    WinXP on Intel

Description

I worked on the scaffolding templates and added some more features.
Would be nice, if the new features - or some of them - could be added to the current grails scaffolding templates.
Should be eben possible just to replace the templates?

Content:
=========
A. changes to the templates
B. usage
C. constraint examples

A. changes to the templates:
============================

general:
-many-to-many now works including deletion of depending side
-domains in packages possible
-output XHTML conform (exception is datepicker)
-improved CSS usage for easier customization
-enums with i18n support
-proper HTML encoding including messages

controller:
-list with automatic filter and sort
-Message text optimized
-list as Default View after create and edit (instead of show)
-using getComposite as primary key for legacy db
-choose and addTO for associating existing objects (instead of just new ones)

create and edit:
-g:form with controller-name
-use constraint editable, to show / hide property

show:
-Constraints display and password
-optional output of "subElement"s for referencesDomains
-linked output of strings with constraint "url"
-formatted output of dates (via constraints attribute dateFormat, default is
"dd.mm.YYYY")
-constraints attribute numberformat und numberFormatName
-output checkbox for booleans

list:
-improved sorting (not just via ID of referencedDomains)
-filter added
-icons Show, Edit, Delete
-more than 6 columns possible
-ID-column not required any more
-constraints display, password and listable
-constraints attribute cssStyle
-view also used for associating existing objects
-formatted output of dates (via constraints attribute dateFormat, default is
"dd.mm.YYYY")
-constraints attribute numberformat und numberFormatName
-output checkbox for booleans
-right aligned output of numbers
-linked output (to show view) of referencedDomains
-linked output of strings with constraint "url"
-some class attributes for css customization
-integrated tag for error messages
-optional integration of searchable plugin
(if installed and configured, input and button will be rendered in list view)
-i18n for all messages
-improvements according to some open JIRAs
-list view without records show message instead of empty table

renderEditor.template:
-constraints attribute cssStyle
-sorted output of 1:n
-constraint isRadio
-some class attributes for css customization
-assoziation of existing 1:n and n:m objekts
-select only for range < 50, else textfield, to avoid memory error
-render enum as select or radio

B. usage
============================
1. "grails create-app" or use existing app (backup before!!!)
2. "grails install-templates"
3. "grails create-controller Base" (create the required empty BaseController)
5. install templates from zip
5.a copy artifacts and scaffolding src/templates
5.b copy main.css and search.css to web-app/css
5.c copy main.gsp to grails-app/views/layouts
6. create domain classes or use existing ones
(for existing ones add methods with "TODO"s in template DomainClass.groovy,
especially in getDefaultOrder() the TODO must be replaced)
7. grails generate-all
8. grails run-app

C. constraint examples:
============================

static constraints = {
name(blank:false, nullable:false, size:1..100, attributes:[cssStyle:"width:400px;"])
x(range:1..200, unique:'y')
y(range:1..200, unique:'x')
example1(nullable:true, default:null, range:0..30, attributes:[listable:false])
example2(editable:false)
example3(attributes:[isRadio:true, listable:false])
example4(editable: false, url:true, attributes:[listable:false])
example5(password:true, blank:false, nullable:false, size:1..32)
owner(attributes:[subElement:"groups"])
lastLogin(attributes:[dateFormat:"dd.MM.yyyy HH:mm", precision:"minute", years:"$

{2009..2015}

"])
lastLogout(attributes:[dateFormatName:"myFormats.mySpecialLogoutFormat"])
numberOfXY(attributes:numberFormat:"###,##0")
numberOfZ(attributes:[numberFormatName:"myFormats.mySpecialFormatZ"])
id(display:false)
}

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Hide
    Zip Archive
    grails_templates_hk_090812_v15a.zip
    14/Oct/09 6:50 AM
    19 kB
    Horst Krause
    1. File
      artifacts/DomainClass.groovy 1 kB
    2. File
      scaffolding/Controller.groovy 16 kB
    3. File
      scaffolding/create.gsp 5 kB
    4. File
      scaffolding/edit.gsp 5 kB
    5. File
      scaffolding/list.gsp 18 kB
    6. File
      scaffolding/renderEditor.template 16 kB
    7. File
      scaffolding/show.gsp 9 kB
    8. File
      search.css 0.1 kB
    9. File
      main.css 5 kB
    10. File
      main.gsp 0.9 kB
    Download Zip
    Show
    Zip Archive
    grails_templates_hk_090812_v15a.zip
    14/Oct/09 6:50 AM
    19 kB
    Horst Krause

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Graeme Rocher added a comment - 14/Oct/09 4:09 AM

If you want these changes integrated please attach a patch for review

Show
Graeme Rocher added a comment - 14/Oct/09 4:09 AM If you want these changes integrated please attach a patch for review
Hide
Permalink
Horst Krause added a comment - 14/Oct/09 6:49 AM

I don't know, how to create a real patch.

But in fact the patch would be just to replace the current files with mine (which are already attached):
artifacts\DomainClass.groovy
scaffolding\Controller.groovy
scaffolding\create.gsp
scaffolding\edit.gsp
scaffolding\list.gsp
scaffolding\renderEditor.template
scaffolding\show.gsp
grails-app\views\layouts\main.gsp
web-app\css\main.css

and to add the search.css web-app\css\

Just one point, I don't know to handle: How to integrate the "BaseController" thing into the "create-app" script.

Show
Horst Krause added a comment - 14/Oct/09 6:49 AM I don't know, how to create a real patch. But in fact the patch would be just to replace the current files with mine (which are already attached): artifacts\DomainClass.groovy scaffolding\Controller.groovy scaffolding\create.gsp scaffolding\edit.gsp scaffolding\list.gsp scaffolding\renderEditor.template scaffolding\show.gsp grails-app\views\layouts\main.gsp web-app\css\main.css and to add the search.css web-app\css\ Just one point, I don't know to handle: How to integrate the "BaseController" thing into the "create-app" script.
Hide
Permalink
Horst Krause added a comment - 14/Oct/09 6:50 AM

ZIP-File of changes

Show
Horst Krause added a comment - 14/Oct/09 6:50 AM ZIP-File of changes
Hide
Permalink
Graeme Rocher added a comment - 14/Oct/09 7:45 AM

Against what version of Grails were these changes done? Since it is not a patch file overwriting the files in trunk could cause regressions

Show
Graeme Rocher added a comment - 14/Oct/09 7:45 AM Against what version of Grails were these changes done? Since it is not a patch file overwriting the files in trunk could cause regressions
Hide
Permalink
Horst Krause added a comment - 14/Oct/09 9:35 AM

against 1.1

Show
Horst Krause added a comment - 14/Oct/09 9:35 AM against 1.1
Hide
Permalink
Graeme Rocher added a comment - 14/Oct/09 9:58 AM

Current head (which is 1.2) contains many changes to scaffolding, simply overwriting it with your changes would cause regressions. We would need a patch or the changes made against Git head

Show
Graeme Rocher added a comment - 14/Oct/09 9:58 AM Current head (which is 1.2) contains many changes to scaffolding, simply overwriting it with your changes would cause regressions. We would need a patch or the changes made against Git head
Hide
Permalink
Horst Krause added a comment - 14/Oct/09 10:06 AM

Where can I get the current version to make my changes against? Is http://github.com/grails/grails/tree/master/grails/src/grails/templates/scaffolding/ the right place to get them?

Show
Horst Krause added a comment - 14/Oct/09 10:06 AM Where can I get the current version to make my changes against? Is http://github.com/grails/grails/tree/master/grails/src/grails/templates/scaffolding/ the right place to get them?
Hide
Permalink
Graeme Rocher added a comment - 28/Jul/10 3:50 AM

Hi Horst. This issue has got lots of votes, any chance of getting an updated patch? The right place is http://github.com/grails/grails-core/tree/master/src/grails/templates/scaffolding/

Show
Graeme Rocher added a comment - 28/Jul/10 3:50 AM Hi Horst. This issue has got lots of votes, any chance of getting an updated patch? The right place is http://github.com/grails/grails-core/tree/master/src/grails/templates/scaffolding/
Hide
Permalink
Horst Krause added a comment - 07/Aug/10 4:57 PM

Hi Graeme,
I'm still alive. But after not getting any answer for such a long time, I create an own project for the templates:
http://code.google.com/p/glossy-templates/

But if it is still usefull for you, I can start a merge against your current version.

Show
Horst Krause added a comment - 07/Aug/10 4:57 PM Hi Graeme, I'm still alive. But after not getting any answer for such a long time, I create an own project for the templates: http://code.google.com/p/glossy-templates/ But if it is still usefull for you, I can start a merge against your current version.
Hide
Permalink
Graeme Rocher added a comment - 09/Aug/10 2:45 AM

Definitely useful, submit a pull request or patch and we'll apply

Show
Graeme Rocher added a comment - 09/Aug/10 2:45 AM Definitely useful, submit a pull request or patch and we'll apply
Hide
Permalink
Fabien Benichou added a comment - 09/Aug/10 4:12 AM

Having looked at the glossy-templates, it is very promising.

However, I would not have integrated into the Core for scaffolding but rather as a plugin if possible.

Also, I don't think it is a good idea to have attributes css style (like constraint attributes:[cssStyle:"width:400px;"]) hardcoded into the Domain class !

CSS should be externalized and no reference to display should be done in the Domain Model Layer. This does break the Separation of Concerns for different layers in Grails.

My 2-cents.

Show
Fabien Benichou added a comment - 09/Aug/10 4:12 AM Having looked at the glossy-templates, it is very promising. However, I would not have integrated into the Core for scaffolding but rather as a plugin if possible. Also, I don't think it is a good idea to have attributes css style (like constraint attributes: [cssStyle:"width:400px;"] ) hardcoded into the Domain class ! CSS should be externalized and no reference to display should be done in the Domain Model Layer. This does break the Separation of Concerns for different layers in Grails. My 2-cents.
Hide
Permalink
David Trattnig added a comment - 14/Aug/10 7:41 AM

I've looked at the "create.gsp" template and have seen it contains quite some scriplet-code. Hence this is not very maintainable/transparent for scaffolded views. In general I would prefer default-templates which are not based on tables (vs. floating DIVs).

Show
David Trattnig added a comment - 14/Aug/10 7:41 AM I've looked at the "create.gsp" template and have seen it contains quite some scriplet-code. Hence this is not very maintainable/transparent for scaffolded views. In general I would prefer default-templates which are not based on tables (vs. floating DIVs).
Hide
Permalink
Horst Krause added a comment - 31/Aug/10 7:54 AM

Finally I merged my glossy-templates with the core templates from grails 1.3.4 and removed the searchable feature. You can find the current version here:
http://glossy-templates.googlecode.com/files/glossy-templates-2.0.0.zip

Now it is your decision to move or not to move them into the core...

Show
Horst Krause added a comment - 31/Aug/10 7:54 AM Finally I merged my glossy-templates with the core templates from grails 1.3.4 and removed the searchable feature. You can find the current version here: http://glossy-templates.googlecode.com/files/glossy-templates-2.0.0.zip Now it is your decision to move or not to move them into the core...

People

  • Assignee:
    Burt Beckwith
    Reporter:
    Horst Krause
Vote (21)
Watch (18)

Dates

  • Created:
    14/Oct/09 3:51 AM
    Updated:
    26/Apr/13 2:13 PM

Agile

  • View on Board
  • Atlassian JIRA (v5.2.1#813-sha1:277a546)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Grails project. Try JIRA - bug tracking software for your team.