mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
Presale: improve clientside handling of max-count for add-on products
* Fix typo in error message * Use exclusive checkboxes for addon items with max_count == 1 and !multi_allowed * combine exclusive items + variations * move exclusive to containing fieldset * fix add-on-exclusive * add max_count check * fix plus/minus-stepper buttons bubbling * Update src/pretix/static/pretixpresale/js/ui/main.js --------- Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
@@ -6,13 +6,13 @@
|
||||
{% load eventsignal %}
|
||||
{% load rich_text %}
|
||||
{% for c in form.categories %}
|
||||
<fieldset>
|
||||
<fieldset data-addon-max-count="{{ c.max_count }}"{% if c.multi_allowed %} data-addon-multi-allowed{% endif %}>
|
||||
<legend>{{ c.category.name }}</legend>
|
||||
{% if c.category.description %}
|
||||
{{ c.category.description|rich_text }}
|
||||
{% endif %}
|
||||
{% if c.min_count == c.max_count %}
|
||||
<p>
|
||||
<p class="addon-count-desc">
|
||||
{% blocktrans trimmed count min_count=c.min_count %}
|
||||
You need to choose exactly one option from this category.
|
||||
{% plural %}
|
||||
@@ -21,7 +21,7 @@
|
||||
</p>
|
||||
{% elif c.min_count == 0 and c.max_count >= c.items|length and not c.multi_allowed %}
|
||||
{% elif c.min_count == 0 %}
|
||||
<p>
|
||||
<p class="addon-count-desc">
|
||||
{% blocktrans trimmed count max_count=c.max_count %}
|
||||
You can choose {{ max_count }} option from this category.
|
||||
{% plural %}
|
||||
@@ -29,7 +29,7 @@
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% else %}
|
||||
<p>
|
||||
<p class="addon-count-desc">
|
||||
{% blocktrans trimmed with min_count=c.min_count max_count=c.max_count %}
|
||||
You can choose between {{ min_count }} and {{ max_count }} options from
|
||||
this category.
|
||||
@@ -196,7 +196,6 @@
|
||||
{% 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 }}_"
|
||||
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" %}
|
||||
|
||||
Reference in New Issue
Block a user