1
0
Fork 0
mirror of https://github.com/Kunsi/pretalx-plugin-broadcast-tools synced 2024-11-21 21:31:02 +00:00

room info: add option to hide qr code or show the submission image

This commit is contained in:
Franziska Kunsmann 2023-03-01 11:29:56 +01:00
parent fa31e72db1
commit 12864749f9
4 changed files with 34 additions and 17 deletions

View file

@ -1,4 +1,4 @@
from django.forms import BooleanField, CharField, Textarea from django.forms import BooleanField, CharField, Textarea, ChoiceField
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from hierarkey.forms import HierarkeyForm from hierarkey.forms import HierarkeyForm
from i18nfield.forms import I18nFormField, I18nFormMixin, I18nTextInput from i18nfield.forms import I18nFormField, I18nFormMixin, I18nTextInput
@ -22,14 +22,26 @@ class BroadcastToolsSettingsForm(I18nFormMixin, HierarkeyForm):
required=False, required=False,
widget=I18nTextInput, widget=I18nTextInput,
) )
broadcast_tools_room_info_feedback_instead_of_public = BooleanField(
help_text=_( broadcast_tools_room_info_lower_content = ChoiceField(
"If checked, the qr code shown on the 'room info' page will " choices=(
"link to the feedback page instead of the talk detail page." ("", "No lower content"),
("public_qr", "QR code linking to the 'talk detail' page"),
(
"feedback_qr",
"QR code linking to the feedback page of the currently running talk",
), ),
label=_("Show feedback QR code instead of talk detail QR code"), ("talk_image", "session image uploaded by the speaker(s)"),
required=False, ),
help_text=_(
"If a talk is running, the room info page will always show "
"the talk title and the list of speakers. The content below "
"is configurable here."
),
label=_("lower content"),
required=True,
) )
broadcast_tools_pdf_show_internal_notes = BooleanField( broadcast_tools_pdf_show_internal_notes = BooleanField(
help_text=_( help_text=_(
"If checked, the value of the 'internal notes' field in a " "If checked, the value of the 'internal notes' field in a "

View file

@ -13,15 +13,14 @@ function update_room_info() {
} }
if (!room_name) { if (!room_name) {
$('#broadcast_tools_room_info_title').text(event_info['name']); $('#broadcast_tools_room_info_roomname').text(event_info['name']);
$('#broadcast_tools_room_info_speaker').text('Backstage'); $('#broadcast_tools_room_info_title').text('Backstage');
$('#broadcast_tools_room_info_speaker').text('');
$('#broadcast_tools_room_info_qr').text(''); $('#broadcast_tools_room_info_qr').text('');
$('#broadcast_tools_room_info').css('background-color', event_info['color']); $('#broadcast_tools_room_info').css('background-color', event_info['color']);
return return
} }
$('#broadcast_tools_room_info_roomname').text(room_name);
if (!schedule) { if (!schedule) {
$('#broadcast_tools_room_info_speaker').text('Waiting for schedule ...') $('#broadcast_tools_room_info_speaker').text('Waiting for schedule ...')
return return
@ -43,17 +42,23 @@ function update_room_info() {
current_talk = get_current_talk(15); current_talk = get_current_talk(15);
if (current_talk) { if (current_talk) {
if (event_info['room-info']['qr_type'] == 'feedback') { if (event_info['room-info']['lower_info'] == 'feedback_qr') {
qr_info = '<img src="' + current_talk['urls']['feedback_qr'] + '" alt="Feedback QR Code"><p>Leave Feedback by scanning the code or visiting ' + current_talk['urls']['feedback'] + '</p>'; qr_info = '<img src="' + current_talk['urls']['feedback_qr'] + '" alt="Feedback QR Code"><p>Leave Feedback by scanning the code or visiting ' + current_talk['urls']['feedback'] + '</p>';
} else { } else if (event_info['room-info']['lower_info'] == 'public_qr') {
qr_info = '<img src="' + current_talk['urls']['public_qr'] + '" alt="QR Code linking to URL below"><p>' + current_talk['urls']['public'] + '</p>'; qr_info = '<img src="' + current_talk['urls']['public_qr'] + '" alt="QR Code linking to URL below"><p>' + current_talk['urls']['public'] + '</p>';
} else if (event_info['room-info']['lower_info'] == 'talk_image' && current_talk['image_url']) {
qr_info = '<img src="' + current_talk['image_url'] + '" alt="Talk image">';
} else {
qr_info = '';
} }
$('#broadcast_tools_room_info_roomname').text(room_name);
$('#broadcast_tools_room_info_title').text(current_talk['title']); $('#broadcast_tools_room_info_title').text(current_talk['title']);
$('#broadcast_tools_room_info_speaker').text(current_talk['persons'].join(', ')); $('#broadcast_tools_room_info_speaker').text(current_talk['persons'].join(', '));
$('#broadcast_tools_room_info_qr').html(qr_info); $('#broadcast_tools_room_info_qr').html(qr_info);
} else { } else {
$('#broadcast_tools_room_info_title').text(event_info['name']); $('#broadcast_tools_room_info_roomname').text(event_info['name']);
$('#broadcast_tools_room_info_title').text(room_name);
$('#broadcast_tools_room_info_speaker').text(''); $('#broadcast_tools_room_info_speaker').text('');
$('#broadcast_tools_room_info_qr').text(''); $('#broadcast_tools_room_info_qr').text('');
} }

View file

@ -64,6 +64,7 @@
{% translate "Room info" %} {% translate "Room info" %}
</legend> </legend>
{% bootstrap_field form.broadcast_tools_room_info_feedback_instead_of_public layout='event' %} {% bootstrap_field form.broadcast_tools_room_info_feedback_instead_of_public layout='event' %}
{% bootstrap_field form.broadcast_tools_room_info_lower_content layout='event' %}
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend> <legend>

View file

@ -75,9 +75,7 @@ class BroadcastToolsEventInfoView(View):
self.request.event.settings.broadcast_tools_lower_thirds_no_talk_info self.request.event.settings.broadcast_tools_lower_thirds_no_talk_info
), ),
"room-info": { "room-info": {
"qr_type": "feedback" "lower_info": self.request.event.settings.broadcast_tools_room_info_lower_content or '',
if self.request.event.settings.broadcast_tools_room_info_feedback_instead_of_public
else "public",
}, },
"slug": self.request.event.slug, "slug": self.request.event.slug,
}, },
@ -149,6 +147,7 @@ class BroadcastToolsScheduleView(EventPermissionRequired, ScheduleMixin, View):
else None, else None,
"room": room["name"].localize(schedule.event.locale), "room": room["name"].localize(schedule.event.locale),
"infoline": infoline.format(**placeholders(schedule, talk)), "infoline": infoline.format(**placeholders(schedule, talk)),
"image_url": talk.submission.image_url,
"urls": { "urls": {
"feedback": "{}{}".format( "feedback": "{}{}".format(
schedule.event.custom_domain or settings.SITE_URL, schedule.event.custom_domain or settings.SITE_URL,