Off by one error.
[audio.git] / src / archive / templates / archive / book.html
1 {% extends "archive/base.html" %}
2 {% load i18n %}
3 {% load tags %}
4
5
6 {% block menu-active-audiobooks %}active{% endblock %}
7
8
9 {% block content %}
10   <div class="card mt-4">
11     <div class="card-header">
12       <h2>{{ object_list.0.book.title }}</h2>
13     </div>
14     <div class="card-body">
15       <table class="table">
16         <thead>
17           <tr>
18             <th>{% trans "Index" %}</th>
19             <th>{% trans "Title" %}</th>
20             <th>MP3</th>
21             <th>Ogg</th>
22             <th colspan="5">YouTube</th>
23           </tr>
24         </thead>
25         <tbody>
26           {% with volumes=object_list.0.youtube_volume_count %}
27             {% for audiobook in object_list %}
28               <tr>
29                 <td>{{ audiobook.index }}</td>
30                 <td>
31                   <a href="{% url 'file' audiobook.id %}">
32                     {% if audiobook.part_name %}
33                       {{ audiobook.part_name }}
34                     {% else %}
35                       <em class="text-warning" title="ddd">
36                         ({{ audiobook }})
37                       </em>
38                     {% endif %}
39                   </a>
40                 </td>
41                 <td>{% status audiobook "mp3" %}</td>
42                 <td>{% status audiobook "ogg" %}</td>
43                 {% ifchanged audiobook.youtube_volume_index %}
44                   <td>
45                     {{ audiobook.youtube_volume_index }}/{{ volumes }}
46                   </td>
47                   <td>
48                     <form method="POST" action="{% url 'book_youtube_volume' audiobook.id %}">
49                       {% csrf_token %}
50                       <input name='volume' value="{{ audiobook.youtube_volume }}" class="form-control">
51                     </form>
52                   </td>
53                   <td>
54                     {% if audiobook.youtube_volume %}
55                       {{ audiobook.total|duration }}
56                     {% else %}
57                       <small class="text-secondary">{{ audiobook.subtotal|duration }}</small>
58                     {% endif %}
59                   </td>
60                   <td>
61                     {{ audiobook.duration|duration }}
62                   </td>
63                   <td>
64                     {% status audiobook "youtube" %}
65                   </td>
66                 {% else  %}
67                   <td>
68                     –
69                   </td>
70                   <td>
71                     <span class="text-secondary">
72                       <form method="POST" action="{% url 'book_youtube_volume' audiobook.id %}">
73                         {% csrf_token %}
74                         <input name='volume' value="{{ audiobook.youtube_volume }}" class="form-control">
75                       </form>
76                     </span>
77                   </td>
78                   <td>
79                     <small class="text-secondary">{{ audiobook.subtotal|duration }}</small>
80                   </td>
81                   <td class="text-secondary">
82                     {{ audiobook.duration|duration }}
83                   </td>
84                   <td>
85                   </td>
86                 {% endifchanged %}
87               </tr>
88             {% endfor %}
89           {% endwith %}
90         </tbody>
91       </table>
92       <form method="post" action="{% url 'youtube_book_publish' view.kwargs.slug %}">
93         {% csrf_token %}
94         <button class="btn btn-primary">
95           Opublikuj wszystko na YouTube
96         </button>
97       </form>
98     </div>
99 {% endblock %}