forked from CGM_Public/pretix_original
New signal: html_footer
This commit is contained in:
@@ -25,7 +25,7 @@ Frontend
|
|||||||
--------
|
--------
|
||||||
|
|
||||||
.. automodule:: pretix.presale.signals
|
.. 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
|
.. automodule:: pretix.presale.signals
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from i18nfield.strings import LazyI18nString
|
|||||||
|
|
||||||
from pretix.base.settings import GlobalSettingsObject
|
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):
|
def contextprocessor(request):
|
||||||
@@ -19,6 +19,7 @@ def contextprocessor(request):
|
|||||||
'DEBUG': settings.DEBUG,
|
'DEBUG': settings.DEBUG,
|
||||||
}
|
}
|
||||||
_html_head = []
|
_html_head = []
|
||||||
|
_html_foot = []
|
||||||
_footer = []
|
_footer = []
|
||||||
|
|
||||||
if hasattr(request, 'event'):
|
if hasattr(request, 'event'):
|
||||||
@@ -40,6 +41,8 @@ def contextprocessor(request):
|
|||||||
if hasattr(request, 'event'):
|
if hasattr(request, 'event'):
|
||||||
for receiver, response in html_head.send(request.event, request=request):
|
for receiver, response in html_head.send(request.event, request=request):
|
||||||
_html_head.append(response)
|
_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):
|
for receiver, response in footer_link.send(request.event, request=request):
|
||||||
if isinstance(response, list):
|
if isinstance(response, list):
|
||||||
_footer += response
|
_footer += response
|
||||||
@@ -52,6 +55,7 @@ def contextprocessor(request):
|
|||||||
ctx['event'] = request.event
|
ctx['event'] = request.event
|
||||||
|
|
||||||
ctx['html_head'] = "".join(_html_head)
|
ctx['html_head'] = "".join(_html_head)
|
||||||
|
ctx['html_foot'] = "".join(_html_foot)
|
||||||
ctx['footer'] = _footer
|
ctx['footer'] = _footer
|
||||||
ctx['site_url'] = settings.SITE_URL
|
ctx['site_url'] = settings.SITE_URL
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
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 ``<body>`` 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(
|
footer_link = EventPluginSignal(
|
||||||
providing_args=["request"]
|
providing_args=["request"]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -68,5 +68,6 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<script src="{% statici18n LANGUAGE_CODE %}" async></script>
|
<script src="{% statici18n LANGUAGE_CODE %}" async></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{{ html_foot|safe }}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user