Skip to content

Commit db0a4b6

Browse files
authored
Merge pull request #2241 from antgonza/fix-2229
fix #2229
2 parents a450aeb + 2d48a65 commit db0a4b6

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

qiita_pet/handlers/study_handlers/prep_template.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def get(self):
4848
res = prep_template_summary_get_req(prep_id, self.current_user.id)
4949

5050
self.render('study_ajax/prep_summary_table.html', pid=prep_id,
51-
stats=res['summary'], editable=res['editable'])
51+
stats=res['summary'], editable=res['editable'],
52+
num_samples=res['num_samples'])
5253

5354

5455
class PrepTemplateAJAX(BaseHandler):

qiita_pet/templates/study_ajax/prep_summary_table.html

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,45 @@
44
});
55
</script>
66

7-
8-
{% from future.utils import viewitems %}
97
<div class="panel panel-default">
108
<div class="panel-heading">
119
Information summary
1210
</div>
1311
<div id="summary-table-div">
12+
1413
<table class="table">
1514
{% for i, (category, summary) in enumerate(stats, -1) %}
1615
<tr id="row_{{i}}">
1716
<td>
18-
<a class="btn btn-danger" onclick="delete_prep_column({{pid}}, '{{category}}', {{i}});"><span class="glyphicon glyphicon-trash"></span></a>
19-
</td>
20-
{% if len(summary) == 1 %}
21-
<td colspan="2">
22-
<b>{{category}}</b>: <tt>{{summary[0][0]}}</tt> is repeated in all rows.
17+
{% if editable %}
18+
<a class="btn btn-danger" onclick="delete_prep_column({{pid}}, '{{category}}', {{i}});"><span class="glyphicon glyphicon-trash"></span></a>
19+
{% else %}
20+
&nbsp;
21+
{% end %}
2322
</td>
24-
{% elif len(set([row[1] for row in summary])) == 1 %}
2523
<td colspan="2">
26-
<b>{{category}}</b>: All the values in this category are different.
27-
</td>
28-
{% else %}
29-
<th colspan="2" align="center">{{category}}</th>
30-
{% for row in summary %}
31-
<tr>
32-
<td width="5px">&nbsp;</td>
33-
<td>{{row[0]}}</td>
34-
<td>{{row[1]}}</td>
35-
</tr>
24+
{% if len(summary) == 1 %}
25+
<b>{{category}}</b>: <tt>{{summary[0][0]}}</tt> is repeated in all rows.
26+
</td>
27+
{% elif len(summary) == num_samples %}
28+
<b>{{category}}</b>: All the values in this category are different.
29+
</td>
30+
{% else %}
31+
<b>{{category}}<b>
32+
&nbsp;&nbsp;&nbsp;&nbsp;
33+
<button type="button" class="btn" data-toggle="collapse" data-target=".{{i}}collapsed">values</button>
34+
</td>
35+
{% for row in summary %}
36+
</tr>
37+
<tr class="collapse {{i}}collapsed">
38+
<td>&nbsp;</td>
39+
<td>{{row[0]}}</td>
40+
<td>{{row[1]}}</td>
41+
{% end %}
3642
{% end %}
37-
{% end %}
3843
</tr>
3944
{% end %}
4045
</table>
46+
4147
</div>
4248
</div>

0 commit comments

Comments
 (0)