Skip to content
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

fixing download buttons show #2127

Merged
merged 2 commits into from
May 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions qiita_pet/handlers/api_proxy/studies.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ def study_get_req(study_id, user_id):
study_info['has_access_to_raw_data'] = study.has_access(
User(user_id), True)

study_info['show_biom_download_button'] = 'BIOM' in [
a.artifact_type for a in study.artifacts()]
study_info['show_raw_download_button'] = any([
True for pt in study.prep_templates() if pt.artifact is not None])

return {'status': 'success',
'message': '',
'study_info': study_info,
Expand Down
2 changes: 2 additions & 0 deletions qiita_pet/handlers/api_proxy/tests/test_studies.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def test_study_get_req(self):
'owner': 'test@foo.bar',
'ebi_submission_status': 'submitted',
'has_access_to_raw_data': True,
'show_biom_download_button': True,
'show_raw_download_button': True,
'ebi_study_accession': 'EBI123456-BB'},
'editable': True}
self.assertEqual(obs, exp)
Expand Down
6 changes: 4 additions & 2 deletions qiita_pet/templates/study_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,10 @@
<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>
<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>
{% end %}
<a class="btn btn-default btn-block" href="{% raw qiita_config.portal_dir %}/download_study_bioms/{{study_info['study_id']}}"><span class="glyphicon glyphicon-download-alt"></span> All QIIME maps and BIOMs</a>
{% if study_info['has_access_to_raw_data'] %}
{% if study_info['show_biom_download_button'] %}
<a class="btn btn-default btn-block" href="{% raw qiita_config.portal_dir %}/download_study_bioms/{{study_info['study_id']}}"><span class="glyphicon glyphicon-download-alt"></span> All QIIME maps and BIOMs</a>
{% end %}
{% if study_info['has_access_to_raw_data'] and study_info['show_raw_download_button'] %}
<a class="btn btn-default btn-block" href="{% raw qiita_config.portal_dir %}/download_raw_data/{{study_info['study_id']}}"><span class="glyphicon glyphicon-download-alt"></span> All raw data</a>
{% end %}
<div style="text-align: center;"><small><a href="{% raw qiita_config.portal_dir %}/static/doc/html/faq.html#how-to-solve-unzip-errors">Issues opening the downloaded zip?</a></small></div>
Expand Down