source: trunk/grails-app/views/advancedQuery/sampleresults.gsp @ 1482

Last change on this file since 1482 was 1482, checked in by robert@…, 12 years ago

Implemented saving of queries

  • Property svn:keywords set to Rev Author Date
File size: 1.8 KB
Line 
1<html>
2<head>
3        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
4        <meta name="layout" content="main"/>
5        <title>Query results</title>
6        <link rel="stylesheet" href="<g:resource dir="css" file="advancedQuery.css" />" type="text/css"/>
7</head>
8<body>
9
10<h1>Query results</h1>
11
12<p>
13        Your search for samples with:
14</p>
15<g:render template="criteria" model="[criteria: search.getCriteria()]" />
16<p> 
17        resulted in ${search.getNumResults()} <g:if test="${search.getNumResults() == 1}">sample</g:if><g:else>samples</g:else>.
18</p>
19
20<g:if test="${search.getNumResults() > 0}">
21        <%
22                def resultFields = search.getShowableResultFields();
23                def extraFields = resultFields[ search.getResults()[ 0 ].id ]?.keySet();
24        %>
25        <table id="searchresults" class="paginate">
26                <thead>
27                <tr>
28                        <th>Study</th>
29                        <th>Name</th>
30                        <g:each in="${extraFields}" var="fieldName">
31                                <th>${fieldName}</th>
32                        </g:each>
33                </tr>
34                </thead>
35                <tbody>
36                <g:each in="${search.getResults()}" var="sampleInstance" status="i">
37                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
38                                <td><g:link controller="study" action="show" id="${sampleInstance?.parent?.id}">${sampleInstance?.parent?.title}</g:link></td>
39                                <td>${fieldValue(bean: sampleInstance, field: "name")}</td>
40                                <g:each in="${extraFields}" var="fieldName">
41                                        <td>
42                                                <%
43                                                        def fieldValue = resultFields[ sampleInstance.id ]?.get( fieldName );
44                                                        if( fieldValue ) {
45                                                                if( fieldValue instanceof Collection )
46                                                                        fieldValue = fieldValue.collect { it.toString() }.findAll { it }.join( ', ' );
47                                                                else
48                                                                        fieldValue = fieldValue.toString();
49                                                        }
50                                                %>
51                                                ${fieldValue}
52                                        </td>
53                                </g:each>
54                        </tr>
55                </g:each>
56                </tbody>
57        </table>
58
59</g:if>
60<g:render template="resultbuttons" model="[queryId: queryId]" />
61</body>
62</html>
Note: See TracBrowser for help on using the repository browser.