Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
80 lines (70 sloc) 3.13 KB
<% import grails.persistence.Event %>
<%=packageName%>
<!doctype html>
<html>
<head>
<meta name="layout" content="main">
<g:set var="entityName" value="\${message(code: '${domainClass.propertyName}.label', default: '${className}')}" />
<title><g:message code="default.list.label" args="[entityName]" /></title>
</head>
<body>
<a href="#list-${domainClass.propertyName}" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
<div class="nav" role="navigation">
<ul>
<li><a class="home" href="\${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
</ul>
</div>
<div id="list-${domainClass.propertyName}" class="content scaffold-list" role="main">
<h1><g:message code="default.list.label" args="[entityName]" /></h1>
<g:if test="\${flash.message}">
<div class="message" role="status">\${flash.message}</div>
</g:if>
<g:form method="post">
<g:hiddenField name="id"/>
<table>
<thead>
<tr>
<% excludedProps = Event.allEvents.toList() << 'id' << 'version'
allowedNames = domainClass.persistentProperties*.name << 'dateCreated' << 'lastUpdated'
props = domainClass.properties.findAll { allowedNames.contains(it.name) && !excludedProps.contains(it.name) && !Collection.isAssignableFrom(it.type) }
Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[]))
props.eachWithIndex { p, i ->
if (i < 6) {
if (p.isAssociation()) { %>
<th><g:message code="${domainClass.propertyName}.${p.name}.label" default="${p.naturalName}" /></th>
<% } else { %>
<g:sortableColumn property="${p.name}" title="\${message(code: '${domainClass.propertyName}.${p.name}.label', default: '${p.naturalName}')}" />
<% } } } %>
<th>Acoes</th>
</tr>
</thead>
<tbody>
<g:each in="\${${propertyName}List}" status="i" var="${propertyName}">
<tr class="\${(i % 2) == 0 ? 'even' : 'odd'}">
<% props.eachWithIndex { p, i ->
if (i < 6) {
if (p.type == Boolean || p.type == boolean) { %>
<td><g:formatBoolean boolean="\${${propertyName}.${p.name}}" /></td>
<% } else if (p.type == Date || p.type == java.sql.Date || p.type == java.sql.Time || p.type == Calendar) { %>
<td><g:formatDate date="\${${propertyName}.${p.name}}" /></td>
<% } else { %>
<td>\${fieldValue(bean: ${propertyName}, field: "${p.name}")}</td>
<% } } } %>
<td>
<fieldset class="buttons">
<g:link class="edit" action="edit" id="\${${propertyName}.id}">Editar</g:link>
<g:actionSubmit class="delete" action="delete" value="Apagar" onclick="document.forms[0].id.value='\${${propertyName}.id}';"/>
</fieldset>
</td>
</tr>
</g:each>
</tbody>
</table>
</g:form>
<div class="pagination">
<g:paginate total="\${${propertyName}Total}" />
</div>
</div>
</body>
</html>