[879b32]: / qiita_pet / templates / study_base.html

Download this file

150 lines (141 with data), 7.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
{% extends sitebase.html %}
{% block head %}
{% set study_title = study_info['study_title'] %}
{% set study_title_msg = study_title.replace('"', '\\"') %}
<script type="text/javascript">
function validate_delete_study_text() {
if ($("#study-alias").val() == "{% raw study_title_msg %}") {
$('#delete-study-button').prop('disabled', false);
} else {
$('#delete-study-button').prop('disabled', true);
}
}
function delete_study() {
if($("#study-alias").val() != "{% raw study_title_msg %}") {
alert("The entered study alias doesn't match the study");
return false;
}
else if(confirm("Are you sure you want to delete {% raw study_title_msg %}?")) {
$.post('{% raw qiita_config.portal_dir %}/study/delete/', { study_id: {{study_info['study_id']}} })
.done(function ( data ) {
location.reload();
});
}
}
/**
*
* Function to populate the main div of the screen
*
* @param url string with the URL to perform the AJAX get call
* @param parameters the parameters for the AJAX call
*
* This function executes an AJAX get against the URL provided with the given
* parameters, and inserts the returned data as HTML in the study-main div
*
*/
function populate_main_div(url, parameters) {
show_loading("study-main");
$.get(url, parameters)
.done(function(data) {
$("#study-main").html(data);
});
}
/**
*
* Function to populate the data-types-menu div
*
* This function executes an AJAX get against the URL
* "/study/description/data_type_menu/" and inserts the returned data as
* HTML in the data-types-menu div
*
*/
function populate_data_type_menu_div() {
show_loading("data-types-menu");
$.get("{% raw qiita_config.portal_dir %}/study/description/data_type_menu/", {study_id: {{study_info['study_id']}} })
.done(function(data) {
$("#data-types-menu").html(data);
});
}
$(document).ready(function() {
// Populate the different sections of the page
populate_data_type_menu_div();
// The initial page to be shown is the base information of the study
{% if 'prep_id' in study_info %}
populate_main_div("{% raw qiita_config.portal_dir %}/study/description/prep_template/", { prep_id: {{study_info['prep_id']}}, study_id: {{study_info['study_id']}}});
{% else %}
populate_main_div("{% raw qiita_config.portal_dir %}/study/description/baseinfo/", { study_id: {{study_info['study_id']}}});
{% end %}
{% if study_info['num_samples'] > 0 %}
$("#sample-summary-btn").show();
$("#add-new-preparation-btn").show();
{% else %}
$("#sample-summary-btn").hide();
$("#add-new-preparation-btn").hide();
{% end %}
{% if study_info['message'] != '' %}
bootstrapAlert("{{study_info['message']}}", "{{study_info['level']}}");
{% end %}
});
</script>
<style>
.graph {
width:100%;
height:300px;
border: 1px solid #ccc;
}
</style>
{% end %}
{% block content %}
<div class="row">
{% if study_info['level'] != 'info' %}
<div class="col-md-3">
<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>
<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>
{% if editable %}
<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>
<button class="btn btn-default btn-block" onclick="populate_main_div('{% raw qiita_config.portal_dir %}/study/analyses/', { study_id: {{study_info['study_id']}} })" id="analyses-btn"><span class="glyphicon glyphicon-info-sign"></span> Derived Analyses </button>
{% end %}
{% 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-download-or-unzip-errors">Issues with downloads or opening the downloaded zip?</a></small></div>
<div id="data-types-menu"></div>
</div>
{% end %}
<div class="col-md-9">
<!-- Study ID and study alias always on top -->
<div class="row">
<div class="col-md-12" id="study-base-info">
<h2>{% raw study_title %} - ID {{study_info['study_id']}}</h2>
<h3>{{study_info['study_alias']}}</h3>
<h6>Do you want to submit to <a target="_blank" href="https://www.ebi.ac.uk/ena">EBI-ENA</a>? Review the <a target="_blank" href="{% raw qiita_config.portal_dir %}/static/doc/html/checklist-for-ebi-ena-submission.html">submission checklist</a></h6>
</div>
</div>
<!-- Dynamic div that changes based on what information is shown -->
<div class="row"><div class="col-md-12" id="study-main"></div></div>
</div>
</div>
<!-- Modal used to delete the study -->
<div class="modal fade delete-study" tabindex="-1" role="dialog" id="delete-study">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Deleting:<br/></h3><h4>{% raw study_title %}</h4>
</div>
<div class="modal-body">
You will only be able to delete a sandboxed study. This will delete all data associated with the study, including analyses using this data.<br/>
To continue you need to write the title of the study:<br/>
<input type="text" name="study-alias" id="study-alias" onkeyup="validate_delete_study_text();" size="{{ len(study_title) }}">
<button class="btn btn-danger glyphicon glyphicon-trash" onclick="delete_study();" id="delete-study-button" disabled></button>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
{% end %}