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>Edit ${className}</title> |
---|
8 | </head> |
---|
9 | <body> |
---|
10 | <div class="nav"> |
---|
11 | <span class="menuButton"><a class="home" href="\${resource(dir:'')}">Home</a></span> |
---|
12 | <span class="menuButton"><g:link class="list" action="list">${className} List</g:link></span> |
---|
13 | <span class="menuButton"><g:link class="create" action="create">New ${className}</g:link></span> |
---|
14 | </div> |
---|
15 | <div class="body"> |
---|
16 | <h1>Edit ${className}</h1> |
---|
17 | <g:if test="\${flash.message}"> |
---|
18 | <div class="message">\${flash.message}</div> |
---|
19 | </g:if> |
---|
20 | <g:hasErrors bean="\${${propertyName}}"> |
---|
21 | <div class="errors"> |
---|
22 | <g:renderErrors bean="\${${propertyName}}" as="list" /> |
---|
23 | </div> |
---|
24 | </g:hasErrors> |
---|
25 | <g:form method="post" <%= multiPart ? ' enctype="multipart/form-data"' : '' %>> |
---|
26 | <input type="hidden" name="id" value="\${${propertyName}?.id}" /> |
---|
27 | <input type="hidden" name="version" value="\${${propertyName}?.version}" /> |
---|
28 | <div class="dialog"> |
---|
29 | <table> |
---|
30 | <tbody> |
---|
31 | <% |
---|
32 | excludedProps = ['version', |
---|
33 | 'id', |
---|
34 | Events.ONLOAD_EVENT, |
---|
35 | Events.BEFORE_DELETE_EVENT, |
---|
36 | Events.BEFORE_INSERT_EVENT, |
---|
37 | Events.BEFORE_UPDATE_EVENT] |
---|
38 | props = domainClass.properties.findAll { !excludedProps.contains(it.name) } |
---|
39 | |
---|
40 | Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[])) |
---|
41 | props.each { p -> |
---|
42 | cp = domainClass.constrainedProperties[p.name] |
---|
43 | display = (cp ? cp.display : true) |
---|
44 | if(display) { %> |
---|
45 | <tr class="prop"> |
---|
46 | <td valign="top" class="name"> |
---|
47 | <label for="${p.name}">${p.naturalName}:</label> |
---|
48 | </td> |
---|
49 | <td valign="top" class="value \${hasErrors(bean:${propertyName},field:'${p.name}','errors')}"> |
---|
50 | ${renderEditor(p)} |
---|
51 | </td> |
---|
52 | </tr> |
---|
53 | <% } } %> |
---|
54 | </tbody> |
---|
55 | </table> |
---|
56 | </div> |
---|
57 | <div class="buttons"> |
---|
58 | <span class="button"><g:actionSubmit class="save" value="Update" /></span> |
---|
59 | <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span> |
---|
60 | </div> |
---|
61 | </g:form> |
---|
62 | </div> |
---|
63 | </body> |
---|
64 | </html> |
---|