source: trunk/src/templates/scaffolding/list.gsp @ 178

Last change on this file since 178 was 178, checked in by gav, 14 years ago

Resolve ticket #12 again.
Turn query cache on again since this did not resolve the problem.
Implement fix as per http://jira.codehaus.org/browse/GRAILS-5111, add flush:true to save.
Adjust templates to include above and remove home url.
Re-generate all non detailed views and controllers.
Manually add flush:true and remove home url to detailed views and controllers.

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