mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Add signals global_html_head, global_html_page_header, and global_html_footer
This commit is contained in:
@@ -33,7 +33,7 @@ Frontend
|
|||||||
--------
|
--------
|
||||||
|
|
||||||
.. automodule:: pretix.presale.signals
|
.. automodule:: pretix.presale.signals
|
||||||
:members: html_head, html_footer, footer_link, front_page_top, front_page_bottom, front_page_bottom_widget, fee_calculation_for_cart, contact_form_fields, question_form_fields, checkout_confirm_messages, checkout_confirm_page_content, checkout_all_optional, html_page_header, sass_preamble, sass_postamble, render_seating_plan, checkout_flow_steps, position_info, position_info_top, item_description
|
:members: html_head, html_footer, footer_link, front_page_top, front_page_bottom, front_page_bottom_widget, fee_calculation_for_cart, contact_form_fields, question_form_fields, checkout_confirm_messages, checkout_confirm_page_content, checkout_all_optional, html_page_header, sass_preamble, sass_postamble, render_seating_plan, checkout_flow_steps, position_info, position_info_top, item_description, global_html_head, globla_html_footer, global_html_page_header
|
||||||
|
|
||||||
|
|
||||||
.. automodule:: pretix.presale.signals
|
.. automodule:: pretix.presale.signals
|
||||||
|
|||||||
@@ -12,7 +12,10 @@ from pretix.helpers.i18n import (
|
|||||||
get_javascript_format_without_seconds, get_moment_locale,
|
get_javascript_format_without_seconds, get_moment_locale,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .signals import footer_link, html_footer, html_head, html_page_header
|
from .signals import (
|
||||||
|
footer_link, global_html_footer, global_html_head, global_html_page_header,
|
||||||
|
html_footer, html_head, html_page_header,
|
||||||
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -56,12 +59,18 @@ def _default_context(request):
|
|||||||
ctx['footer_text'] = str(text)
|
ctx['footer_text'] = str(text)
|
||||||
|
|
||||||
if hasattr(request, 'event') and get_scope():
|
if hasattr(request, 'event') and get_scope():
|
||||||
|
for receiver, response in global_html_head.send(None, request=request):
|
||||||
|
_html_head.append(response)
|
||||||
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 global_html_page_header.send(None, request=request):
|
||||||
|
_html_page_header.append(response)
|
||||||
for receiver, response in html_page_header.send(request.event, request=request):
|
for receiver, response in html_page_header.send(request.event, request=request):
|
||||||
_html_page_header.append(response)
|
_html_page_header.append(response)
|
||||||
for receiver, response in html_footer.send(request.event, request=request):
|
for receiver, response in html_footer.send(request.event, request=request):
|
||||||
_html_foot.append(response)
|
_html_foot.append(response)
|
||||||
|
for receiver, response in global_html_footer.send(None, 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
|
||||||
|
|||||||
@@ -1,5 +1,40 @@
|
|||||||
|
from django.dispatch import Signal
|
||||||
|
|
||||||
from pretix.base.signals import EventPluginSignal
|
from pretix.base.signals import EventPluginSignal
|
||||||
|
|
||||||
|
global_html_head = Signal(
|
||||||
|
providing_args=["request"]
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
This signal allows you to put code inside the HTML ``<head>`` tag
|
||||||
|
of every page in the frontend. You will get the request as the keyword argument
|
||||||
|
``request`` and are expected to return plain HTML.
|
||||||
|
|
||||||
|
This signal is called regardless of whether your plugin is active for all pages of the system.
|
||||||
|
"""
|
||||||
|
|
||||||
|
global_html_page_header = Signal(
|
||||||
|
providing_args=["request"]
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
This signal allows you to put code right in the beginning 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.
|
||||||
|
|
||||||
|
This signal is called regardless of whether your plugin is active for all pages of the system.
|
||||||
|
"""
|
||||||
|
|
||||||
|
global_html_footer = Signal(
|
||||||
|
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.
|
||||||
|
|
||||||
|
This signal is called regardless of whether your plugin is active for all pages of the system.
|
||||||
|
"""
|
||||||
|
|
||||||
html_head = EventPluginSignal(
|
html_head = EventPluginSignal(
|
||||||
providing_args=["request"]
|
providing_args=["request"]
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user