This commit is contained in:
Ross
2021-11-25 18:30:37 +00:00
parent 19b716e483
commit a091d2b350
+56 -56
View File
@@ -2,72 +2,72 @@
<!-- {% load static from static %} --> <!-- {% load static from static %} -->
{% block css %} {% block css %}
{{form.media}} {{form.media}}
{% endblock %} {% endblock %}
{% block js %} {% block js %}
<!--<script type="text/javascript" src="/admin/jsi18n/"></script>--> <!--<script type="text/javascript" src="/admin/jsi18n/"></script>-->
<script type="text/javascript"> <script type="text/javascript">
function showEditPopup(url) { function showEditPopup(url) {
var win = window.open(url, "Edit", var win = window.open(url, "Edit",
'height=500,width=800,resizable=yes,scrollbars=yes'); 'height=500,width=800,resizable=yes,scrollbars=yes');
return false; return false;
} }
function showAddPopup(triggeringLink) { function showAddPopup(triggeringLink) {
var name = triggeringLink.id.replace(/^add_/, ''); var name = triggeringLink.id.replace(/^add_/, '');
href = triggeringLink.href; href = triggeringLink.href;
var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes'); var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
win.focus(); win.focus();
return false; return false;
} }
function closePopup(win, newID, newRepr, id) { function closePopup(win, newID, newRepr, id) {
console.log(id) console.log(id)
$(id + "_to").append('<option value=' + newID + ' title=' + newRepr + ' >' + newRepr + '</option>') $(id + "_to").append('<option value=' + newID + ' title=' + newRepr + ' >' + newRepr + '</option>')
win.close(); win.close();
} }
function add_input_form() { function add_input_form() {
var form_idx = $('#id_LongSeries_long-TOTAL_FORMS').val(); var form_idx = $('#id_Long_series-TOTAL_FORMS').val();
$('#form_set').append($('#empty_form').html().replace(/__prefix__/g, form_idx)); $('#form_set').append($('#empty_form').html().replace(/__prefix__/g, form_idx));
$('#id_LongSeries_long-TOTAL_FORMS').val(parseInt(form_idx) + 1); $('#id_Long_series-TOTAL_FORMS').val(parseInt(form_idx) + 1);
} }
$(document).ready(function () { $(document).ready(function () {
$('#add_more').click(() => { add_input_form() }); $('#add_more').click(() => { add_input_form() });
}) })
</script> </script>
<!-- {{ form.media }} --> <!-- {{ form.media }} -->
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h2>Submit Long Case</h2> <h2>Submit Long Case</h2>
Use this form to create a long case. Existing associated image sets can be added using this form. Use this form to create a long case. Existing associated image sets can be added using this form.
<form action="" method="post" enctype="multipart/form-data" id="long-form"> <form action="" method="post" enctype="multipart/form-data" id="long-form">
{% csrf_token %} {% csrf_token %}
<table> <table>
{{ form.as_table }} {{ form.as_table }}
</table> </table>
<h3>Series:</h3> <h3>Series:</h3>
Add image sets here. These can only be added once created (they can also be added to cases on creation). Add image sets here. These can only be added once created (they can also be added to cases on creation).
<input type="button" value="Add More Series" id="add_more"> <input type="button" value="Add More Series" id="add_more">
<div id="form_set"> <div id="form_set">
{% for form in series_formset %} {% for form in series_formset %}
<ul class="no-error series-formset"> <ul class="no-error series-formset">
{{form.non_field_errors}} {{form.non_field_errors}}
{{form.errors}} {{form.errors}}
{{ form.as_ul }} {{ form.as_ul }}
</ul>
{% endfor %}
</div>
{{ series_formset.management_form }}
<input type="submit" class="submit-button" value="Submit" name="submit">
</form>
<div id="empty_form" style="display:none">
<ul class='no_error series-formset'>
{{ series_formset.empty_form.as_ul }}
</ul> </ul>
{% endfor %}
</div> </div>
{% endblock %} {{ series_formset.management_form }}
<input type="submit" class="submit-button" value="Submit" name="submit">
</form>
<div id="empty_form" style="display:none">
<ul class='no_error series-formset'>
{{ series_formset.empty_form.as_ul }}
</ul>
</div>
{% endblock %}