forked from CGM_Public/pretix_original
New signal: html_footer
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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 ``<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(
|
||||
providing_args=["request"]
|
||||
)
|
||||
|
||||
@@ -68,5 +68,6 @@
|
||||
{% else %}
|
||||
<script src="{% statici18n LANGUAGE_CODE %}" async></script>
|
||||
{% endif %}
|
||||
{{ html_foot|safe }}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user