forked from Merck/TraceTrack
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
116 lines (99 loc) · 5.19 KB
/
index.html
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
{% extends "layout.html" %}
{% block title %}Trace file alignment{% endblock %}
{% block nav_index %}active{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}
{% block container %}
<div class="row">
<div class="col-sm">
<form id="upload" method="post" action="/input" enctype="multipart/form-data">
<div class="form-check text-right" >
<input type="checkbox" class="form-check-input" value="Use example" id="example" name="exampleButton">
<label class="form-check-label" for="example">Use example </label>
</div>
<div class="file-upload">
<h4 class="badged-header"><span class="badge badge-primary">1</span>Trace Files</h4>
<div class="row" id="populationInputs">
{% for i in range(1, 2) %}
<div class="col-md-4 population-input" id="populationInput{{ i }}">
<div class="form-group">
<label class="label-required">Group name</label>
<input class="form-control form-control-sm population-name" name="population{{ i }}" value="Group {{ i }}" required>
</div>
<div class="form-group">
<label class="label-required">Trace files</label>
<input class="form-control-file population-file" type="file" name="tracefile{{ i }}[]"
id="tracefile{{ i }}" multiple="" autocomplete="off"
accept=".ab1,.zip"
required>
<small class="form-text text-muted">Multiple .zip or .ab1 files</small>
</div>
</div>
{% endfor %}
</div>
<h4 class="badged-header"><span class="badge badge-primary">2</span>References</h4>
<p>
Your traces will be aligned to the best matching reference sequence.
</p>
<div class="form-group">
<label for="reffile" class="label-required">Reference sequences (coding region)</label>
<input class="form-control-file" type="file" accept=".xlsx,.csv,.fasta,.fa,.gb,.gbk,.genbank"
name="reference" autocomplete="off" required id="reffile">
<small class="form-text text-muted">Single FASTA, GenBank, CSV or Excel file with <em>RefID</em> and <em>Sequence</em> columns</small>
</div>
</div>
<div class="example-used" style="display: none;">
<h4>Using example files</h4>
</div>
<br>
<div class="form-group">
<div class="btn-group" role="group">
<input type="submit" name="submit" class="btn btn-primary btn-lg" value="Submit">
</div>
</div>
</form>
</div>
</div>
{% endblock %}
{% block scripts %}
{{ super() }}
<script>
$(function(){
$('.example-used').hide()
var populationInputsWrapper = $('#populationInputs')
var populationIndex = populationInputsWrapper.children().length
// Add new population column when last available population is filled in
populationInputsWrapper.on('change', '.population-file', function(){
// Enable all inputs
populationInputsWrapper.find('input:disabled').removeAttr('disabled')
// Add new column if last available column is filled in
if ($(this).is('.population-input:last-child input')) {
var cloned = $('#populationInput1').clone()
cloned.removeAttr('required')
populationIndex += 1
cloned.prop('id', 'populationInput'+populationIndex)
var name = cloned.find('.population-name')
name.removeAttr('required')
name.val('Group '+populationIndex).prop('name', 'population'+populationIndex)
var file = cloned.find('.population-file')
file.removeAttr('required')
file.val(null).prop('name', 'tracefile'+populationIndex+'[]')
cloned.find('.label-required').removeClass('label-required')
populationInputsWrapper.append(cloned)
}
})
$('#example').change(function() {
if ($(this).prop('checked')){
$('.file-upload').hide();
$("#tracefile1,#reffile").removeAttr('required');
$('.example-used').show();
} else {
$('.example-used').hide();
$('.file-upload').show();
$("#tracefile1,#reffile").addAttr('required');
}
});
} );
</script>
{% endblock %}