]> git.0d.be Git - panikdb.git/blob - panikdb/templates/emissions/episode_detail.html
templates: update for unified soma scheduling
[panikdb.git] / panikdb / templates / emissions / episode_detail.html
1 {% extends "base.html" %}
2 {% load soundfiles panikdbtags nonstop %}
3 {% block appbar %}
4 <h2>{{ episode.emission.title }} — {{ episode.title }}</h2>
5 <span><a href="../">Retourner à l'émission</a></span>
6 {% endblock %}
7
8 {% block content %}
9
10 {% if can_manage %}
11 <p>
12 <a class="button" href="edit/">Modifier</a>
13 {% if perms.emissions.add_diffusion %}
14 <a class="button" href="add-diffusion" rel="popup">Ajouter une diffusion</a>
15 {% endif %}
16 <a class="button" href="add-soundfile" rel="popup">Ajouter un son</a>
17 {% if episode.effective_start and episode.effective_end %}
18   {% if internal_ip %}
19   <a class="button" id="download-recording" download href="{{ episode.get_pige_download_url }}">Télécharger l'enregistrement</a>
20   {% endif %}
21 {% elif not soundfiles and 0 %}
22   {% if episode.effective_start %}
23     <a class="button" id="stop-recording" href="stop">Arrêter l'enregistrement</a>
24   {% else %}
25     <a class="button" id="start-recording" href="start">Démarrer l'enregistrement</a>
26   {% endif %}
27 {% endif %}
28 <a class="button actually-not-that-friendly" href="delete/" rel="popup">Supprimer</a>
29 </p>
30 {% endif %}
31
32 {% if episode.subtitle %}
33 <div class="description">
34 {{ episode.subtitle|safe }}
35 </div>
36 {% endif %}
37
38 {% if episode.image %}
39 <div class="image">
40   <img src="{{ episode.image.url }}"/>
41 </div>
42 {% endif %}
43
44 <div class="bo-block">
45 {% if episode.text %}
46 <div class="text">
47 {{ episode.text|safe }}
48 </div>
49 {% endif %}
50
51 {% if episode.tags.all %}
52 <p>
53 Tags :
54 {% for tag in episode.tags.all %}
55   <span class="tag">{{ tag }}</span>{% if not forloop.last %}, {% endif %}
56 {% endfor %}
57 </p>
58 {% endif %}
59 </div>
60
61
62 <div class="bo-block">
63 <h3>Diffusions</h3>
64
65 {% now "Y-m-d H:i" as s_now %}
66
67 <ul>
68 {% for diffusion in diffusions %}
69 <li>{{ diffusion.datetime }}
70
71 {% if has_soma and diffusion|is_already_in_soma %}
72   {% if soundfiles|integral %}(diffusion programmée dans soma)
73   {% else %}
74     (stream programmé dans soma)
75     {% if can_manage and perms.nonstop.add_streameddiffusion and diffusion.end_datetime|date:"Y-m-d H:i" > s_now %}
76     <a href="{% url 'nonstop-del-diffusion' pk=diffusion.id %}">[supprimer stream dans soma]</a>
77     {% endif %}
78   {% endif %}
79   {# removal limited to staff as this will not remove from soma #}
80   {% if user.is_staff %}<a href="diffusion/{{ diffusion.id }}/remove" class="icon-remove-sign" title="Retirer"></a>{% endif %}
81 {% elif can_manage %}
82   {% if has_soma and diffusion.datetime|date:"Y-m-d H:i" > s_now %}
83     {% if soundfiles|integral and perms.nonstop.add_track %}
84     <a rel="popup" href="{% url 'nonstop-add-diffusion' pk=diffusion.id %}">[programmer dans soma]</a>
85     {% elif forloop.first and not soundfiles|integral and perms.nonstop.add_streameddiffusion %}
86     <a rel="popup" href="{% url 'nonstop-add-diffusion' pk=diffusion.id %}">[programmer stream dans soma]</a>
87     {% endif %}
88   {% endif %}
89   <a href="diffusion/{{ diffusion.id }}/remove" class="icon-remove-sign" title="Retirer"></a>
90 {% endif %}
91 </li>
92 {% endfor %}
93 </ul>
94 </div>
95
96 <div class="bo-block">
97 <h3>Sons</h3>
98
99 <table id="soundfiles">
100 <thead>
101 <tr>
102  <th>Fichier</th>
103  <th>Titre</th>
104  <th>Durée</th>
105  <th>Format</th>
106  <th>Podcastable?</th>
107  <th>Fragment?</th>
108  <th>Nb d'écoutes</th>
109  {% if can_manage %}<th>Modifier</th>{% endif %}
110  {% if can_manage %}<th>Supprimer</th>{% endif %}
111  {% if perms.emissions.add_focus %}<th>Focus</th>{% endif %}
112 </thead>
113 <tbody>
114 {% for soundfile in soundfiles %}
115 <tr>
116 <td><a href="{{ soundfile.file.url }}">{{ soundfile|sound_filename }}</a></td>
117 <td>{{ soundfile.title }}</td>
118 <td>{{ soundfile.duration|as_duration }}</td>
119 <td>{% if soundfile.format %}{{ soundfile.format }}{% else %}-{% endif %}</td>
120 <td>{% if soundfile.podcastable %}oui{% else %}non{% endif %}</td>
121 <td>{% if soundfile.fragment %}oui{% else %}non{% endif %}</td>
122 <td>{{ soundfile|nb_visits }}</td>
123 {% if can_manage %}<td><a href="sounds/{{ soundfile.id }}/"
124                 class="icon-edit" rel="popup" title="Modifier"></a></td>{% endif %}
125 {% if can_manage %}<td><a href="sounds/{{ soundfile.id }}/remove"
126                 class="icon-remove-sign" rel="popup" title="Retirer"></a></td>{% endif %}
127 {% if perms.emissions.add_focus %}
128 <td>
129 {% if soundfile|has_focus %}
130 ✓ <a class="icon-pushpin" href="{{ soundfile|unset_focus_url }}">retirer</a>
131 {% else %}
132   {% if soundfile.format %}
133   <a class="icon-pushpin" href="{{ soundfile|set_focus_url }}">mettre</a>
134   {% endif %}
135 {% endif %}
136 </td>
137 {% endif %}
138 {% endfor %}
139 </tbody>
140 </table>
141 </div>
142
143 {% endblock %}
144
145
146 {% block page-end %}
147 <script>
148 $(function() {
149   $('.image img').click(function() { $(this).toggleClass('large'); });
150
151   $('#id_fragment').change(function() {
152     if (this.checked) {
153       $('#id_title').parent().show();
154     } else {
155       $('#id_title').parent().hide();
156     }
157   });
158
159   $(document).on('gadjo:dialog-loaded', function(e, form) {
160     var $select = $('select#id_jingle');
161     var audio = null;
162     $select.css('width', '80%').css('margin-right', '1em').after('<button id="play-jingle">⏵</button>');
163     $('#play-jingle').on('click', function() {
164       var val = $select.val();
165       if (audio) { audio.pause(); }
166       audio = new Audio('/nonstop/api/jingle/' + val + '/');
167       audio.play();
168       return false;
169     });
170   });
171
172 });
173 </script>
174 {% endblock %}