-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvdjbase_review.html
167 lines (139 loc) · 4.91 KB
/
vdjbase_review.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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
{% extends "base_wide.html" %}
{% block pagetitle %} Review VDJbase Inferences {% endblock %}
{% block content %}
{% include 'sequence_popup.html' %}
{{ super() }}
{% endblock %}
{% block c_body %}
<form action="{{ url_for('vdjbase_review') }}" method="POST" name="form" class="form-horizontal" enctype="multipart/form-data">
{{ form.hidden_tag() }}
<div class="row">
<div class="form-inline">
<div class="col-sm-offset-1 col-sm-3">
{{ form.species.label(class="") }}
{{ form.species(class="form-control")|safe }}
</div>
<div class="col-sm-3">
{{ form.locus.label() }}
{{ form.locus(class="form-control")|safe }}
</div>
<div class="col-sm-2">
<input type="submit" value="View" class="btn btn-primary" id="view_btn" name="view_btn">
</div>
</div>
</div>
{% if table %}
<div class="row">
<h4 class="col-sm-offset-1 col-sm-11 edit">Sequences observed in full-length repertoires</h4>
<div class="col-sm-10 col-sm-offset-1">
<div class="form-group">
{{ table }}
</div>
</div>
</div>
{% endif %}
</form>
{% endblock %}
{% block scripts %}
{{ super() }}
<script src="/static/script/helpers.js"></script>
<script>
$(document).ready(function ()
{
{% if table %}
init_datatable();
{% endif %}
const selected = $(this).find("option:selected").val();
if (selected == 'Select') {
$("#view_btn").prop('disabled', true);
}
});
$("#species").change(function(e) {
console.log('changed');
$("#locus").empty();
const choices = JSON.parse('{{ locus_choices | safe }}');
const selected = $(this).find("option:selected").val();
const opts = Reflect.get(choices, selected);
if (opts) {
for (let opt of opts) {
$("#locus").append('<option value="' + opt + '">' + opt + '</option>');
}
}
$("#view_btn").prop('disabled', (selected == 'Select'));
});
// Note that the table MUST have a style of width: 100% or DataTables will not resize it properly
function init_datatable() {
if(!$.fn.DataTable.isDataTable($("#seq_table"))) {
$("#seq_table").DataTable({
dom: 'Blfrtip',
"paging": true,
"searching": true,
"select": false,
"info": false,
"lengthMenu": [ 25, 100, 500, 5000 ],
"colReorder": true,
"columnDefs": [
{"visible": false, "targets": [0, -1]},
{"width": "0px", "targets": [0, -1]},
],
"buttons": [
{
extend: 'excel',
exportOptions: {
columns: [1,2,3,4,5,6,7,8,9,11]
}
},
{
extend: 'csv',
exportOptions: {
columns: [1,2,3,4,5,6,7,8,9,11]
}
}
]
});
}
const table = $('#seq_table').DataTable();
const statusOptions = {
'not reviewed':'not reviewed',
'in review':'in review',
'rejected':'rejected',
'holding':'holding',
'submitted':'submitted',
'not current':'not current',
'modified':'modified',
}
{% if editor %}
$( table.column(6).nodes() ).editable( '/vdjbase_status', {
type: 'select',
data : JSON.stringify(statusOptions),
submit: 'OK',
callback: function( value, y ) {
table.cell( this ).data( value ).draw();
},
submitdata: function ( value, settings ) {
return {
'id': table.row( this ).data()[0],
'current': table.row( this ).data()[6],
};
}
} );
{% endif %}
}
function sequence_warn(seq_id, root_url, message) {
foo = BootstrapDialog.confirm({
title: 'Create entry?',
message: message,
type: BootstrapDialog.TYPE_WARNING, // <-- Default value is BootstrapDialog.TYPE_PRIMARY
btnOKLabel: ' Create ',
btnOKClass: 'btn-warning',
callback: function(result) {
if(result) {
console.log(seq_id);
window.location.assign(root_url + seq_id);
}
}
});
}
</script>
{% include 'sequence_popup_script.html' %}
{% endblock %}