forked from enviPath/enviPy
Basic System (#31)
Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#31
This commit is contained in:
65
templates/modals/objects/delete_pathway_edge_modal.html
Normal file
65
templates/modals/objects/delete_pathway_edge_modal.html
Normal file
@ -0,0 +1,65 @@
|
||||
{% load static %}
|
||||
<!-- Delete Edge -->
|
||||
<div id="delete_pathway_edge_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Delete Edge</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Deletes the Edge. Nodes referenced by this edge will remain.
|
||||
<p></p>
|
||||
<form id="delete-pathway-edge-modal-form" accept-charset="UTF-8" action="" data-remote="true"
|
||||
method="post">
|
||||
{% csrf_token %}
|
||||
<select id="delete_pathway_edge_edges" name="edge-url"
|
||||
data-actions-box='true' class="form-control" data-width='100%'>
|
||||
<option value="" disabled selected>Select Reaction to delete</option>
|
||||
{% for e in pathway.edges %}
|
||||
<option value="{{ e.url }}">{{ e.edge_label.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="hidden" id="hidden" name="hidden" value="delete-edge"/>
|
||||
</form>
|
||||
<p></p>
|
||||
<div id="delete_pathway_edge_image"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="delete-pathway-edge-modal-submit">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$("#delete_pathway_edge_edges").selectpicker();
|
||||
|
||||
$("#delete_pathway_edge_edges").on('change', function (e) {
|
||||
edge_url = $('#delete_pathway_edge_edges option:selected').val()
|
||||
|
||||
if (edge_url !== "") {
|
||||
$('#delete_pathway_edge_image').empty();
|
||||
$('#delete_pathway_edge_image').append(
|
||||
"<img width='100%' src='" + edge_url + "?image=svg'>"
|
||||
);
|
||||
}
|
||||
})
|
||||
|
||||
$('#delete-pathway-edge-modal-submit').click(function (e) {
|
||||
e.preventDefault();
|
||||
edge_url = $('#delete_pathway_edge_edges option:selected').val()
|
||||
|
||||
if (edge_url === "") {
|
||||
return;
|
||||
}
|
||||
|
||||
$('#delete-pathway-edge-modal-form').attr('action', edge_url)
|
||||
$('#delete-pathway-edge-modal-form').submit();
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user