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