Stub for choice selection
This commit is contained in:
parent
e434aad3b8
commit
f60c1d180c
1 changed files with 26 additions and 18 deletions
|
@ -54,6 +54,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="form_for_dish" value="{{ dish.id }}" />
|
<input type="hidden" name="form_for_dish" value="{{ dish.id }}" />
|
||||||
|
<div id="dish_choices">
|
||||||
{% if dish and dish.choices %}
|
{% if dish and dish.choices %}
|
||||||
{% for (choice_type, choice) in dish.choices %}
|
{% for (choice_type, choice) in dish.choices %}
|
||||||
<div class="form-group select2-container select2">
|
<div class="form-group select2-container select2">
|
||||||
|
@ -72,6 +73,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group {{ 'has-errors' if form.dish_id.errors }}">
|
<div class="form-group {{ 'has-errors' if form.dish_id.errors }}">
|
||||||
{{ form.comment.label(class='control-label') }}<br>
|
{{ form.comment.label(class='control-label') }}<br>
|
||||||
|
@ -202,5 +204,11 @@
|
||||||
var choice = options[index]
|
var choice = options[index]
|
||||||
select.val(choice.value).trigger("change")
|
select.val(choice.value).trigger("change")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateChoices() {
|
||||||
|
var dish_id = $("#dish_id").val();
|
||||||
|
$("#dish_choices").html("Choices for " + dish_id);
|
||||||
|
}
|
||||||
|
$("#dish_id").on("change", updateChoices);
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue