| 1 | <% import org.codehaus.groovy.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor as Events %> | 
|---|
| 2 | <%=packageName%> | 
|---|
| 3 | <html> | 
|---|
| 4 |     <head> | 
|---|
| 5 |         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | 
|---|
| 6 |         <meta name="layout" content="main" /> | 
|---|
| 7 |         <title>Create ${className}</title>          | 
|---|
| 8 |     </head> | 
|---|
| 9 |     <body> | 
|---|
| 10 |         <div class="nav"> | 
|---|
| 11 |             <span class="menuButton"><a class="home" href="\${createLinkTo(dir:'')}">Home</a></span> | 
|---|
| 12 |             <span class="menuButton"><g:link class="list" action="list">${className} List</g:link></span> | 
|---|
| 13 |         </div> | 
|---|
| 14 |         <div class="body"> | 
|---|
| 15 |             <h1>Create ${className}</h1> | 
|---|
| 16 |             <g:if test="\${flash.message}"> | 
|---|
| 17 |             <div class="message">\${flash.message}</div> | 
|---|
| 18 |             </g:if> | 
|---|
| 19 |             <g:hasErrors bean="\${${propertyName}}"> | 
|---|
| 20 |             <div class="errors"> | 
|---|
| 21 |                 <g:renderErrors bean="\${${propertyName}}" as="list" /> | 
|---|
| 22 |             </div> | 
|---|
| 23 |             </g:hasErrors> | 
|---|
| 24 |             <g:form action="save" method="post" <%= multiPart ? ' enctype="multipart/form-data"' : '' %>> | 
|---|
| 25 |                 <div class="dialog"> | 
|---|
| 26 |                     <table> | 
|---|
| 27 |                         <tbody> | 
|---|
| 28 |                         <% | 
|---|
| 29 |  | 
|---|
| 30 |                             excludedProps = ['version', | 
|---|
| 31 |                                              'id', | 
|---|
| 32 |                                                Events.ONLOAD_EVENT, | 
|---|
| 33 |                                                Events.BEFORE_DELETE_EVENT, | 
|---|
| 34 |                                                Events.BEFORE_INSERT_EVENT, | 
|---|
| 35 |                                                Events.BEFORE_UPDATE_EVENT] | 
|---|
| 36 |                             props = domainClass.properties.findAll { !excludedProps.contains(it.name) } | 
|---|
| 37 |  | 
|---|
| 38 |                             Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[])) | 
|---|
| 39 |                             props.each { p -> | 
|---|
| 40 |                                 if(!Collection.class.isAssignableFrom(p.type)) { | 
|---|
| 41 |                                     cp = domainClass.constrainedProperties[p.name] | 
|---|
| 42 |                                     display = (cp ? cp.display : true)         | 
|---|
| 43 |                                     if(display) { %> | 
|---|
| 44 |                             <tr class="prop"> | 
|---|
| 45 |                                 <td valign="top" class="name"> | 
|---|
| 46 |                                     <label for="${p.name}">${p.naturalName}:</label> | 
|---|
| 47 |                                 </td> | 
|---|
| 48 |                                 <td valign="top" class="value \${hasErrors(bean:${propertyName},field:'${p.name}','errors')}"> | 
|---|
| 49 |                                     ${renderEditor(p)} | 
|---|
| 50 |                                 </td> | 
|---|
| 51 |                             </tr>  | 
|---|
| 52 |                         <%  }   }   } %> | 
|---|
| 53 |                         </tbody> | 
|---|
| 54 |                     </table> | 
|---|
| 55 |                 </div> | 
|---|
| 56 |                 <div class="buttons"> | 
|---|
| 57 |                     <span class="button"><input class="save" type="submit" value="Create" /></span> | 
|---|
| 58 |                 </div> | 
|---|
| 59 |             </g:form> | 
|---|
| 60 |         </div> | 
|---|
| 61 |     </body> | 
|---|
| 62 | </html> | 
|---|