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>
|
||||
|
||||
<input type="hidden" name="form_for_dish" value="{{ dish.id }}" />
|
||||
<div id="dish_choices">
|
||||
{% if dish and dish.choices %}
|
||||
{% for (choice_type, choice) in dish.choices %}
|
||||
<div class="form-group select2-container select2">
|
||||
|
@ -72,6 +73,7 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="form-group {{ 'has-errors' if form.dish_id.errors }}">
|
||||
{{ form.comment.label(class='control-label') }}<br>
|
||||
|
@ -202,5 +204,11 @@
|
|||
var choice = options[index]
|
||||
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>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue