misc: fix display of "no timeslot" for static data sources (#73969)

This commit is contained in:
Frédéric Péters 2023-01-30 10:24:08 +01:00 committed by Gitea
parent a10c3d2335
commit 7ee68eefbe
1 changed files with 3 additions and 1 deletions

View File

@ -63,10 +63,12 @@
var current_offset = null;
var alignment_offset = null;
var nb_days = 0;
var has_timeslots = false;
for (var i=0; i<options.length; i++) {
var $option = $(options[i]);
if ($option.attr('value') == '') continue;
has_timeslots = true;
var option_date = $option.data('date');
if (option_date !== current_date) {
var day_label = $option.text().split(' ', 3).join(' ');
@ -103,7 +105,7 @@
} else if (current_offset === null) {
current_offset = 0;
}
if (data.items.length == 0) {
if (! has_timeslots) {
$('<p class="timetable-widget--nothing">{% trans "No available timeslots." %}</p>').appendTo($table);
}
var go_prev = $('<button class="prev" title="{% trans "Previous week" %}"></button>');