forked from enviPath/enviPy
[Feature] Pathway SVG Export (#102)
Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#102
This commit is contained in:
@ -14,8 +14,12 @@
|
||||
<i class="glyphicon glyphicon-duplicate"></i> Copy</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="button" data-toggle="modal" data-target="#download_pathway_modal">
|
||||
<i class="glyphicon glyphicon-floppy-save"></i> Download Pathway</a>
|
||||
<a class="button" data-toggle="modal" data-target="#download_pathway_csv_modal">
|
||||
<i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as CSV</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="button" data-toggle="modal" data-target="#download_pathway_image_modal">
|
||||
<i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as Image</a>
|
||||
</li>
|
||||
{% if meta.can_edit %}
|
||||
<li role="separator" class="divider"></li>
|
||||
|
||||
@ -1,24 +1,24 @@
|
||||
{% load static %}
|
||||
<!-- Download Pathway -->
|
||||
<div id="download_pathway_modal" class="modal" tabindex="-1">
|
||||
<div id="download_pathway_csv_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Download Pathway</h3>
|
||||
<h3 class="modal-title">Download Pathway as CSV</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
By clicking on Download the Pathway will be converted into a CSV and directly downloaded.
|
||||
<form id="download-pathway-modal-form" accept-charset="UTF-8" action="{{ pathway.url }}"
|
||||
<form id="download-pathway-csv-modal-form" accept-charset="UTF-8" action="{{ pathway.url }}"
|
||||
data-remote="true" method="GET">
|
||||
<input type="hidden" name="download" value="true"/>
|
||||
</form>
|
||||
</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="download-pathway-modal-submit">Download</button>
|
||||
<button type="button" class="btn btn-primary" id="download-pathway-csv-modal-submit">Download</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -26,10 +26,10 @@
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
$('#download-pathway-modal-submit').click(function (e) {
|
||||
$('#download-pathway-csv-modal-submit').click(function (e) {
|
||||
e.preventDefault();
|
||||
$('#download-pathway-modal-form').submit();
|
||||
$('#download_pathway_modal').modal('hide');
|
||||
$('#download-pathway-csv-modal-form').submit();
|
||||
$('#download_pathway_csv_modal').modal('hide');
|
||||
});
|
||||
|
||||
})
|
||||
32
templates/modals/objects/download_pathway_image_modal.html
Normal file
32
templates/modals/objects/download_pathway_image_modal.html
Normal file
@ -0,0 +1,32 @@
|
||||
{% load static %}
|
||||
<!-- Download Pathway -->
|
||||
<div id="download_pathway_image_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Download Pathway as Image</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
By clicking on Download the Pathway will be saved as SVG.
|
||||
</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="download-pathway-image-modal-submit">Download</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
$('#download-pathway-image-modal-submit').click(function (e) {
|
||||
e.preventDefault();
|
||||
downloadSVG($('#pwsvg')[0], '{{ pathway.name.split|join:"_" }}.svg')
|
||||
$('#download_pathway_image_modal').modal('hide');
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
@ -81,7 +81,8 @@
|
||||
{% block action_modals %}
|
||||
{% include "modals/objects/add_pathway_node_modal.html" %}
|
||||
{% include "modals/objects/add_pathway_edge_modal.html" %}
|
||||
{% include "modals/objects/download_pathway_modal.html" %}
|
||||
{% include "modals/objects/download_pathway_csv_modal.html" %}
|
||||
{% include "modals/objects/download_pathway_image_modal.html" %}
|
||||
{% include "modals/objects/generic_copy_object_modal.html" %}
|
||||
{% include "modals/objects/edit_pathway_modal.html" %}
|
||||
{% include "modals/objects/generic_set_scenario_modal.html" %}
|
||||
|
||||
Reference in New Issue
Block a user