Commit f4479341 authored by fred's avatar fred

add support for nonstop redirect path

parent 4af9d12b
......@@ -290,15 +290,15 @@ class Grid(TemplateView):
if nonstop.start < nonstop.end:
nonstops.append([nonstop.start.hour + nonstop.start.minute/60.,
nonstop.end.hour + nonstop.end.minute/60.,
nonstop.title, nonstop.slug])
nonstop.title, nonstop.slug, nonstop])
else:
# crossing midnight
nonstops.append([nonstop.start.hour + nonstop.start.minute/60.,
24,
nonstop.title, nonstop.slug])
nonstop.title, nonstop.slug, nonstop])
nonstops.append([0,
nonstop.end.hour + nonstop.end.minute/60.,
nonstop.title, nonstop.slug])
nonstop.title, nonstop.slug, nonstop])
nonstops.sort()
for i in range(nb_lines):
......@@ -310,6 +310,7 @@ class Grid(TemplateView):
for time_cell in grid[-1]:
time_cell.nonstop = nonstop[2]
time_cell.nonstop_slug = nonstop[3]
time_cell.redirect_path = nonstop[4].redirect_path
if nonstop[1] == 5:
# the one ending at 5am will be cut down, so we inscribe
# its duration manually
......@@ -642,9 +643,12 @@ def onair(request):
'chat': chat_url,
}
if d.get('nonstop'):
redirect_path = d['nonstop'].redirect_path
d['nonstop'] = {
'title': d['nonstop'].title,
}
if redirect_path:
d['nonstop']['url'] = redirect_path
d.update(get_current_nonstop_track())
if d.get('current_slot'):
del d['current_slot']
......
......@@ -190,7 +190,11 @@ $(function() {
$('<a>',{href:onair.data.episode.url,html:onair.data.episode.title}).appendTo(onairContainer).ajaxifyClick();
}
} else if (onair.data.nonstop) {
onairContainer = $('<span>' + onair.data.nonstop.title + '</span>');
if (onair.data.nonstop.url) {
onairContainer = $('<a href="' + onair.data.nonstop.url + '">' + onair.data.nonstop.title + '</a>');
} else {
onairContainer = $('<span>' + onair.data.nonstop.title + '</span>');
}
if (onair.data.track_title) {
$('<span> - </span>').appendTo(onairContainer);
$('<span class="nonstop-track-title">' + onair.data.track_title + '</span>').appendTo(onairContainer);
......
......@@ -60,7 +60,8 @@
</div>
{% endfor %}
{% else %}
<div class="continu"><strong><a href="{% url 'emission-view' slug=cell.nonstop_slug %}">{{ cell }}</a></strong></div>
<div class="continu"><strong><a
href="{% if cell.redirect_path %}{{ cell.redirect_path }}{% else %}{% url 'emission-view' slug=cell.nonstop_slug %}{% endif %}">{{ cell }}</a></strong></div>
{% if cell.w > 1 and cell.h > 1%}<p>la musique en continu</p>{% endif %}
{% endif %}
</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment