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>${className} List</title> |
---|
8 | </head> |
---|
9 | <body> |
---|
10 | <div class="nav"> |
---|
11 | <span class="menuButton"><g:link class="create" action="create">New ${className}</g:link></span> |
---|
12 | </div> |
---|
13 | <div class="body"> |
---|
14 | <h1>${className} List</h1> |
---|
15 | <g:render template="/shared/messages" /> |
---|
16 | <div class="list"> |
---|
17 | <table> |
---|
18 | <thead> |
---|
19 | <tr> |
---|
20 | <% |
---|
21 | excludedProps = ['version', |
---|
22 | Events.ONLOAD_EVENT, |
---|
23 | Events.BEFORE_DELETE_EVENT, |
---|
24 | Events.BEFORE_INSERT_EVENT, |
---|
25 | Events.BEFORE_UPDATE_EVENT] |
---|
26 | |
---|
27 | props = domainClass.properties.findAll { !excludedProps.contains(it.name) && it.type != Set.class } |
---|
28 | Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[])) |
---|
29 | props.eachWithIndex { p,i -> |
---|
30 | if(i < 6) { |
---|
31 | if(p.isAssociation()) { %> |
---|
32 | <th>${p.naturalName}</th> |
---|
33 | <% } else { %> |
---|
34 | <g:sortableColumn property="${p.name}" title="${p.naturalName}" /> |
---|
35 | <% } } } %> |
---|
36 | </tr> |
---|
37 | </thead> |
---|
38 | <tbody> |
---|
39 | <g:each in="\${${propertyName}List}" status="i" var="${propertyName}"> |
---|
40 | <tr class="\${(i % 2) == 0 ? 'odd' : 'even'}"> |
---|
41 | <% props.eachWithIndex { p,i -> |
---|
42 | if(i == 0) { %> |
---|
43 | <td><g:link action="show" id="\${${propertyName}.id}">\${fieldValue(bean:${propertyName}, field:'${p.name}')}</g:link></td> |
---|
44 | <% } else if(i < 6) { %> |
---|
45 | <td>\${fieldValue(bean:${propertyName}, field:'${p.name}')}</td> |
---|
46 | <% } } %> |
---|
47 | </tr> |
---|
48 | </g:each> |
---|
49 | </tbody> |
---|
50 | </table> |
---|
51 | </div> |
---|
52 | <div class="paginateButtons"> |
---|
53 | <g:paginate total="\${${propertyName}Total}" /> |
---|
54 | </div> |
---|
55 | </div> |
---|
56 | </body> |
---|
57 | </html> |
---|