diff options
author | zsloan | 2016-03-01 20:57:11 +0000 |
---|---|---|
committer | zsloan | 2016-03-01 20:57:11 +0000 |
commit | d38f4c6c2176d935bcb4f235fb4eee8b3ad703c2 (patch) | |
tree | d898927718d1b0ac944989d683b756750712f4de /wqflask | |
parent | abd3a943df7183e0748507e3200fd12dbbf12c9b (diff) | |
download | genenetwork2-d38f4c6c2176d935bcb4f235fb4eee8b3ad703c2.tar.gz |
Fixed csv download and removed non-working "Download Table" button for collections list, collection view, gene/pheno global search, and regular search
Not sure what the best way to determine the filename is, so just using "search_results" or "collection_list" for now
In future I want to replace the default csv download button by attaching its function to the previous "Download Table" button
Diffstat (limited to 'wqflask')
-rwxr-xr-x | wqflask/wqflask/templates/collections/list.html | 15 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/collections/view.html | 24 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/gsearch_gene.html | 19 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/gsearch_pheno.html | 19 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/search_result_page.html | 32 |
5 files changed, 97 insertions, 12 deletions
diff --git a/wqflask/wqflask/templates/collections/list.html b/wqflask/wqflask/templates/collections/list.html index 52106eae..0e7612aa 100755 --- a/wqflask/wqflask/templates/collections/list.html +++ b/wqflask/wqflask/templates/collections/list.html @@ -4,6 +4,7 @@ <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" /> + <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" /> {% endblock %} {% block content %} <!-- Start of body --> @@ -55,6 +56,10 @@ {% block js %} <script type="text/javascript" src="/static/packages/smart-time-ago/lib/timeago.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="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.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> @@ -62,7 +67,15 @@ <script language="javascript" type="text/javascript" src="/static/packages/TableTools/media/js/TableTools.min.js"></script> <script> $('#trait_table').dataTable( { - "sDom": "RZtir", + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'collection_list', + fieldBoundary: '"' + } + ], + "sDom": "RZBtir", "iDisplayLength": -1, "autoWidth": true, "bDeferRender": true, diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index 5450f903..a53759c4 100755 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -4,6 +4,7 @@ <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" /> + <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" /> {% endblock %} {% block content %} <!-- Start of body --> @@ -73,12 +74,12 @@ <button class="btn btn-default" id="invert"><span class="glyphicon glyphicon-resize-vertical"></span> Invert</button> <button class="btn" id="add" disabled="disabled"><i class="icon-plus-sign"></i> Add Record to Other Collection</button> <button class="btn" id="remove" disabled="disabled"><i class="icon-minus-sign"></i> Remove Record</button> - <button class="btn btn-primary pull-right"><i class="icon-download icon-white"></i> Download Table</button> <br /> <br /> <table class="table table-hover table-striped" id='trait_table'> <thead> <tr> + <th></th> <th>Index</th> <th>Record</th> <th>Description</th> @@ -93,10 +94,11 @@ <tbody> {% for this_trait in trait_obs %} <TR id="trait:{{ this_trait.name }}:{{ this_trait.dataset.name }}"> - <TD>{{ loop.index }} + <TD> <INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"> </TD> + <TD>{{ loop.index }}</TD> <TD> <a href="{{ url_for('show_trait_page', trait_id = this_trait.name, @@ -129,6 +131,10 @@ {% 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="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.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> @@ -150,6 +156,7 @@ "columns": [ { "type": "natural" }, { "type": "natural" }, + { "type": "natural" }, { "type": "natural", "width": "35%" }, { "type": "natural", @@ -161,7 +168,18 @@ "width": "15%" }, { "type": "natural" } ], - "sDom": "ZRtir", + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'collection', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8] + } + } + ], + "sDom": "ZRBtir", "iDisplayLength": -1, "autoWidth": true, "bDeferRender": true, diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 0a1839a1..7cc9a1bd 100755 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -6,6 +6,7 @@ <link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" /> <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.css" > <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/fixedcolumns/3.0.4/css/dataTables.fixedColumns.css"> + <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" /> {% endblock %} {% block content %} <!-- Start of body --> @@ -20,7 +21,6 @@ <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" disabled ><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> <input type="text" id="searchbox" class="form-control" style="width: 180px; display: inline;" placeholder="Search This Table For ..."> <input type="text" id="select_top" class="form-control" style="width: 120px; display: inline;" placeholder="Select Top ..."> @@ -77,6 +77,10 @@ <script language="javascript" 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="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.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.colReorder.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> @@ -169,7 +173,18 @@ { "type": "cust-txt" } ], "order": [[ 1, "asc" ]], - "sDom": "RZtir", + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'search_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] + } + } + ], + "sDom": "RZBtir", "autoWidth": false, "bLengthChange": true, "bDeferRender": true, diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index 2527bebf..0bdc4f4e 100755 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -4,6 +4,7 @@ <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" /> + <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" /> <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.css" > <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/fixedcolumns/3.0.4/css/dataTables.fixedColumns.css"> {% endblock %} @@ -20,7 +21,6 @@ <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" disabled ><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> <input type="text" id="searchbox" class="form-control" style="width: 200px; display: inline;" placeholder="Search This Table For ..."> <input type="text" id="select_top" class="form-control" style="width: 200px; display: inline;" placeholder="Select Top ..."> <br /> @@ -70,6 +70,10 @@ <script language="javascript" 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="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.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.colReorder.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> @@ -137,7 +141,18 @@ { "type": "natural" } ], "order": [[ 1, "asc" ]], - "sDom": "RZtir", + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'search_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + } + } + ], + "sDom": "RZBtir", "autoWidth": false, "bLengthChange": true, "bDeferRender": true, diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 02365b1d..ff3e04bb 100755 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -167,7 +167,7 @@ <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/new/packages/DataTables/extensions/dataTables.fixedHeader.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.min.js"></script> <script language="javascript" type="text/javascript" src="//cdn.datatables.net/fixedcolumns/3.0.4/js/dataTables.fixedColumns.min.js"></script> <script type="text/javascript" charset="utf-8"> @@ -234,7 +234,15 @@ ], "order": [[1, "asc" ]], "buttons": [ - 'csv' + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'search_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8, 9] + } + } ], "sDom": "RZBtir", "iDisplayLength": -1, @@ -260,7 +268,15 @@ ], "order": [[1, "asc" ]], "buttons": [ - 'csv' + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'search_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7] + } + } ], "sDom": "RZBtir", "iDisplayLength": -1, @@ -281,7 +297,15 @@ ], "order": [[1, "asc" ]], "buttons": [ - 'csv' + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'search_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3] + } + } ], "sDom": "RZBtir", "iDisplayLength": -1, |