Skip to content

Commit

Permalink
move room detection to room uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunsi committed Oct 31, 2024
1 parent 6a3b1b3 commit dfa0945
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
32 changes: 15 additions & 17 deletions pretalx_broadcast_tools/templates/pretalx_broadcast_tools/orga.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 4 additions & 0 deletions pretalx_broadcast_tools/views/event_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def get(self, request, *args, **kwargs):
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(),
Expand Down
8 changes: 0 additions & 8 deletions pretalx_broadcast_tools/views/orga.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dfa0945

Please sign in to comment.