diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-09-11 17:44:09 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-10-24 12:06:08 +0200 |
commit | df09e512f1b52cf785b039e5accef6dc4b63e1f3 (patch) | |
tree | 3a848bc6b55ac7bfaf59e9d0afdb6119839f4ece /archaeological_finds/templates | |
parent | 05c85f7b03233cc5df9b1f817636a47e7445af3e (diff) | |
download | Ishtar-df09e512f1b52cf785b039e5accef6dc4b63e1f3.tar.bz2 Ishtar-df09e512f1b52cf785b039e5accef6dc4b63e1f3.zip |
Generic QA form - QA find basket form
Diffstat (limited to 'archaeological_finds/templates')
-rw-r--r-- | archaeological_finds/templates/ishtar/forms/qa_find_basket.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/archaeological_finds/templates/ishtar/forms/qa_find_basket.html b/archaeological_finds/templates/ishtar/forms/qa_find_basket.html new file mode 100644 index 000000000..77fc2abcd --- /dev/null +++ b/archaeological_finds/templates/ishtar/forms/qa_find_basket.html @@ -0,0 +1,69 @@ +{% extends "ishtar/forms/qa_base.html" %} +{% load i18n inline_formset table_form %} + +{% block main_form %} + {% if form.non_field_errors %} + <div class="alert alert-danger" role="alert"> + {{form.non_field_errors}} + </div> + {% endif %} + + {% for hidden in form.hidden_fields %} + {{hidden}} + {% if hidden.errors %}<div class="invalid-feedback"> + {{ hidden.errors }} + </div>{% endif %} + {% endfor %} + + {% if form.basket %} + <div class="form-row"> + <input type="radio" name="create_or_update" value="create" + id="create-choice" checked > + <label for="create-choice">{% trans "New" %}</label> + </div> + {% else %} + <input type="hidden" name="create_or_update" value="create"> + {% endif %} + <div id="new-basket"> + <div class="form-row"> + {% with form.label as field %} + {% include "blocks/bs_field_snippet.html" %} + {% endwith %} + </div> + </div> + {% if form.basket %} + <div class="form-row"> + <input type="radio" name="create_or_update" value="update" + id="update-choice"> + <label for="update-choice">{% trans "Add" %}</label> + </div> + <div id="update-basket"> + <div class="form-row"> + {% with form.basket as field %} + {% include "blocks/bs_field_snippet.html" %} + {% endwith %} + </div> + </div> + {% endif %} +{% endblock %} + +{% block js %} +var update_form_display = function(){ + if ($("#update-choice:checked").length){ + $("#new-basket").hide(); + $("#update-basket").show(); + } else { + $("#update-basket").hide(); + $("#new-basket").show(); + } +} + +$(document).ready(function(){ + $("#create-choice").click(update_form_display); + $("#update-choice").click(update_form_display); + update_form_display(); +}); + +{% endblock %} + + |