forked from rc/aircox
rewrite tests + fix error in schedule generator
This commit is contained in:
@ -25,6 +25,9 @@
|
||||
{% block css_extras %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
<script src="{% static 'cms/js/utils.js' %}"></script>
|
||||
<script src="{% static 'cms/js/player.js' %}"></script>
|
||||
|
||||
<title>{{ page.title }}</title>
|
||||
</head>
|
||||
<body>
|
||||
|
61
cms/templates/cms/sections/section_player.html
Normal file
61
cms/templates/cms/sections/section_player.html
Normal file
@ -0,0 +1,61 @@
|
||||
{% extends 'cms/sections/section_item.html' %}
|
||||
|
||||
{% load staticfiles %}
|
||||
{% load i18n %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<style>
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
<div id="player">
|
||||
<div class="box">
|
||||
<audio preload="metadata">
|
||||
{% trans "Your browser does not support the <code>audio</code> element." %}
|
||||
{% for stream in streams %}
|
||||
<source src="{{ stream }}" />
|
||||
{% endfor %}
|
||||
</audio>
|
||||
|
||||
<button class="play" onclick="Player.play()"
|
||||
title="{% trans "play/pause" %}"></button>
|
||||
|
||||
<h3 class="title">{{ self.live_title }}</h3>
|
||||
|
||||
<div>
|
||||
<div class="info duration"></div>
|
||||
<progress value="0" max="1"></progress>
|
||||
|
||||
<input type="checkbox" class="single" id="player_single_mode">
|
||||
<label for="player_single_mode"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="playlist">
|
||||
<li class='item' style="display: none;">
|
||||
<h2 class="title">{{ self.live_title }}</h2>
|
||||
<div class="info duration"></div>
|
||||
<div class="actions">
|
||||
<a class="action detail" title="{% trans "more informations" %}">➔</a>
|
||||
<a class="action remove" title="{% trans "remove this sound" %}">✖</a>
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
<div class='item on_air'>
|
||||
<h2 class="title"></h2>
|
||||
<a class="url">➔</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var player = new Player('player');
|
||||
player.playlist.add(new Sound('{{ self.live_title }}', '', [
|
||||
{% for stream in streams %}'{{ stream }}',{% endfor %}
|
||||
]));
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@ -1,27 +1,5 @@
|
||||
{% load i18n %}
|
||||
|
||||
<script>
|
||||
/// Function used to select a panel on a tab selection.
|
||||
/// The tab should be at max level -2 of the main container
|
||||
/// The panel must have a class "panel"
|
||||
function select_tab(target) {
|
||||
parent = target.parentNode.parentNode;
|
||||
|
||||
var date = target.dataset.date;
|
||||
panel = parent.querySelector('.panel[data-date="' + date + '"]');
|
||||
|
||||
// unselect
|
||||
qs = parent.querySelectorAll('*[selected]');
|
||||
for(var i = 0; i < qs.length; i++)
|
||||
if(qs[i].dataset.date != date)
|
||||
qs[i].removeAttribute('selected');
|
||||
|
||||
console.log(panel, target, date);
|
||||
panel.setAttribute('selected', 'true');
|
||||
target.setAttribute('selected', 'true');
|
||||
}
|
||||
</script>
|
||||
|
||||
{# FIXME: get current complete URL #}
|
||||
<div class="list date_list">
|
||||
{% if nav_dates %}
|
||||
@ -31,7 +9,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% for day in nav_dates.dates %}
|
||||
<a onclick="select_tab(this);" data-date="day_{{day|date:"Y-m-d"}}"
|
||||
<a onclick="select_tab(this, '.panel[data-date=\'{{day|date:"Y-m-d"}}\']');"
|
||||
{% if day == nav_dates.date %}selected{% endif %}
|
||||
class="tab {% if day == nav_dates.date %}today{% endif %}">
|
||||
{{ day|date:'D. d' }}
|
||||
@ -47,7 +25,7 @@
|
||||
{% for day, list in object_list %}
|
||||
<ul class="panel {% if day == nav_dates.date %}class="today"{% endif %}"
|
||||
{% if day == nav_dates.date %}selected{% endif %}
|
||||
data-date="day_{{day|date:"Y-m-d"}}">
|
||||
data-date="{{day|date:"Y-m-d"}}">
|
||||
{# you might like to hide it by default -- this more for sections #}
|
||||
<h2>{{ day|date:'l d F' }}</h2>
|
||||
{% with object_list=list item_date_format="H:i" %}
|
||||
|
Reference in New Issue
Block a user