Skip to content

Commit

Permalink
fix list template after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
robfletcher committed Oct 19, 2012
1 parent c69ec41 commit 29339c9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
25 changes: 13 additions & 12 deletions src/templates/scaffolding/list.html
@@ -1,28 +1,29 @@
<% import grails.persistence.Event %>
<div class="page-header">
<h1>${className} List</h1>
<h1>${className} List</h1>
</div>
<alert level="{{message.level}}" text="{{message.text}}"/>
<table class="table table-bordered table-striped">
<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) && it.type != null && !Collection.isAssignableFrom(it.type) && !it.isAssociation() && !it.embedded }
Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[]))
<% excludedProps = Event.allEvents.toList() << 'id' << 'version'
allowedNames = domainClass.persistentProperties*.name << 'dateCreated' << 'lastUpdated'
props = domainClass.properties.findAll { allowedNames.contains(it.name) && !excludedProps.contains(it.name) && it.type != null && !Collection.isAssignableFrom(it.type) && !it.isAssociation() && !it.embedded }
Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[]))
if (props.size() > 6) props = props[0..5]
for (p in props) { %>
<th>${p.naturalName}</th>
<% } else { %>
for (p in props) {
if (p.isAssociation()) { %>
<th>${p.naturalName}</th>
<% } else { %>
<th data-sortable="${p.name}">${p.naturalName}</th>
<% } } } %>
<% } } %>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="item in list" data-ng-click="show(item)">
<% for (p in props) { %>
<td>{{item.${p.name}}}</td>
<% } %>
<% for (p in props) { %>
<td>{{item.${p.name}}}</td>
<% } %>
</tr>
</tbody>
</table>
Expand Down
7 changes: 4 additions & 3 deletions test/apps/grails-ng/src/templates/scaffolding/list.html
Expand Up @@ -11,11 +11,12 @@ <h1>${className} List</h1>
props = domainClass.properties.findAll { allowedNames.contains(it.name) && !excludedProps.contains(it.name) && it.type != null && !Collection.isAssignableFrom(it.type) && !it.isAssociation() && !it.embedded }
Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[]))
if (props.size() > 6) props = props[0..5]
for (p in props) { %>
for (p in props) {
if (p.isAssociation()) { %>
<th>${p.naturalName}</th>
<% } else { %>
<% } else { %>
<th data-sortable="${p.name}">${p.naturalName}</th>
<% } } } %>
<% } } %>
</tr>
</thead>
<tbody>
Expand Down
4 changes: 2 additions & 2 deletions test/apps/grails-ng/web-app/ng-templates/album/list.html
Expand Up @@ -11,9 +11,9 @@ <h1>Album List</h1>

<th data-sortable="title">Title</th>

<th>Year</th>
<th data-sortable="year">Year</th>

<th>Compilation</th>
<th data-sortable="compilation">Compilation</th>

</tr>
</thead>
Expand Down

0 comments on commit 29339c9

Please sign in to comment.