forked from CGM_Public/pretix_original
Add plugin API for adding items to the admin navigation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import resolve
|
||||
from .signals import html_head
|
||||
from .signals import html_head, nav_event
|
||||
|
||||
|
||||
def contextprocessor(request):
|
||||
@@ -20,4 +20,9 @@ def contextprocessor(request):
|
||||
_html_head.append(response)
|
||||
ctx['html_head'] = "".join(_html_head)
|
||||
|
||||
_nav_event = []
|
||||
if hasattr(request, 'event'):
|
||||
for receiver, response in nav_event.send(request.event, request=request):
|
||||
_nav_event += response
|
||||
ctx['nav_event'] = _nav_event
|
||||
return ctx
|
||||
|
||||
@@ -15,3 +15,10 @@ This signal is sent out to include code into the HTML <head> tag
|
||||
html_head = EventPluginSignal(
|
||||
providing_args=["request"]
|
||||
)
|
||||
|
||||
"""
|
||||
This signal is sent out to include navigation items in the event admin
|
||||
"""
|
||||
nav_event = EventPluginSignal(
|
||||
providing_args=["request"]
|
||||
)
|
||||
|
||||
@@ -81,4 +81,14 @@
|
||||
{% trans "Orders" %}
|
||||
</a>
|
||||
</li>
|
||||
{% for nav in nav_event %}
|
||||
<li>
|
||||
<a href="{{ nav.url }}" {% if nav.active %}class="active"{% endif %}>
|
||||
{% if nav.icon %}
|
||||
<i class="fa fa-{{ nav.icon }} fa-fw"></i>
|
||||
{% endif %}
|
||||
{{ nav.label }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user