Details

    • Type: Improvement Improvement
    • Status: 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)
      }

        Activity

        Hide
        Horst Krause added a comment -

        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 - 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
        Graeme Rocher added a comment -

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

        Show
        Graeme Rocher added a comment - Definitely useful, submit a pull request or patch and we'll apply
        Hide
        Fabien Benichou added a comment -

        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 - 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
        David Trattnig added a comment -

        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 - 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
        Horst Krause added a comment -

        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 - 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
          • Votes:
            21 Vote for this issue
            Watchers:
            18 Start watching this issue

            Dates

            • Created:
              Updated: