Added hook for links in the footer

This commit is contained in:
Raphael Michel
2016-06-14 13:05:47 +02:00
parent 1bdf332afd
commit 0c4368170f
4 changed files with 21 additions and 1 deletions

View File

@@ -35,6 +35,11 @@ in pretix.
``pretix.control.signals.nav_event`` ``pretix.control.signals.nav_event``
The sidebar navigation when the admin has selected an event. The sidebar navigation when the admin has selected an event.
Footer links
------------
The signal ``pretix.presale.signals.footer_links`` allows you to add links to the footer of an event page. You
are expected to return a dictionary containing the keys ``label`` and ``url``.
Order events Order events
------------ ------------

View File

@@ -1,7 +1,7 @@
from django.conf import settings from django.conf import settings
from django.core.urlresolvers import Resolver404, resolve from django.core.urlresolvers import Resolver404, resolve
from .signals import html_head from .signals import footer_link, html_head
def contextprocessor(request): def contextprocessor(request):
@@ -18,10 +18,14 @@ def contextprocessor(request):
ctx = { ctx = {
} }
_html_head = [] _html_head = []
_footer = []
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 footer_link.send(request.event, request=request):
_footer.append(response)
ctx['html_head'] = "".join(_html_head) ctx['html_head'] = "".join(_html_head)
ctx['footer'] = _footer
ctx['site_url'] = settings.SITE_URL ctx['site_url'] = settings.SITE_URL
return ctx return ctx

View File

@@ -7,6 +7,13 @@ html_head = EventPluginSignal(
providing_args=["request"] providing_args=["request"]
) )
"""
This signal is sent out to include links in the footer
"""
footer_link = EventPluginSignal(
providing_args=["request"]
)
""" """
This signal is sent out to retrieve pages for the checkout flow This signal is sent out to retrieve pages for the checkout flow
""" """

View File

@@ -58,4 +58,8 @@
<a href="{{ request.event.settings.imprint_url }}" target="_blank">{% trans "Imprint" %}</a> <a href="{{ request.event.settings.imprint_url }}" target="_blank">{% trans "Imprint" %}</a>
&middot; &middot;
{% endif %} {% endif %}
{% for f in footer %}
<a href="{{ f.url }}" target="_blank">{{ f.label }}</a>
&middot;
{% endfor %}
{% endblock %} {% endblock %}