mirror of
https://github.com/pretix/pretix.git
synced 2026-08-23 12:51:59 +00:00
combine exclusive items + variations
This commit is contained in:
@@ -193,7 +193,7 @@
|
||||
{% endif %}
|
||||
id="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}"
|
||||
name="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}"
|
||||
data-exclusive-prefix="cp_{{ form.pos.pk }}_variation_{{ item.id }}_"
|
||||
data-exclusive-prefix="cp_{{ form.pos.pk }}_"
|
||||
aria-label="{% blocktrans with item=item.name var=var %}Add {{ item }}, {{ var }} to cart{% endblocktrans %}">
|
||||
<i class="fa fa-shopping-cart" aria-hidden="true"></i>
|
||||
{% trans "Select" context "checkbox" %}
|
||||
@@ -334,7 +334,7 @@
|
||||
checked="checked"
|
||||
{% endif %}
|
||||
{% if c.max_count == 1 %}
|
||||
data-exclusive-prefix="cp_{{ form.pos.pk }}_item_"
|
||||
data-exclusive-prefix="cp_{{ form.pos.pk }}_"
|
||||
{% endif %}
|
||||
name="cp_{{ form.pos.pk }}_item_{{ item.id }}"
|
||||
id="cp_{{ form.pos.pk }}_item_{{ item.id }}"
|
||||
|
||||
@@ -149,13 +149,11 @@ var form_handlers = function (el) {
|
||||
).find("canvas").attr("role", "img").attr("aria-label", this.getAttribute("data-desc"));
|
||||
});
|
||||
|
||||
el.find("input[data-exclusive-prefix]").each(function () {
|
||||
var $others = $("input[name^=" + $(this).attr("data-exclusive-prefix") + "]:not([name=" + $(this).attr("name") + "])");
|
||||
$(this).on('click change', function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$others.prop('checked', false).trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
el.find("fieldset:has(input[data-exclusive-prefix])").on('change', function (e) {
|
||||
if (e.target.checked) {
|
||||
$(".input[type=checkbox][name^=" + e.target.getAttribute("data-exclusive-prefix") + "]:checked", this).not(e.target).prop('checked', false).trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
el.find("input[name*=question], select[name*=question]").change(questions_toggle_dependent);
|
||||
|
||||
Reference in New Issue
Block a user