diff --git a/src/pretix/base/templatetags/dialog.py b/src/pretix/base/templatetags/dialog.py new file mode 100644 index 0000000000..16805ceccf --- /dev/null +++ b/src/pretix/base/templatetags/dialog.py @@ -0,0 +1,60 @@ +# +# This file is part of pretix (Community Edition). +# +# Copyright (C) 2014-2020 Raphael Michel and contributors +# Copyright (C) 2020-2021 rami.io GmbH and contributors +# +# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General +# Public License as published by the Free Software Foundation in version 3 of the License. +# +# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are +# applicable granting you additional permissions and placing additional restrictions on your usage of this software. +# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive +# this file, see . +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more +# details. +# +# You should have received a copy of the GNU Affero General Public License along with this program. If not, see +# . +# +from django import template +from django.utils.html import format_html +from django.utils.safestring import mark_safe + +from django.utils.translation import gettext_lazy as _ # NOQA + +register = template.Library() + + +@register.simple_tag +def dialog(html_id, label, description, *args, **kwargs): + format_kwargs = { + "id": html_id, + "label": label, + "description": description, + "icon": format_html('', kwargs["icon"]) if "icon" in kwargs else "", + "alert": mark_safe('role="alertdialog"') if kwargs.get("alert", "False") != "False" else "", + } + result = """ + + + + """) diff --git a/src/pretix/presale/templates/pretixpresale/event/index.html b/src/pretix/presale/templates/pretixpresale/event/index.html index 021705bfaf..5eaf54cbc5 100644 --- a/src/pretix/presale/templates/pretixpresale/event/index.html +++ b/src/pretix/presale/templates/pretixpresale/event/index.html @@ -7,6 +7,8 @@ {% load thumb %} {% load eventsignal %} {% load rich_text %} +{% load icon %} +{% load dialog %} {% block title %} {% if "year" in request.GET %} @@ -240,6 +242,13 @@ {% endif %} + {% if ev.presale_is_running and display_add_to_cart %} + {% trans "You didn’t select any ticket." as label_nothing_to_add %} + {% trans "Please tick a checkbox or enter a quantity for one of the ticket types to add to the cart." as description_nothing_to_add %} + {% dialog "dialog-nothing-to-add" label_nothing_to_add description_nothing_to_add icon="exclamation-circle" %} + + {% enddialog %} + {% endif %} {% endif %} {% endif %} diff --git a/src/pretix/presale/templates/pretixpresale/fragment_modals.html b/src/pretix/presale/templates/pretixpresale/fragment_modals.html index 3565c60427..8855851709 100644 --- a/src/pretix/presale/templates/pretixpresale/fragment_modals.html +++ b/src/pretix/presale/templates/pretixpresale/fragment_modals.html @@ -2,6 +2,8 @@ {% load rich_text %} {% load safelink %} {% load escapejson %} +{% load icon %} +{% load dialog %}