mirror of
https://github.com/Kunsi/pretalx-plugin-broadcast-tools
synced 2024-11-21 19:11:02 +00:00
move event info to dedicated json file, also load event color from json
This commit is contained in:
parent
f1e61ad655
commit
4973446da8
5 changed files with 31 additions and 13 deletions
|
@ -17,6 +17,7 @@
|
|||
padding: 15px;
|
||||
|
||||
box-shadow: 5px 5px 10px 0px rgba(50, 50, 50, 0.75);
|
||||
background-color: #3aa57c;
|
||||
}
|
||||
|
||||
#title {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
schedule = null;
|
||||
room_name = null;
|
||||
event_info = null;
|
||||
|
||||
$(function() {
|
||||
$('#speaker').text('Content will appear soon.');
|
||||
|
@ -16,8 +17,8 @@ function update_lower_third() {
|
|||
return
|
||||
}
|
||||
|
||||
if (!schedule) {
|
||||
console.warn("There's no schedule yet, exiting ...");
|
||||
if (!schedule || !event_info) {
|
||||
console.warn("There's no schedule or no event info yet, exiting ...");
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -51,7 +52,7 @@ function update_lower_third() {
|
|||
$('#speaker').text(current_talk['persons'].join(', '));
|
||||
$('#info_line').text(current_talk['infoline']);
|
||||
} else {
|
||||
$('#title').text(schedule['conference']['no_talk']);
|
||||
$('#title').text(event_info['no_talk']);
|
||||
$('#speaker').text('');
|
||||
$('#info_line').text('');
|
||||
}
|
||||
|
@ -65,6 +66,11 @@ function update_lower_third() {
|
|||
window.setInterval(update_lower_third, 1000);
|
||||
|
||||
function update_schedule() {
|
||||
$.getJSON('event.json', function(data) {
|
||||
event_info = data;
|
||||
|
||||
$('#box').css('background-color', data['color']);
|
||||
});
|
||||
$.getJSON('schedule.json', function(data) {
|
||||
console.info('schedule updated with ' + data['talks'].length + ' talks in ' + data['rooms'].length + ' rooms');
|
||||
|
||||
|
|
|
@ -10,11 +10,6 @@
|
|||
{% endcompress %}
|
||||
<script src="{% static "pretalx_lower_thirds/update.js" %}"></script>
|
||||
<link rel="stylesheet" href="{% static "pretalx_lower_thirds/frontend.css" %}" />
|
||||
<style type="text/css">
|
||||
#box {
|
||||
background-color: {{ request.event.primary_color|default:"#3aa57c" }};
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="box">
|
||||
|
|
|
@ -9,6 +9,11 @@ urlpatterns = [
|
|||
views.LowerThirdsView.as_view(),
|
||||
name="lowerthirds",
|
||||
),
|
||||
re_path(
|
||||
f"^(?P<event>[{SLUG_CHARS}]+)/p/lower-thirds/event.json$",
|
||||
views.EventInfoView.as_view(),
|
||||
name="event_info",
|
||||
),
|
||||
re_path(
|
||||
f"^(?P<event>[{SLUG_CHARS}]+)/p/lower-thirds/schedule.json$",
|
||||
views.ScheduleView.as_view(),
|
||||
|
|
|
@ -40,6 +40,22 @@ class LowerThirdsOrgaView(PermissionRequired, FormView):
|
|||
}
|
||||
|
||||
|
||||
class EventInfoView(TemplateView):
|
||||
def get(self, request, *args, **kwargs):
|
||||
color = (self.request.event.primary_color or "#3aa57c")
|
||||
return JsonResponse(
|
||||
{
|
||||
"slug": self.request.event.slug,
|
||||
"name": str(self.request.event.name),
|
||||
"no_talk": str(self.request.event.settings.lower_thirds_no_talk_info),
|
||||
"color": color,
|
||||
},
|
||||
json_dumps_params={
|
||||
"indent": 4,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
class ScheduleView(EventPermissionRequired, ScheduleMixin, TemplateView):
|
||||
permission_required = "agenda.view_schedule"
|
||||
|
||||
|
@ -52,11 +68,6 @@ class ScheduleView(EventPermissionRequired, ScheduleMixin, TemplateView):
|
|||
infoline = str(schedule.event.settings.infoline or "")
|
||||
return JsonResponse(
|
||||
{
|
||||
"conference": {
|
||||
"slug": schedule.event.slug,
|
||||
"name": str(schedule.event.name),
|
||||
"no_talk": str(schedule.event.settings.lower_thirds_no_talk_info),
|
||||
},
|
||||
"rooms": sorted(
|
||||
{
|
||||
str(room["name"])
|
||||
|
|
Loading…
Reference in a new issue