forked from enviPath/enviPy
62 lines
2.8 KiB
HTML
62 lines
2.8 KiB
HTML
{% load static %}
|
||
<div class="modal fade bs-modal-lg" id="new_rule_modal" tabindex="-1" aria-labelledby="new_rule_modal" aria-modal="true"
|
||
role="dialog">
|
||
<div class="modal-dialog modal-lg">
|
||
<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">Create a new Rule</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form id="new_rule_modal_form" accept-charset="UTF-8" action="{% url 'package rule list' meta.current_package.uuid %}" data-remote="true" method="post">
|
||
{% csrf_token %}
|
||
<label for="rule-name">Name</label>
|
||
<input id="rule-name" class="form-control" name="rule-name" placeholder="Name"/>
|
||
<label for="rule-description">Description</label>
|
||
<input id="rule-description" class="form-control" name="rule-description" placeholder="Description"/>
|
||
<p></p>
|
||
<!-- TODO Ruletypes -->
|
||
<!-- TODO Decide on rules to use?-->
|
||
<input type="hidden" name="rule-type" id="rule-type" value="SimpleAmbitRule">
|
||
|
||
<!-- <select id="rule-type" name="rule-type" class="form-control" data-width='100%'>-->
|
||
<!-- <option disabled selected>Select Rule Type</option>-->
|
||
<!-- {% for k, v in rule_types.items %}-->
|
||
<!-- <option value="{{ v }}">{{ k }}</option>-->
|
||
<!-- {% endfor %}-->
|
||
<!-- </select>-->
|
||
<!-- -->
|
||
<div>
|
||
<iframe id="new_rule_ketcher" src="{% static '/js/ketcher2/ketcher.html' %}" width="100%"
|
||
height="510"></iframe>
|
||
</div>
|
||
<input type="hidden" name="rule-smirks" id="rule-smirks">
|
||
<p></p>
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
|
||
</button>
|
||
<button type="button" class="btn btn-primary" id="new_rule_modal_form_submit">Submit</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<script>
|
||
$(function() {
|
||
$('#new_rule_modal_form_submit').on('click', function(e) {
|
||
e.preventDefault();
|
||
$(this).prop("disabled",true);
|
||
|
||
k = getKetcher('new_rule_ketcher');
|
||
$('#rule-smirks').val(k.getSmiles());
|
||
|
||
// submit form
|
||
$('#new_rule_modal_form').submit();
|
||
});
|
||
});
|
||
</script>
|