forked from CGM_Public/pretix_original
Presale: Hide subevent lists if subevents exist but none are visible (Z#23186153) (#5054)
* Hide subevent lists (but not calendars) if subevents exist but none are visible, to avoid confusion during checkout
This commit is contained in:
@@ -71,14 +71,15 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% if subevent_list_foldable %}
|
{% if subevent_list.list_type != "list" or subevent_list.visible_events %}
|
||||||
<details class="panel panel-{% if show_cart %}primary{% else %}default{% endif %}">
|
{% if subevent_list_foldable %}
|
||||||
<summary class="panel-heading">
|
<details class="panel panel-{% if show_cart %}primary{% else %}default{% endif %}">
|
||||||
{% else %}
|
<summary class="panel-heading">
|
||||||
<div class="panel panel-default">
|
{% else %}
|
||||||
<div class="panel-heading">
|
<div class="panel panel-default">
|
||||||
{% endif %}
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title"><b>
|
{% endif %}
|
||||||
|
<h3 class="panel-title"><b>
|
||||||
{% if subevent_list_foldable %}
|
{% if subevent_list_foldable %}
|
||||||
{% if show_cart %}
|
{% if show_cart %}
|
||||||
{% trans "Add tickets for a different date" %}
|
{% trans "Add tickets for a different date" %}
|
||||||
@@ -88,35 +89,36 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
{% trans "Choose date to book a ticket" %}
|
{% trans "Choose date to book a ticket" %}
|
||||||
{% endif %}</b>
|
{% endif %}</b>
|
||||||
</h3>
|
</h3>
|
||||||
{% if subevent_list_foldable %}
|
{% if subevent_list_foldable %}
|
||||||
</summary>
|
</summary>
|
||||||
<div>
|
<div>
|
||||||
{% else %}
|
{% else %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if filter_form.fields %}
|
{% if filter_form.fields %}
|
||||||
<div class="panel-subhead">
|
<div class="panel-subhead">
|
||||||
{% include "pretixpresale/fragment_event_list_filter.html" with request=request %}
|
{% include "pretixpresale/fragment_event_list_filter.html" with request=request %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% cache_large 15 subevent_list subevent_list_cache_key %}
|
{% cache_large 15 subevent_list subevent_list_cache_key %}
|
||||||
{% if subevent_list.list_type == "calendar" %}
|
{% if subevent_list.list_type == "calendar" %}
|
||||||
{% include "pretixpresale/event/fragment_subevent_calendar.html" %}
|
{% include "pretixpresale/event/fragment_subevent_calendar.html" %}
|
||||||
{% elif subevent_list.list_type == "week" %}
|
{% elif subevent_list.list_type == "week" %}
|
||||||
{% include "pretixpresale/event/fragment_subevent_calendar_week.html" %}
|
{% include "pretixpresale/event/fragment_subevent_calendar_week.html" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% include "pretixpresale/event/fragment_subevent_list.html" %}
|
{% include "pretixpresale/event/fragment_subevent_list.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endcache_large %}
|
{% endcache_large %}
|
||||||
</div>
|
|
||||||
{% if subevent_list_foldable %}
|
|
||||||
</div>
|
</div>
|
||||||
</details>
|
{% if subevent_list_foldable %}
|
||||||
{% else %}
|
</div>
|
||||||
</div>
|
</details>
|
||||||
{% endif %}
|
{% else %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if subevent %}
|
{% if subevent %}
|
||||||
<h2 class="subevent-head">{{ subevent.name }}</h2>
|
<h2 class="subevent-head">{{ subevent.name }}</h2>
|
||||||
|
|||||||
@@ -815,6 +815,7 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView):
|
|||||||
se for se in context['subevent_list']
|
se for se in context['subevent_list']
|
||||||
if not se.presale_has_ended and (se.best_availability_state is None or se.best_availability_state >= Quota.AVAILABILITY_RESERVED)
|
if not se.presale_has_ended and (se.best_availability_state is None or se.best_availability_state >= Quota.AVAILABILITY_RESERVED)
|
||||||
]
|
]
|
||||||
|
context['visible_events'] = len(context['subevent_list']) > 0
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user