From 79b232f79370a7ad0ba1daf4849a0f0403754ab1 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Wed, 16 Aug 2017 07:41:21 -0600 Subject: [PATCH 1/2] fix #2229 --- .../handlers/study_handlers/prep_template.py | 3 +- .../study_ajax/prep_summary_table.html | 63 +++++++++++-------- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/qiita_pet/handlers/study_handlers/prep_template.py b/qiita_pet/handlers/study_handlers/prep_template.py index 78bc6dade..401c72986 100644 --- a/qiita_pet/handlers/study_handlers/prep_template.py +++ b/qiita_pet/handlers/study_handlers/prep_template.py @@ -48,7 +48,8 @@ def get(self): res = prep_template_summary_get_req(prep_id, self.current_user.id) self.render('study_ajax/prep_summary_table.html', pid=prep_id, - stats=res['summary'], editable=res['editable']) + stats=res['summary'], editable=res['editable'], + num_samples=res['num_samples']) class PrepTemplateAJAX(BaseHandler): diff --git a/qiita_pet/templates/study_ajax/prep_summary_table.html b/qiita_pet/templates/study_ajax/prep_summary_table.html index 024dafb57..2a2cac913 100644 --- a/qiita_pet/templates/study_ajax/prep_summary_table.html +++ b/qiita_pet/templates/study_ajax/prep_summary_table.html @@ -4,39 +4,48 @@ }); - -{% from future.utils import viewitems %}
Information summary
- - {% for i, (category, summary) in enumerate(stats, -1) %} - - - {% if len(summary) == 1 %} - - {% elif len(set([row[1] for row in summary])) == 1 %} - - {% else %} - - {% for row in summary %} - - - - + +
- - - {{category}}: {{summary[0][0]}} is repeated in all rows. - - {{category}}: All the values in this category are different. - {{category}}
 {{row[0]}}{{row[1]}}
+ {% for i, (category, summary) in enumerate(stats, -1) %} + + + + {% elif len(summary) == num_samples %} + {{category}}: All the values in this category are different. + + {% else %} + {{category}} +      + + + {% for row in summary %} + + + + + + {% end %} + {% end %} {% end %} - {% end %} - - {% end %} -
+ {% if editable %} + + {% else %} +   + {% end %} + + {% if len(summary) == 1 %} + {{category}}: {{summary[0][0]}} is repeated in all rows. +
 {{row[0]}}{{row[1]}}
+ + + + +
From 2d48a65907f21371e86a0d9ad312c77b1e1650b2 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Wed, 16 Aug 2017 07:42:17 -0600 Subject: [PATCH 2/2] cleaning html --- .../study_ajax/prep_summary_table.html | 63 +++++++++---------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/qiita_pet/templates/study_ajax/prep_summary_table.html b/qiita_pet/templates/study_ajax/prep_summary_table.html index 2a2cac913..cb8c19ee6 100644 --- a/qiita_pet/templates/study_ajax/prep_summary_table.html +++ b/qiita_pet/templates/study_ajax/prep_summary_table.html @@ -10,42 +10,39 @@
- - {% for i, (category, summary) in enumerate(stats, -1) %} - - + {% end %} +
- {% if editable %} - - {% else %} -   - {% end %} + + {% for i, (category, summary) in enumerate(stats, -1) %} + + + + {% elif len(summary) == num_samples %} + {{category}}: All the values in this category are different. - - {% elif len(summary) == num_samples %} - {{category}}: All the values in this category are different. - - {% else %} - {{category}} -      - - - {% for row in summary %} - - - - - - {% end %} + {% else %} + {{category}} +      + + + {% for row in summary %} + + + + + {% end %} - {% end %} -
+ {% if editable %} + + {% else %} +   + {% end %} + + {% if len(summary) == 1 %} + {{category}}: {{summary[0][0]}} is repeated in all rows. + - {% if len(summary) == 1 %} - {{category}}: {{summary[0][0]}} is repeated in all rows. -
 {{row[0]}}{{row[1]}}
 {{row[0]}}{{row[1]}}
- - - +