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"><g:link class="list" action="list">${className} List</g:link></span> |
---|
12 | </div> |
---|
13 | <div class="body"> |
---|
14 | <h1>Create ${className}</h1> |
---|
15 | <g:render template="/shared/messages" /> |
---|
16 | <g:hasErrors bean="\${${propertyName}}"> |
---|
17 | <div class="errors"> |
---|
18 | <g:renderErrors bean="\${${propertyName}}" as="list" /> |
---|
19 | </div> |
---|
20 | </g:hasErrors> |
---|
21 | <g:form action="save" method="post" <%= multiPart ? ' enctype="multipart/form-data"' : '' %>> |
---|
22 | <div class="dialog"> |
---|
23 | <table> |
---|
24 | <tbody> |
---|
25 | <% |
---|
26 | |
---|
27 | excludedProps = ['version', |
---|
28 | 'id', |
---|
29 | Events.ONLOAD_EVENT, |
---|
30 | Events.BEFORE_DELETE_EVENT, |
---|
31 | Events.BEFORE_INSERT_EVENT, |
---|
32 | Events.BEFORE_UPDATE_EVENT] |
---|
33 | props = domainClass.properties.findAll { !excludedProps.contains(it.name) } |
---|
34 | |
---|
35 | Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[])) |
---|
36 | props.each { p -> |
---|
37 | if(!Collection.class.isAssignableFrom(p.type)) { |
---|
38 | cp = domainClass.constrainedProperties[p.name] |
---|
39 | display = (cp ? cp.display : true) |
---|
40 | if(display) { %> |
---|
41 | <tr class="prop"> |
---|
42 | <td valign="top" class="name"> |
---|
43 | <label for="${p.name}">${p.naturalName}:</label> |
---|
44 | </td> |
---|
45 | <td valign="top" class="value \${hasErrors(bean:${propertyName},field:'${p.name}','errors')}"> |
---|
46 | ${renderEditor(p)} |
---|
47 | </td> |
---|
48 | </tr> |
---|
49 | <% } } } %> |
---|
50 | </tbody> |
---|
51 | </table> |
---|
52 | </div> |
---|
53 | <div class="buttons"> |
---|
54 | <span class="button"><input class="save" type="submit" value="Create" /></span> |
---|
55 | </div> |
---|
56 | </g:form> |
---|
57 | </div> |
---|
58 | </body> |
---|
59 | </html> |
---|