fix chaining querysets for pagination
[wolnelektury.git] / wolnelektury / templates / catalogue / book_detail.html
1 {% extends "base.html" %}
2 {% load i18n %}
3 {% load catalogue_tags pagination_tags %}
4
5 {% block titleextra %}{{ book.title }}{% endblock %}
6
7 {% block metadescription %}{% book_title book %}. {{ block.super }}{% endblock %}
8
9 {% block bodyid %}book-detail{% endblock %}
10
11 {% block body %}
12     <h1>{% book_title book %}</h1>
13
14     <div id="books-list">
15         <div id='breadcrumbs'>
16             {% if categories.author %}
17                 {% for tag in categories.author %}
18                     <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
19                 {% endfor %}
20                 &#187; 
21             {% endif %}
22             {% for parent in parents %}
23                 <a href="{{ parent.get_absolute_url }}">{{ parent }}</a> &#187; 
24             {% endfor %}
25         </div>
26
27         {% if extra_info.license %}
28         <p>{% trans "Work is licensed under " %} <a href="{{ extra_info.license }}">{{ extra_info.license_description }}</a>.</p>
29         {% endif %}
30         <p>{% trans "Based on" %}: {{ extra_info.source_name }}</p>
31         {% if book.has_description %}
32             <div id="description">
33                 <div id='description-long'>{{ book.description|safe }}</div>
34                 <div id='description-short'>{{ book.description|safe|truncatewords_html:30 }}</div>
35             </div>
36             <div id="toggle-description"><p></p></div>
37         {% endif %}
38         <div id="formats">
39             <p class="change-sets">{% trans "Put a book" %} <span><a href="{% url catalogue.views.book_sets book.urlid %}" class="jqm-trigger">{% trans "on the shelf!" %}</a></span></p>
40             <div class="clearboth"></div>
41             <div class="wrap">
42                 {% if book.has_html_file %}
43                     <a class="online" href="{% url book_text book.fileid %}">{% trans "Read online" %}</a>
44                 {% endif %}
45                 <div class="download">
46                     {% if book.pdf_file %}
47                         <a href="{{ book.pdf_file.url }}"><img src="{{ STATIC_URL }}img/pdf.png" title="{% trans "Download PDF" %} &ndash; {% trans "for reading" %} {% trans "and printing using" %} Adobe Reader" %}" alt="{% trans "Download PDF" %}" /></a>
48                     {% endif %}
49                     {% if book.epub_file %}
50                         <a href="{{ book.epub_file.url }}"><img src="{{ STATIC_URL }}img/epub.png" title="{% trans "Download EPUB" %} &ndash; {% trans "for reading" %} {% trans "on mobile devices" %}" alt="{% trans "Download EPUB" %}" /></a>
51                     {% endif %}
52                     {% if book.mobi_file %}
53                         <a href="{{ book.mobi_file.url }}"><img src="{{ STATIC_URL }}img/mobi.png" title="{% trans "Download MOBI" %} &ndash; {% trans "for reading" %} {% trans "on mobile devices" %}" alt="{% trans "Download MOBI" %}" /></a>
54                     {% endif %}
55                     {% if book.txt_file %}
56                         <a href="{{ book.txt_file.url }}"><img src="{{ STATIC_URL }}img/txt.png" title="{% trans "Download TXT" %} &ndash; {% trans "for reading" %} {% trans "on small displays, for example mobile phones" %}" alt="{% trans "Download TXT" %}" /></a>
57                     {% endif %}
58                         
59                     {% if book.pdf_file %}
60                         <br/><a href="#" id="custom-pdf-link">{% trans "Dowload customized PDF" %}</a>.
61                     {% endif %}
62                         <div style="display: none" class="custom-pdf">
63                           <form action="{% url catalogue.views.download_custom_pdf book.fileid %}" method="GET">
64                             {{custom_pdf_form.as_p}}
65                             <input type="submit" value="{% trans "Download" %}"/>
66                           </form>
67                         </div>
68                 </div>
69                 {% if book.has_mp3_file or book.has_ogg_file or book.has_daisy_file %}
70                     <p class="header">
71                         <span class="desc">{% trans "Audiobooks" %}:</span>
72                         <span class="audiotabs">
73                             {% if book.has_mp3_file %}<span class="active" data-format="mp3">MP3</span>{% endif %}
74                             {% if book.has_ogg_file %}<span data-format="ogg">Ogg Vorbis</span>{% endif %}
75                             {% if book.has_daisy_file %}<span data-format="daisy">DAISY</span>{% endif %}
76                         </span>
77                     </p>
78                     <div class="audiobooks">
79                         <img src="{{ STATIC_URL }}img/speaker.png" id="speaker" alt="Speaker icon"/>
80                         {% if book.has_mp3_file %}
81                             <ul class="audiobook-list" id="mp3-files">
82                             {% for media in book.get_mp3 %}
83                                 <li class="mp3Player">
84                                   <a href="{{ media.file.url }}">{{ media.name }}</a><br/>
85                                   {% trans "Artist" %}: {{ media.get_extra_info_value.artist_name }}<br/>
86                                   {% trans "Director"%}: {{ media.get_extra_info_value.director_name }}<br/>
87                                   <object type="application/x-shockwave-flash" style="margin-top: 0.5em" data="{{ STATIC_URL }}player.swf" width="226" height="20">
88                                         <param name="movie" value="{{ STATIC_URL }}player.swf" />
89                                         <param name="bgcolor" value="#ffffff" />
90                                         <param name="FlashVars" value="mp3={{ media.file.url }}&amp;width=226&amp;showvolume=1&amp;bgcolor1=eeeeee&amp;bgcolor2=eeeeee&amp;buttoncolor=666666" />
91                                     </object>
92                                     
93                                 </li>
94                             {% endfor %}
95                             </ul>     
96                         {% endif %}
97
98                         {% if book.has_ogg_file %}
99                             <ul class="audiobook-list" id="ogg-files">
100                             {% for media in book.get_ogg %}
101                                 <li><a href="{{ media.file.url }}">{{ media.name }}</a></li>
102                             {% endfor %}
103                             </ul>
104                         {% endif %}
105                         {% if book.has_daisy_file %}
106                             <ul class="audiobook-list" id="daisy-files">
107                             {% for media in book.get_daisy %}
108                                 <li><a href="{{ media.file.url }}">{{ media.name }}</a></li>
109                             {% endfor %}
110                             </ul>
111                         {% endif %}
112                     </div> <!-- /audiobooks -->
113                     {% if projects|length > 1 %}
114                         <p>{% trans "Audiobooks were prepared as a part of the projects:" %}</p>
115                         <ul>
116                         {% for cs, fb in projects %}
117                             <li>
118                             {% if fb %}
119                                 {% blocktrans %}{{ cs }}, funded by {{ fb }}{% endblocktrans %}
120                             {% else %}
121                                 {{ cs }}
122                             {% endif %}
123                             </li>
124                         {% endfor %}
125                         </ul>
126                     {% else %}
127                         <p>
128                         {% with projects.0.0 as cs %}
129                         {% with projects.0.1 as fb %}
130                             {% if fb %}
131                                 {% blocktrans %}Audiobooks were prepared as a part of the {{ cs }} project funded by {{ fb }}.{% endblocktrans %}
132                             {% else %}
133                                 {% blocktrans %}Audiobooks were prepared as a part of the {{ cs }} project.{% endblocktrans %}
134                             {% endif %}
135                         {% endwith %}
136                         {% endwith %}
137                         </p>
138                     {% endif %}
139                 {% endif %}
140             </div>
141         </div>
142
143         {% if book_children %}
144         {% autopaginate book_children 10 %}
145         <div id="book-children">
146             <ol>
147             {% for book in book_children %}
148                 <li>{{ book.short_html }}</li>
149             {% endfor %}
150             </ol>
151         </div>
152         {% paginate %}
153         {% endif %}
154
155     </div>
156
157     <div id="tags-list">
158         <div id="book-info">
159             <h2>{% trans "Details" %}</h2>
160             <ul>
161                 <li>
162                     {% trans "Author" %}:
163                     {% for tag in categories.author %}
164                     <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
165                     {% endfor %}
166                 </li>
167                 <li>
168                     {% trans "Epoch" %}:
169                     {% for tag in categories.epoch %}
170                     <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
171                     {% endfor %}
172                 </li>
173                 <li>
174                     {% trans "Kind" %}:
175                     {% for tag in categories.kind %}
176                     <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
177                     {% endfor %}
178                 </li>
179                 <li>
180                     {% trans "Genre" %}:
181                     {% for tag in categories.genre %}
182                     <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
183                     {% endfor %}
184                 </li>              
185             </ul>
186             <h2>{% trans "Other resources" %}</h2>
187             <ul>
188                 {% if extra_info.source_url %}
189                 <li><a href="{{ extra_info.source_url }}">{% trans "Source of the book" %}</a></li>
190                 {% endif %}
191                 {% if extra_info.about and not hide_about %}
192                 <li><a href="{{ extra_info.about }}">{% trans "Book on the Editor's Platform" %}</a></li>
193                 {% endif %}
194                 {% if book.gazeta_link %}
195                 <li><a href="{{ book.gazeta_link }}">{% trans "Book description on Lektury.Gazeta.pl" %}</a></li>
196                 {% endif %}
197                 {% if book.wiki_link %}
198                 <li><a href="{{ book.wiki_link }}">{% trans "Book description on Wikipedia" %}</a></li>
199                 {% endif %}
200             </ul>
201             <p><a href="{{ book.xml_file.url }}">{% trans "View XML source" %}</a></p>
202             <p><a href="{% url poem_from_book book.urlid %}">Miksuj ten utwór</a></p>
203         </div>
204         <div id="themes-list">
205             <h2>{% trans "Work's themes " %}</h2>
206             <ul>
207             {% for theme in book_themes %}
208                 <li><a href="{% url book_fragments book.urlid theme.slug %}">{{ theme }} ({{ theme.count }})</a></li>
209             {% endfor %}
210             </ul>
211         </div>
212         <div class="clearboth"></div>
213     </div>
214 {% endblock %}