-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprimers_edit.html
91 lines (73 loc) · 3.08 KB
/
primers_edit.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
{% extends "base.html" %}
{% block pagetitle %} Edit Primers for Set '{{ name }}' {% endblock %}
{% block c_body %}
<form action="{{ url_for('edit_primers', id=id) }}" method="POST" name="form" class="form-horizontal">
{{ form.hidden_tag() }}
{{ tables['primers'] }}
{% include 'primer_form.html' %}
<div class="row col-sm-offset-3">
<div class="btn-toolbar ">
{{ form.add_primers(class="btn btn-primary") }}
<input type="submit" value="Close" class="btn btn-default" name="close_btn" id="close_btn">
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#uploadModal" data-primer-id="{{ id }}" id="upload_primer">Upload FASTA</button>
<a class="btn btn-default" href="/static/docs/R1_lim_primers.fasta">Example FASTA</a>
</div>
</div>
<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="uploadModalLabel">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="messageModallLabel">Upload Primers</h4>
</div>
<div class="modal-body">
<input type="file" name="file" id="sel-file"/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" data-dismiss="modal" id="btn-upload">Upload</button>
</div>
</div>
</div>
</div>
</form>
{% endblock %}
{% block scripts %}
{{ super() }}
<script>
$('#uploadModal').on('show.bs.modal', function (event) {
var modal = $(this);
var button = $(event.relatedTarget); // Button that triggered the modal
if(modal.find("#sel-file").value == '') {
modal.find("#btn-upload").prop('disabled', true);
}
modal.find("#btn-upload").click( function()
{
//https://gist.github.com/umidjons/6173837
var file = modal.find("#sel-file").get( 0 ).files[0],
formData = new FormData();
formData.append( 'file', file );
console.log( file );
$.ajax( {
url : '/upload_primers/{{ id }}',
type : 'POST',
contentType: false,
cache : false,
processData: false,
data : formData,
success : function ( data )
{
window.location.reload(true);
}
} );
});
modal.find("#sel-file").change( function()
{
if(modal.find("#sel-file").value != '') {
modal.find("#btn-upload").prop('disabled', false);
}
});
});
</script>
{% include 'sequence_popup_script.html' %}
{% endblock %}