diff --git a/doc/development/api/general.rst b/doc/development/api/general.rst index 31a2a260a0..b02c6b486e 100644 --- a/doc/development/api/general.rst +++ b/doc/development/api/general.rst @@ -25,7 +25,7 @@ Frontend -------- .. automodule:: pretix.presale.signals - :members: html_head, footer_links, front_page_top, front_page_bottom, checkout_confirm_messages + :members: html_head, html_footer, footer_links, front_page_top, front_page_bottom, checkout_confirm_messages .. automodule:: pretix.presale.signals diff --git a/src/pretix/presale/context.py b/src/pretix/presale/context.py index 2389add9f2..8e022e067a 100644 --- a/src/pretix/presale/context.py +++ b/src/pretix/presale/context.py @@ -4,7 +4,7 @@ from i18nfield.strings import LazyI18nString from pretix.base.settings import GlobalSettingsObject -from .signals import footer_link, html_head +from .signals import footer_link, html_footer, html_head def contextprocessor(request): @@ -19,6 +19,7 @@ def contextprocessor(request): 'DEBUG': settings.DEBUG, } _html_head = [] + _html_foot = [] _footer = [] if hasattr(request, 'event'): @@ -40,6 +41,8 @@ def contextprocessor(request): if hasattr(request, 'event'): for receiver, response in html_head.send(request.event, request=request): _html_head.append(response) + for receiver, response in html_footer.send(request.event, request=request): + _html_foot.append(response) for receiver, response in footer_link.send(request.event, request=request): if isinstance(response, list): _footer += response @@ -52,6 +55,7 @@ def contextprocessor(request): ctx['event'] = request.event ctx['html_head'] = "".join(_html_head) + ctx['html_foot'] = "".join(_html_foot) ctx['footer'] = _footer ctx['site_url'] = settings.SITE_URL diff --git a/src/pretix/presale/signals.py b/src/pretix/presale/signals.py index 1ecd495655..a6a8eb335c 100644 --- a/src/pretix/presale/signals.py +++ b/src/pretix/presale/signals.py @@ -11,6 +11,17 @@ of every page in the frontend. You will get the request as the keyword argument As with all plugin signals, the ``sender`` keyword argument will contain the event. """ +html_footer = EventPluginSignal( + providing_args=["request"] +) +""" +This signal allows you to put code before the end of the HTML ```` tag +of every page in the frontend. You will get the request as the keyword argument +``request`` and are expected to return plain HTML. + +As with all plugin signals, the ``sender`` keyword argument will contain the event. +""" + footer_link = EventPluginSignal( providing_args=["request"] ) diff --git a/src/pretix/presale/templates/pretixpresale/base.html b/src/pretix/presale/templates/pretixpresale/base.html index e83c3f6633..9e6d1c4100 100644 --- a/src/pretix/presale/templates/pretixpresale/base.html +++ b/src/pretix/presale/templates/pretixpresale/base.html @@ -68,5 +68,6 @@ {% else %} {% endif %} +{{ html_foot|safe }}