1
0
Fork 0
mirror of https://github.com/Kunsi/pretalx-plugin-broadcast-tools synced 2024-11-14 17:35:48 +00:00

move room detection to room uuid

This commit is contained in:
Franzi 2024-10-31 21:46:55 +01:00
parent 6a3b1b309e
commit dfa0945632
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 24 additions and 28 deletions

View file

@ -61,14 +61,16 @@ function get_next_talk() {
}
function get_room_name() {
room_name = null;
try {
hash = decodeURIComponent(window.location.hash.substring(1));
room_name = hash;
} catch (e) {
console.error(e);
}
return room_name;
if (event_info && event_info["rooms"].hasOwnProperty(hash)) {
return event_info["rooms"][hash];
}
// XXX remove fallback when releasing 3.0.0
return hash;
}
function format_time_from_pretalx(from_pretalx) {

View file

@ -7,25 +7,23 @@
<h2>{% translate "broadcasting tools" %}</h2>
{% if localized_rooms %}
<table class="table table-hover">
<thead class="thead-light">
<table class="table table-hover">
<thead class="thead-light">
<tr>
<th scope="col">{% translate "room" %}</th>
<th scope="col" colspan="2">{% translate "Feature" %}</th>
</tr>
</thead>
<tbody>
{% for room in request.event.rooms.all %}
<tr>
<th scope="col">{% translate "room" %}</th>
<th scope="col" colspan="2">{% translate "Feature" %}</th>
<th scope="row">{{ room.name }}</th>
<td><a href="{% url 'plugins:pretalx_broadcast_tools:lowerthirds' request.event.slug %}#{{ room.uuid }}">{% translate "Lower Thirds" %}</a></td>
<td><a href="{% url 'plugins:pretalx_broadcast_tools:room_info' request.event.slug %}#{{ room.uuid }}">{% translate "Room Info" %}</a></td>
</tr>
</thead>
<tbody>
{% for room in localized_rooms %}
<tr>
<th scope="row">{{ room }}</th>
<td><a href="{% url 'plugins:pretalx_broadcast_tools:lowerthirds' request.event.slug %}#{{ room }}">{% translate "Lower Thirds" %}</a></td>
<td><a href="{% url 'plugins:pretalx_broadcast_tools:room_info' request.event.slug %}#{{ room }}">{% translate "Room Info" %}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endfor %}
</tbody>
</table>
<h2>{% translate "Placeholders" %}</h2>
<p>{% translate "pretalx will automatically replace some placeholders in your custom content:" %}</p>

View file

@ -21,6 +21,10 @@ class BroadcastToolsEventInfoView(View):
else False
),
},
"rooms": {
str(room.uuid): room.name.localize(self.request.event.locale)
for room in self.request.event.rooms.all()
},
"slug": self.request.event.slug,
"start": self.request.event.date_from.isoformat(),
"end": self.request.event.date_to.isoformat(),

View file

@ -12,14 +12,6 @@ class BroadcastToolsOrgaView(PermissionRequired, FormView):
def get_success_url(self):
return self.request.path
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["localized_rooms"] = [
room.name.localize(self.request.event.locale)
for room in self.request.event.rooms.all()
]
return context
def form_valid(self, form):
form.save()
return super().form_valid(form)