1
0
Fork 0
mirror of https://github.com/Kunsi/pretalx-plugin-broadcast-tools synced 2024-11-01 05:15:50 +00:00
pretalx-plugin-broadcast-tools/pretalx_broadcast_tools/signals.py

38 lines
1.2 KiB
Python
Raw Normal View History

from django.dispatch import receiver
from django.urls import resolve, reverse
2021-11-21 12:30:31 +00:00
from django.utils.translation import gettext_noop
from django.utils.translation import ugettext_lazy as _
2021-11-21 12:07:19 +00:00
from i18nfield.strings import LazyI18nString
from pretalx.common.models.settings import hierarkey
from pretalx.orga.signals import nav_event_settings
2021-11-21 12:07:19 +00:00
hierarkey.add_default(
"lower_thirds_no_talk_info",
LazyI18nString.from_gettext(
gettext_noop("Sorry, there's currently no talk running")
),
LazyI18nString,
)
hierarkey.add_default("lower_thirds_info_string", "", LazyI18nString)
2021-12-25 08:29:29 +00:00
hierarkey.add_default("lower_thirds_theme", "default")
2021-11-21 12:07:19 +00:00
@receiver(nav_event_settings)
def navbar_info(sender, request, **kwargs):
url = resolve(request.path_info)
2021-11-21 07:06:35 +00:00
if not request.user.has_perm("orga.change_settings", request.event):
return []
2021-11-21 07:06:35 +00:00
return [
{
2021-11-22 19:53:07 +00:00
"label": _("broadcast tools"),
2021-11-21 07:06:35 +00:00
"url": reverse(
"plugins:pretalx_broadcast_tools:orga",
2021-11-21 07:06:35 +00:00
kwargs={
"event": request.event.slug,
},
),
"active": url.namespace == "plugins:pretalx_broadcast_tools"
2021-11-21 07:06:35 +00:00
and url.url_name == "orga",
}
]