forked from CGM_Public/pretix_original
Add nav_topbar signal
This commit is contained in:
@@ -47,7 +47,7 @@ Backend
|
|||||||
-------
|
-------
|
||||||
|
|
||||||
.. automodule:: pretix.control.signals
|
.. automodule:: pretix.control.signals
|
||||||
:members: nav_event, html_head, quota_detail_html
|
:members: nav_event, html_head, quota_detail_html, nav_topbar
|
||||||
|
|
||||||
|
|
||||||
.. automodule:: pretix.base.signals
|
.. automodule:: pretix.base.signals
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.urlresolvers import Resolver404, get_script_prefix, resolve
|
from django.core.urlresolvers import Resolver404, get_script_prefix, resolve
|
||||||
|
|
||||||
from .signals import html_head, nav_event
|
from .signals import html_head, nav_event, nav_topbar
|
||||||
from .utils.i18n import get_javascript_format, get_moment_locale
|
from .utils.i18n import get_javascript_format, get_moment_locale
|
||||||
|
|
||||||
|
|
||||||
@@ -37,6 +37,11 @@ def contextprocessor(request):
|
|||||||
ctx['js_payment_weekdays_disabled'] = _js_payment_weekdays_disabled
|
ctx['js_payment_weekdays_disabled'] = _js_payment_weekdays_disabled
|
||||||
ctx['nav_event'] = _nav_event
|
ctx['nav_event'] = _nav_event
|
||||||
|
|
||||||
|
_nav_topbar = []
|
||||||
|
for receiver, response in nav_topbar.send(request, request=request):
|
||||||
|
_nav_topbar += response
|
||||||
|
ctx['nav_topbar'] = _nav_topbar
|
||||||
|
|
||||||
ctx['js_datetime_format'] = get_javascript_format('DATETIME_INPUT_FORMATS')
|
ctx['js_datetime_format'] = get_javascript_format('DATETIME_INPUT_FORMATS')
|
||||||
ctx['js_date_format'] = get_javascript_format('DATE_INPUT_FORMATS')
|
ctx['js_date_format'] = get_javascript_format('DATE_INPUT_FORMATS')
|
||||||
ctx['js_locale'] = get_moment_locale()
|
ctx['js_locale'] = get_moment_locale()
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ nav_event = EventPluginSignal(
|
|||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
This signal allows you to add additional views to the admin panel
|
This signal allows you to add additional views to the admin panel
|
||||||
navigation. You will get the request as a keyword argument ``return``.
|
navigation. You will get the request as a keyword argument ``request``.
|
||||||
Receivers are expected to return a list of dictionaries. The dictionaries
|
Receivers are expected to return a list of dictionaries. The dictionaries
|
||||||
should contain at least the keys ``label`` and ``url``. You can also return
|
should contain at least the keys ``label`` and ``url``. You can also return
|
||||||
a fontawesome icon name with the key ``icon``, it will be respected depending
|
a fontawesome icon name with the key ``icon``, it will be respected depending
|
||||||
@@ -42,6 +42,24 @@ in pretix.
|
|||||||
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.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
nav_topbar = Signal(
|
||||||
|
providing_args=["request"]
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
This signal allows you to add additional views to the top navigation bar.
|
||||||
|
You will get the request as a keyword argument ``return``.
|
||||||
|
Receivers are expected to return a list of dictionaries. The dictionaries
|
||||||
|
should contain at least the keys ``label`` and ``url``. You can also return
|
||||||
|
a fontawesome icon name with the key ``icon``, it will be respected depending
|
||||||
|
on the type of navigation. If set, on desktops only the ``icon`` will be shown.
|
||||||
|
|
||||||
|
If you use this, you should read the documentation on :ref:`how to deal with URLs <urlconf>`
|
||||||
|
in pretix.
|
||||||
|
|
||||||
|
This is no ``EventPluginSignal``, so you do not get the event in the ``sender`` argument
|
||||||
|
and you may get the signal regardless of whether your plugin is active.
|
||||||
|
"""
|
||||||
|
|
||||||
event_dashboard_widgets = EventPluginSignal(
|
event_dashboard_widgets = EventPluginSignal(
|
||||||
providing_args=[]
|
providing_args=[]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -74,6 +74,35 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-top-links navbar-right">
|
<ul class="nav navbar-nav navbar-top-links navbar-right">
|
||||||
|
{% for nav in nav_topbar %}
|
||||||
|
<li {% if nav.children %}class="dropdown"{% endif %}>
|
||||||
|
<a href="{{ nav.url }}" {% if nav.active %}class="active"{% endif %}
|
||||||
|
{% if nav.children %}class="dropdown-toggle" data-toggle="dropdown"{% endif %}>
|
||||||
|
{% if nav.icon %}
|
||||||
|
<span class="fa fa-{{ nav.icon }}"></span>
|
||||||
|
<span class="visible-xs-inline">{{ nav.label }}</span>
|
||||||
|
{% else %}
|
||||||
|
{{ nav.label }}
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
{% if nav.children %}
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
{% for item in nav.children %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ item.url }}"
|
||||||
|
{% if item.active %}class="active"{% endif %}>
|
||||||
|
{% if item.icon %}
|
||||||
|
<span class="fa fa-{{ item.icon }}"></span>
|
||||||
|
{% endif %}
|
||||||
|
{{ item.label|safe }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url 'control:user.settings' %}">
|
<a href="{% url 'control:user.settings' %}">
|
||||||
<i class="fa fa-user"></i> {{ request.user.get_full_name }}
|
<i class="fa fa-user"></i> {{ request.user.get_full_name }}
|
||||||
|
|||||||
Reference in New Issue
Block a user