Skip to content

Commit 097e1bc

Browse files
antgonzaElDeveloper
authored andcommitted
fix #2226 (#2330)
* fix #2226 * addressing @ElDeveloper comment
1 parent 8c7ed99 commit 097e1bc

File tree

2 files changed

+56
-35
lines changed

2 files changed

+56
-35
lines changed

qiita_pet/templates/study_ajax/sample_summary.html

Lines changed: 56 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@
6666
})
6767
}
6868

69+
function update_sample_prep(){
70+
show_loading('sample-prep-information');
71+
$.get('{% raw qiita_config.portal_dir %}/study/description/sample_summary/', { study_id: {{study_id}} })
72+
.done(function(data) {
73+
$("#sample-prep-information").html(data);
74+
});
75+
}
76+
6977
$(document).ready(function() {
7078
$('#file-btn').prop('disabled', true);
7179
$("#file-selector").change(function (event){
@@ -155,44 +163,58 @@ <h4>
155163
</div>
156164
{% end %}
157165

166+
158167
{% if stats %}
159-
<div class="panel panel-default" id="summary">
160-
<div class="panel-heading">
161-
Sample information summary
168+
169+
<div class="container">
170+
<ul class="nav nav-pills">
171+
<li class="active">
172+
<a href="#sample-information" data-toggle="tab">Sample information</a>
173+
</li>
174+
<li class="nav-item">
175+
<a href="#sample-prep-information" data-toggle="tab" onclick="update_sample_prep();">Sample and preparation summary</a>
176+
</li>
177+
</ul>
178+
179+
<div class="tab-content clearfix">
180+
<div class="tab-pane" id="sample-prep-information">
162181
</div>
163182

164-
<table class="table">
165-
{% for i, (category, summary) in enumerate(viewitems(stats), -1) %}
166-
<tr id="row_{{i}}">
167-
<td>
168-
{% if editable %}
169-
<a class="btn btn-danger" onclick="delete_column('{{category}}', {{i}});"><span class="glyphicon glyphicon-trash"></span></a>
170-
{% else %}
171-
&nbsp;
172-
{% end %}
173-
</td>
174-
<td colspan="2">
175-
{% if len(summary) == 1 %}
176-
<b>{{category}}</b>: <tt>{{summary[0][0]}}</tt> is repeated in all rows.
183+
<div class="tab-pane active" id="sample-information">
184+
<table class="table">
185+
{% for i, (category, summary) in enumerate(viewitems(stats), -1) %}
186+
<tr id="row_{{i}}">
187+
<td>
188+
{% if editable %}
189+
<a class="btn btn-danger" onclick="delete_column('{{category}}', {{i}});"><span class="glyphicon glyphicon-trash"></span></a>
190+
{% else %}
191+
&nbsp;
192+
{% end %}
177193
</td>
178-
{% elif len(summary) == num_samples %}
179-
<b>{{category}}</b>: All the values in this category are different.
194+
<td colspan="2">
195+
{% if len(summary) == 1 %}
196+
<b>{{category}}</b>: <tt>{{summary[0][0]}}</tt> is repeated in all rows.
180197
</td>
181-
{% else %}
182-
<b>{{category}}<b>
183-
&nbsp;&nbsp;&nbsp;&nbsp;
184-
<button type="button" class="btn" data-toggle="collapse" data-target=".{{i}}collapsed">values</button>
185-
</td>
186-
{% for row in summary %}
187-
</tr>
188-
<tr class="collapse {{i}}collapsed">
189-
<td>&nbsp;</td>
190-
<td>{{row[0]}}</td>
191-
<td>{{row[1]}}</td>
192-
{% end %}
193-
{% end %}
194-
</tr>
195-
{% end %}
196-
</table>
198+
{% elif len(summary) == num_samples %}
199+
<b>{{category}}</b>: All the values in this category are different.
200+
</td>
201+
{% else %}
202+
<b>{{category}}<b>
203+
&nbsp;&nbsp;&nbsp;&nbsp;
204+
<button type="button" class="btn" data-toggle="collapse" data-target=".{{i}}collapsed">values</button>
205+
</td>
206+
{% for row in summary %}
207+
</tr>
208+
<tr class="collapse {{i}}collapsed">
209+
<td>&nbsp;</td>
210+
<td>{{row[0]}}</td>
211+
<td>{{row[1]}}</td>
212+
{% end %}
213+
{% end %}
214+
</tr>
215+
{% end %}
216+
</table>
217+
</div>
197218
</div>
219+
</div>
198220
{% end %}

qiita_pet/templates/study_base.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@
225225
<div class="col-md-3">
226226
<button class="btn btn-default btn-block" onclick="populate_main_div('{% raw qiita_config.portal_dir %}/study/description/baseinfo/', { study_id: {{study_info['study_id']}} })"><span class="glyphicon glyphicon-info-sign"></span> Study Information</button>
227227
<button class="btn btn-default btn-block" onclick="populate_main_div('{% raw qiita_config.portal_dir %}/study/description/sample_template/', { study_id: {{study_info['study_id']}} })"><span class="glyphicon glyphicon-info-sign"></span> Sample Information</button>
228-
<button class="btn btn-default btn-block" onclick="populate_main_div('{% raw qiita_config.portal_dir %}/study/description/sample_summary/', { study_id: {{study_info['study_id']}} })" id="sample-summary-btn"><span class="glyphicon glyphicon-th-list"></span> Sample Summary</button>
229228
{% if editable %}
230229
<a class="btn btn-default btn-block" href="{% raw qiita_config.portal_dir %}/study/upload/{{study_info['study_id']}}"><span class="glyphicon glyphicon-upload"></span> Upload Files</a>
231230
<button class="btn btn-default btn-block" onclick="populate_main_div('{% raw qiita_config.portal_dir %}/study/new_prep_template/', { study_id: {{study_info['study_id']}} })" id="add-new-preparation-btn"><span class="glyphicon glyphicon-plus-sign"></span> Add New Preparation</button>

0 commit comments

Comments
 (0)