[2] | 1 | ## search.html
|
---|
| 2 | <%!
|
---|
| 3 | from itertools import cycle
|
---|
| 4 | colors = cycle( [ 'even', 'odd' ] )
|
---|
| 5 | %>
|
---|
| 6 |
|
---|
| 7 | <%inherit file="base.html"/>
|
---|
| 8 | <%def name="title()">
|
---|
| 9 | Search
|
---|
| 10 | </%def>
|
---|
| 11 |
|
---|
| 12 | <h1 align="center">Search</h1>
|
---|
| 13 |
|
---|
| 14 | <div align="center">
|
---|
| 15 | <form action="search" method="get">
|
---|
| 16 | Search terms <input type="text" name="word" value="${param.word}"> |
---|
| 17 | <input type="hidden" name="dataset_id" id="dataset_id" value="${dataset_id}" />
|
---|
| 18 | <input type="submit" name="submit" value="Search!">
|
---|
| 19 | </form>
|
---|
| 20 | </div>
|
---|
| 21 |
|
---|
| 22 | % if param.word:
|
---|
| 23 |
|
---|
| 24 | % if len(query)>0:
|
---|
| 25 | <h4 align="center">Showing the best ${len(query)} matches</h4>
|
---|
| 26 |
|
---|
| 27 | <table align="center" class="data_table" cellpadding="6" cellspacing="0">
|
---|
| 28 | <tr align="center">
|
---|
| 29 | <th width="25%">Name</td>
|
---|
| 30 | <th width="25%">Chromosome</td>
|
---|
| 31 | <th width="25%">Start:End</td>
|
---|
| 32 | <th width="25%">Type</td>
|
---|
| 33 | </tr>
|
---|
| 34 | % for color, row in zip(colors, query):
|
---|
| 35 | ${makerow(color, row)}
|
---|
| 36 | % endfor
|
---|
| 37 | </table>
|
---|
| 38 |
|
---|
| 39 | % else:
|
---|
| 40 | <h4 align="center">No results found</h4>
|
---|
| 41 | % endif
|
---|
| 42 |
|
---|
| 43 | %endif
|
---|
| 44 |
|
---|
| 45 | <br>
|
---|
| 46 | <%def name="makerow(color, row)">
|
---|
| 47 | <tr class="${color}" align="center">
|
---|
| 48 | <td><a href="${h.url_for(controller='genetrack', action='index', chrom=row.chrom, feature=row.start, dataset_id=dataset_id)}">${row.name}</a></td>
|
---|
| 49 | <td>${row.chrom}</td>
|
---|
| 50 | <td>${row.start}:${row.end}</td>
|
---|
| 51 | <td>${row.label.name}</td>
|
---|
| 52 | </tr>
|
---|
| 53 | </%def>
|
---|
| 54 |
|
---|
| 55 | </form>
|
---|