Skip to content

List proc data in search #1039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
show proc data for each study properly
  • Loading branch information
squirrelo committed Apr 6, 2015
commit 9227ee390618a9b34ed4e1c3fe9364c2abceacc5
11 changes: 6 additions & 5 deletions qiita_pet/handlers/study_handlers/listing_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,12 @@ def _build_study_info(user, study_proc=None, proc_samples=None):
proc_data_info = []
for pid in study_proc[study.id]:
proc_data = ProcessedData(pid)
info = proc_data.processing_info
info['pid'] = pid
info['samples'] = proc_samples[pid]
proc_data_info.append(info)
proc_info = proc_data.processing_info
proc_info['pid'] = pid
proc_info['data_type'] = proc_data.data_type()
proc_info['samples'] = sorted(proc_samples[pid])
proc_info['processed_date'] = str(proc_info['processed_date'])
proc_data_info.append(proc_info)

infolist.append({
"checkbox": "<input type='checkbox' value='%d' />" % study.id,
Expand Down Expand Up @@ -235,7 +237,6 @@ def get(self, ignore):

if user != self.current_user.id:
raise HTTPError(403, 'Unauthorized search!')
res = None
if query:
# Search for samples matching the query
search = QiitaStudySearch()
Expand Down
21 changes: 13 additions & 8 deletions qiita_pet/templates/list_studies.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{% extends sitebase.html %}
{% block head %}
<link rel="stylesheet" href="/static/vendor/css/jquery.dataTables.css" type="text/css">

<style>
td.details-control {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably go in style.css.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's specific to this page, so I've left it in header.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

On (Apr-13-15|12:37), Joshua Shorenstein wrote:

@@ -1,7 +1,11 @@
{% extends sitebase.html %}
{% block head %}

+<style>
+td.details-control {

it's specific to this page, so I've left it in header.


Reply to this email directly or view it on GitHub:
https://github.com/biocore/qiita/pull/1039/files#r28271335

cursor: pointer;
}
</style>
<script src="/static/vendor/js/jquery.dataTables.min.js"></script>
<script src="/static/vendor/js/jquery.dataTables.plugin.natural.js"></script>

Expand All @@ -12,18 +16,18 @@

function format ( d ) {
// `d` is the original data object for the row
var proc_data_table = '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;"><tr><th></th><th>ID</th><th>Data type</th><th>Processed Date</th><th>Reference</th></tr>';
var proc_data_table = '<h4>Processed Data</h4><table class="table" cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;"><tr><th></th><th>ID</th><th>Data type</th><th>Processed Date</th><th>Algorithm</th><th>Reference</th><th>Samples</th></tr>';
for(i=0;i<d.proc_data_info.length;i++) {
var proc_data = d.proc_data_info[i];
proc_data_table += '<tr><td><input type="checkbox"></td><td>' + proc_data.pid + '</td><td>' + proc_data.data_type + '</td><td>' + proc_data.processed_date + '</td><td>' + proc_data.refrence + ' ' + proc_data.reference_version + '</td></tr>';
proc_data_table += '<tr><td><input type="checkbox"></td><td>' + proc_data.pid + '</td><td>' + proc_data.data_type + '</td><td>' + proc_data.processed_date + '</td><td>' + proc_data.algorithm + '</td><td>' + proc_data.reference_name + ' ' + proc_data.reference_version + '</td><td>' + proc_data.samples.length + '</td></tr>';
}
proc_data_table += '</table>';
return proc_data_table;
}

$('#studies-table').dataTable({
"columns": [
{"className": 'details-control', "orderable": false, "data": null, "defaultContent": ''},
{ "data": "checkbox", "orderable": false},
{ "data": "title" },
{ "data": "abstract" },
{ "data": "id" },
Expand All @@ -33,7 +37,8 @@
{ "data": "shared" },
{ "data": "pi" },
{ "data": "pmid" },
{ "data": "status" }
{ "data": "status" },
{"className": 'details-control', "orderable": false, "data": null, "defaultContent": '<span class="glyphicon glyphicon-chevron-down"></span>'}
],
order: [[10, "desc"], [ 1, "asc" ]],
columnDefs: [{type:'natural', targets:[3,4,5,9]}, {"targets": [ 2 ],"visible": false}],
Expand All @@ -53,6 +58,7 @@
});
// Add event listener for opening and closing details
$('#studies-table tbody').on('click', 'td.details-control', function () {
var table = $('#studies-table').DataTable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is under-indented.

var tr = $(this).closest('tr');
var row = table.row( tr );

Expand Down Expand Up @@ -133,7 +139,7 @@ <h1>Metadata Search</h1>
<div class="row">
<div class="col-sm-12" id="user-studies-div">
<h1>Available Studies</h1>
<table id="studies-table" class="display table-bordered table-hover">
<table id="studies-table" class="table table-bordered">
<thead>
<tr>
<th></th>
Expand All @@ -147,10 +153,9 @@ <h1>Available Studies</h1>
<th>Principal Investigator</th>
<th>Pubmed ID(s)</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<!--Abstract Modal-->
<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="study-abstract-modal">
Expand Down