source: trunk/src/templates/scaffolding/show.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: 3.4 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>Show ${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            <span class="menuButton"><g:link class="create" action="create">New ${className}</g:link></span>
13        </div>
14        <div class="body">
15            <h1>Show ${className}</h1>
16            <g:if test="\${flash.message}">
17            <div class="message">\${flash.message}</div>
18            </g:if>
19            <div class="dialog">
20                <table>
21                    <tbody>
22
23                    <%
24                        excludedProps = ['version',
25                                           Events.ONLOAD_EVENT,
26                                           Events.BEFORE_DELETE_EVENT,
27                                           Events.BEFORE_INSERT_EVENT,
28                                           Events.BEFORE_UPDATE_EVENT]
29                        props = domainClass.properties.findAll { !excludedProps.contains(it.name) }
30                        Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[]))
31                        props.each { p -> %>
32                        <tr class="prop">
33                            <td valign="top" class="name">${p.naturalName}:</td>
34                            <% if(p.isEnum()) { %>
35                            <td valign="top" class="value">\${${propertyName}?.${p.name}?.encodeAsHTML()}</td>
36                            <% } else if(p.oneToMany || p.manyToMany) { %>
37                            <td  valign="top" style="text-align:left;" class="value">
38                                <ul>
39                                <g:each var="${p.name[0]}" in="\${${propertyName}.${p.name}}">
40                                    <li><g:link controller="${p.referencedDomainClass?.propertyName}" action="show" id="\${${p.name[0]}.id}">\${${p.name[0]}?.encodeAsHTML()}</g:link></li>
41                                </g:each>
42                                </ul>
43                            </td>
44                            <%  } else if(p.manyToOne || p.oneToOne) { %>
45                            <td valign="top" class="value"><g:link controller="${p.referencedDomainClass?.propertyName}" action="show" id="\${${propertyName}?.${p.name}?.id}">\${${propertyName}?.${p.name}?.encodeAsHTML()}</g:link></td>
46                            <%  } else  { %>
47                            <td valign="top" class="value">\${fieldValue(bean:${propertyName}, field:'${p.name}')}</td>
48                            <%  } %>
49                        </tr>
50                    <%  } %>
51                    </tbody>
52                </table>
53            </div>
54            <div class="buttons">
55                <g:form>
56                    <input type="hidden" name="id" value="\${${propertyName}?.id}" />
57                    <span class="button"><g:actionSubmit class="edit" value="Edit" /></span>
58                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
59                </g:form>
60            </div>
61        </div>
62    </body>
63</html>
Note: See TracBrowser for help on using the repository browser.