(Quick Reference)

7 Scaffolding Templates - Reference Documentation

Authors: groovyquan

Version: 0.5.1

7 Scaffolding Templates

Zkui supports a feature known as scaffolding which involves the generation of a CRUD (Create/Read/Update/Delete) interface for a given domain class

7.1 Static Scaffolding

Same as Grails's generate-all command,zkui use zkui-generate-all to generates views,composer and a controller for the given domain class

To zkui's scaffolding work,you need modify the default layout/main.gsp
  1. Add the tag <z:resources/> to the head
  2. Remove <link rel="stylesheet" href="${resource(dir:'css',file:'main.css')}" />
  3. Generate the doc type as follows

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The complete layout/main.gsp Examples

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title><g:layoutTitle default="Grails"/></title>
    <z:resources/>
    <g:layoutHead/>
</head>
<body>
<div id="grailsLogo"><a href="http://grails.org"><img src="${resource(dir: 'images', file: 'grails_logo.png')}"
                                                      alt="Grails" border="0"/></a></div>
<g:layoutBody/>
</body>
</html>

7.2 Customizing the scaffolding templates

The templates used by zkui to generate the controller, views and composer can be customized by installing the templates with the zkui-install-templates command.