diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-01-29 18:50:24 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-01-29 18:51:53 +0100 |
commit | c7ad0854b7e8d95fcd1d48287063eac2db8bff39 (patch) | |
tree | 0ca065af2ce3b7afbc682cceb9999a680870015e /archaeological_finds/templates | |
parent | d1ccd3fe6f240882b2158e046b4e7908a814930f (diff) | |
download | Ishtar-c7ad0854b7e8d95fcd1d48287063eac2db8bff39.tar.bz2 Ishtar-c7ad0854b7e8d95fcd1d48287063eac2db8bff39.zip |
QA packaging: allow to change ref and current containers
Diffstat (limited to 'archaeological_finds/templates')
-rw-r--r-- | archaeological_finds/templates/ishtar/forms/qa_find_treatment.html | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html b/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html index f20f0cb65..38db02ff4 100644 --- a/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html +++ b/archaeological_finds/templates/ishtar/forms/qa_find_treatment.html @@ -27,9 +27,9 @@ </div> <div class="form-row"> - {{ form.reference_container }} <label for="{{form.reference_container.auto_id}}"> - {% trans "Change the reference container" %} - </label> + {% with form.container_to_change as field %} + {% include "blocks/bs_field_snippet.html" %} + {% endwith %} </div> <div class="form-row"> @@ -38,15 +38,13 @@ </label> </div> <div id="new-treatment"> - {% with force_large_col=True %}{% for field in form %} - {% if field.name != 'reference_container' and field.name != 'container' and field.name != 'create_treatment' %} - {% if forloop.counter|divisibleby:2 %} - <div class="form-row">{% endif %} + <div class="form-row"> + {% with force_large_col=false %}{% for field in form %} + {% if field.name != 'container_to_change' and field.name != 'container' and field.name != 'create_treatment' %} {% include "blocks/bs_field_snippet.html" %} - {% if not forloop.counter0|divisibleby:2 %} - </div>{% endif %} {% endif %} {% endfor %}{% endwith %} + </div> </div> {% endblock %} @@ -57,11 +55,32 @@ var update_form_display = function(){ } else { $("#new-treatment").hide(); } -} +}; + +var treatment_type_ref_choices = "{{form.treatment_type_ref_choices|safe}}"; +var treatment_type_current_choices = "{{form.treatment_type_current_choices|safe}}"; +var treatment_type_all_choices = "{{form.treatment_type_all_choices|safe}}"; + +var update_treatment_type_choices = function(){ + var container_to_change = $("#id_qa-packaging-container_to_change").val(); + var tt_sel = $("#id_qa-packaging-treatment_type") + tt_sel.empty() + if (container_to_change == 'reference'){ + tt_sel.append(treatment_type_ref_choices); + } + if (container_to_change == 'current'){ + tt_sel.append(treatment_type_current_choices); + } + if (container_to_change == 'current-and-reference'){ + tt_sel.append(treatment_type_all_choices); + } +}; $(document).ready(function(){ $("#{{form.create_treatment.auto_id}}").click(update_form_display); + $("#{{form.container_to_change.auto_id}}").change(update_treatment_type_choices); update_form_display(); + update_treatment_type_choices(); }); {% endblock %} |