From 29339c94cd1b2a0a1a238375bdff1d1b92f2e189 Mon Sep 17 00:00:00 2001 From: Rob Fletcher Date: Fri, 19 Oct 2012 17:25:21 +0100 Subject: [PATCH] fix list template after merge --- src/templates/scaffolding/list.html | 25 ++++++++++--------- .../src/templates/scaffolding/list.html | 7 +++--- .../web-app/ng-templates/album/list.html | 4 +-- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/templates/scaffolding/list.html b/src/templates/scaffolding/list.html index 631c240..fb8097f 100644 --- a/src/templates/scaffolding/list.html +++ b/src/templates/scaffolding/list.html @@ -1,28 +1,29 @@ <% import grails.persistence.Event %> - <% 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) { %> - - <% } else { %> + for (p in props) { + if (p.isAssociation()) { %> + + <% } else { %> - <% } } } %> + <% } } %> - <% for (p in props) { %> - - <% } %> + <% for (p in props) { %> + + <% } %>
${p.naturalName}${p.naturalName}${p.naturalName}
{{item.${p.name}}}{{item.${p.name}}}
diff --git a/test/apps/grails-ng/src/templates/scaffolding/list.html b/test/apps/grails-ng/src/templates/scaffolding/list.html index c83a55e..2d1b8f6 100644 --- a/test/apps/grails-ng/src/templates/scaffolding/list.html +++ b/test/apps/grails-ng/src/templates/scaffolding/list.html @@ -11,11 +11,12 @@

${className} List

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()) { %> ${p.naturalName} - <% } else { %> + <% } else { %> ${p.naturalName} - <% } } } %> + <% } } %> diff --git a/test/apps/grails-ng/web-app/ng-templates/album/list.html b/test/apps/grails-ng/web-app/ng-templates/album/list.html index 01323c8..6441790 100644 --- a/test/apps/grails-ng/web-app/ng-templates/album/list.html +++ b/test/apps/grails-ng/web-app/ng-templates/album/list.html @@ -11,9 +11,9 @@

Album List

Title - Year + Year - Compilation + Compilation