diff options
author | Lei Yan | 2015-07-23 16:35:25 +0000 |
---|---|---|
committer | Lei Yan | 2015-07-23 16:35:25 +0000 |
commit | b32f4a01c339bf29556b1ac933afdff8236cd19d (patch) | |
tree | 7d5a875411bb6ee47ac4c9be1fa40ae3c59d3878 /wqflask | |
parent | 5eadc461dbc9f60457d83e4a75f5e0cf043a87ca (diff) | |
download | genenetwork2-b32f4a01c339bf29556b1ac933afdff8236cd19d.tar.gz |
Committer: Lei Yan <lei@penguin.uthsc.edu>
On branch master
Diffstat (limited to 'wqflask')
-rwxr-xr-x | wqflask/wqflask/templates/base.html | 14 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/gsearchact.html | 147 | ||||
-rwxr-xr-x | wqflask/wqflask/views.py | 5 |
3 files changed, 166 insertions, 0 deletions
diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 78682710..79eeae9c 100755 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -73,6 +73,20 @@ </div> </div> </div> + + <div class="container-fluid" style="background-color: #d5d5d5; height: 95px;"> + + <form method="get" action="/gsearch"> + <div class="row" > + <select class="form-control col-xs-2" style="width: 170px; margin-top: 15px; margin-left: 10px;" name="type"> + <option value="gene">Genes / Molecules</option> + <option value="phenotype">Phenotypes</option> + </select> + <input class="btn btn-primary form-control col-xs-2" style="width: 100px; margin-top: 15px; margin-left: 10px;" type="submit" value="Search All"> + <input class="form-control col-xs-6" style="width: 980px; margin-top: 15px; margin-left: 10px;" type="text" name="terms" required> + </div> + </form> + </div> {% block content %}{% endblock %} diff --git a/wqflask/wqflask/templates/gsearchact.html b/wqflask/wqflask/templates/gsearchact.html new file mode 100755 index 00000000..26d7b5cd --- /dev/null +++ b/wqflask/wqflask/templates/gsearchact.html @@ -0,0 +1,147 @@ +{% extends "base.html" %} +{% block title %}Search Results{% endblock %} +{% block css %} + <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" /> + <link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" /> + <link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" /> +{% endblock %} +{% block content %} +<!-- Start of body --> + + <div class="container"> + + <p>To study a record, click on its ID below.<br />Check records below and click Add button to add to selection.</p> + + <div> + <br /> + <button class="btn btn-default" id="select_all"><span class="glyphicon glyphicon-ok"></span> Select All</button> + <button class="btn btn-default" id="deselect_all"><span class="glyphicon glyphicon-remove"></span> Deselect All</button> + <button class="btn btn-default" id="invert"><span class="glyphicon glyphicon-resize-vertical"></span> Invert</button> + <button class="btn btn-default" id="add"><span class="glyphicon glyphicon-plus-sign"></span> Add</button> + <button class="btn btn-primary pull-right"><span class="glyphicon glyphicon-download"></span> Download Table</button> + <br /> + <br /> + <table class="table table-hover table-striped" id="trait_table"> + <thead> + <tr> + <th></th> + <th>Index</th> + <th>Symbol</th> + <th>Record</th> + <th>Description</th> + <th>Species</th> + <th>Group</th> + <th>Tissue</th> + <th>Dataset</th> + <th>Chr</th> + <th>Mb</th> + <th>Mean</th> + <th>Max LRS</th> + <th>Locus</th> + <th>Pvalue</th> + <th>Additive</th> + </tr> + </thead> + + <tbody> + {% for this_trait in results %} + <TR> + <td><input type="checkbox"></td> + <td>{{ loop.index }}</td> + {% for item in this_trait %} + <TD>{{ item }}</TD> + {% endfor %} + </TR> + {% endfor %} + </tbody> + + </table> + </div> + </div> + +<!-- End of body --> + +{% endblock %} + +{% block js %} + <script type="text/javascript" src="/static/new/javascript/search_results.js"></script> + + <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.dataTables.min.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script> + <script language="javascript" type="text/javascript" src="/static/packages/DT_bootstrap/DT_bootstrap.js"></script> + <script language="javascript" type="text/javascript" src="/static/packages/TableTools/media/js/TableTools.min.js"></script> + <script type="text/javascript" charset="utf-8"> + function getValue(x) { + if (x.indexOf('input') >= 0) { + if ($(x).val() == 'x') { + return 0 + } + else { + return parseFloat($(x).val()); + } + } + return parseFloat(x); + } + + jQuery.fn.dataTableExt.oSort['cust-txt-asc'] = function (a, b) { + var x = getValue(a); + var y = getValue(b); + return ((x < y) ? -1 : ((x > y) ? 1 : 0)); + }; + + jQuery.fn.dataTableExt.oSort['cust-txt-desc'] = function (a, b) { + var x = getValue(a); + var y = getValue(b); + return ((x < y) ? 1 : ((x > y) ? -1 : 0)); + }; + + + $(document).ready( function () { + + $('#trait_table tr').click(function(event) { + if (event.target.type !== 'checkbox') { + $(':checkbox', this).trigger('click'); + } + }); + + console.time("Creating table"); + $('#trait_table').DataTable( { + "columns": [ + { "sortable": false }, + { "sortable": true }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural", "width": "35%" }, + { "type": "natural", "width": "15%" }, + { "type": "cust-txt" }, + { "type": "natural", "width": "12%" }, + { "type": "natural", "width": "12%" }, + { "type": "natural", "width": "12%" }, + { "type": "natural", "width": "12%" }, + { "type": "natural", "width": "12%" }, + { "type": "natural", "width": "15%" }, + { "type": "cust-txt" } + ], + + "sDom": "tir", + "iDisplayLength": -1, + "autoWidth": true, + "bLengthChange": true, + "bDeferRender": true, + "bSortClasses": false, + "scrollY": "700px", + "scrollCollapse": true, + "colResize": { + "tableWidthFixed": false, + }, + "paging": false + } ); + + console.timeEnd("Creating table"); + }); + + </script> + +{% endblock %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index a1cecc9e..d188aea1 100755 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -155,6 +155,11 @@ def search_page(): else: return render_template("search_error.html") +@app.route("/gsearch", methods=('GET',)) +def gsearchact(): + result = gsearch.GSearch(request.args).__dict__ + return render_template("gsearchact.html", **result) + @app.route("/gsearch0", methods=('GET',)) def gsearchreq0(): return render_template("gsearch0.html") |