69f81864b255d7f95e498796ff0e8725e7920f51
[wolnelektury.git] / src / catalogue / templates / catalogue / book_detail.html
1 {% extends 'base.html' %}
2 {% load i18n %}
3 {% load chunks %}
4 {% load static %}
5 {% load choose_cites from social_tags %}
6 {% load catalogue_tags %}
7 {% load likes_book from social_tags %}
8 {% load annoy %}
9
10
11 {% block global-content %}
12 <div class="l-container">
13   {% annoy_banner 'book-page' %}
14   </div>
15
16     <div class="l-container">
17       <div class="l-breadcrumb">
18         <a href="/"><span>{% trans "Strona główna" %}</span></a>
19         <a href="/katalog/lektury/"><span>{% trans "Literatura" %}</span></a>
20         {% for ancestor in book.ancestors %}
21           <a href="{{ ancestor.get_absolute_url }}">{{ ancestor.title }}</a>
22         {% endfor %}
23       </div>
24     </div>
25
26
27     <main class="l-main page-book">
28       <section class="l-section lay-s-col-rev">
29         {% with first_text=book.get_first_text %}
30           <aside class="l-aside">
31             <figure class="only-l">
32               {% if accessible and first_text %}
33                 <a href="{% url 'book_text' first_text.slug %}">
34               {% endif %}
35               <img src="{% if book.cover_clean %}{{ book.cover_clean.url }}{% endif %}" alt="{{ book.pretty_title }}" width="240">
36               {% if accessible and first_text %}
37                 </a>
38               {% endif %}
39             </figure>
40
41             {% if book.parent or book.get_children %}
42               <ul class="l-aside__zbiory">
43                 {% if book.parent %}
44                   {% for b in book.ancestors %}
45                     <li>
46                       <a href="{{ b.get_absolute_url }}">{{ b.title }}</a>
47                       <ul>
48                   {% endfor %}
49                   {% for b in book.get_siblings %}
50                     <li>
51                       {% if b == book %}
52                         <strong>{{ b.title }}</strong>
53                         <ul>
54                           {% for c in book.get_children %}
55                             <li>
56                               <a href="{{ c.get_absolute_url }}">{{ c.title }}</a>
57                             </li>
58                           {% endfor %}
59                         </ul>
60                       {% else %}
61                         <a href="{{ b.get_absolute_url }}">{{ b.title }}</a>
62                       {% endif %}
63                     </li>
64                   {% endfor %}
65
66                   {% for b in book.ancestor.all %}
67                       </ul>
68                     </li>
69                   {% endfor %}
70                 {% else %}
71                   <li>
72                     <strong>{{ book.title }}</strong>
73                     <ul>
74                       {% for c in book.get_children %}
75                         <li>
76                           <a href="{{ c.get_absolute_url }}">{{ c.title }}</a>
77                         </li>
78                       {% endfor %}
79                     </ul>
80                   </li>
81                 {% endif %}
82               </ul>
83             {% endif  %}
84
85             <ul class="l-aside__info">
86               <li><span>{% trans "Epoka" %}:</span> {% for tag in book.epochs %}<a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %}</li>
87               <li><span>{% trans "Rodzaj" %}:</span> {% for tag in book.kinds %}<a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %}</li>
88               <li><span>{% trans "Gatunek" %}:</span> {% for tag in book.genres %}<a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a> {% endfor %}</li>
89
90             </ul>
91           </aside>
92           <div class="l-content">
93             <header class="l-header">
94               <div class="l-header__content">
95                 <p>{% for author in book.authors %}<a href="{{ author.get_absolute_url }}">{{ author.name }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}
96                 </p>
97                 <h1><a href="{{ book.get_absolute_url }}">{{ book.title }}</a></h1>
98                 {% if book.translators.exists %}
99                   <p class="l-header__translators">
100                     {% for translator in book.translators.all %}
101                       {% if forloop.first and translator.name != 'tłumacz nieznany' %}
102                         {% trans "tłum." %}
103                       {% endif %}
104                       <a href="{{ translator.get_absolute_url }}">
105                         {{ translator }}</a>{% if not forloop.last %}, {% endif %}
106                     {% endfor %}
107                   </p>
108                 {% endif %}
109               </div>
110
111
112
113               {% likes_book book as likes %}
114               <div class="l-header__actions only-l">
115                 {% if likes %}
116                   <form method='post' action='{% url 'social_unlike_book' book.slug %}'>
117                     {% csrf_token %}
118                     <button class="l-button l-button--fav">
119                       <img src="{% static '2022/images/faved.svg' %}" alt="{% trans 'Usuń z ulubionych' %}">
120                     </button>
121                   </form>
122                 {% else %}
123                   <form method='post' action='{% url 'social_like_book' book.slug %}'>
124                     {% csrf_token %}
125                     <button class="l-button l-button--fav">
126                       <img src="{% static '2022/images/fav.svg' %}" alt="{% trans 'Dodaj do ulubionych' %}">
127                     </button>
128                   </form>
129                 {% endif %}
130               </div>
131             </header>
132             <article class="l-article">
133
134
135
136
137
138               {% if accessible %}
139                 <div class="c-media">
140                   <div class="lay-row lay-l-block lay-spread">
141                     <figure class="only-s book-cover-small">
142                       {% if accessible and first_text %}
143                         <a href="{% url 'book_text' first_text.slug %}">
144                       {% endif %}
145                       <img src="{% if book.cover_clean %}{{ book.cover_clean.url }}{% endif %}" alt="{{ book.pretty_title }}">
146                       {% if accessible and first_text %}
147                         </a>
148                       {% endif %}
149                     </figure>
150                     <div class="lay-col lay-spread lay-grow">
151                       <div class="l-header__actions only-s">
152                         {% if likes %}
153                           <form method='post' action='{% url 'social_unlike_book' book.slug %}'>
154                             {% csrf_token %}
155                             <button class="l-button l-button--fav">
156                               <img src="{% static '2022/images/faved.svg' %}" alt="{% trans 'Usuń z ulubionych' %}">
157                             </button>
158                           </form>
159                         {% else %}
160                           <form method='post' action='{% url 'social_like_book' book.slug %}'>
161                             {% csrf_token %}
162                             <button class="l-button l-button--fav">
163                               <img src="{% static '2022/images/fav.svg' %}" alt="{% trans 'Dodaj do ulubionych' %}">
164                             </button>
165                           </form>
166                         {% endif %}
167                       </div>
168                       <div class="c-media__actions lay-col lay-l-row">
169                         <div class="c-media__btn">
170                           {% if book.has_mp3_file %}
171                             <button class="l-button l-button--media" id="audiobook"><i class="icon icon-audio"></i> {% trans "pobierz audiobook" %}</button>
172                           {% endif %}
173                         </div>
174                         <div class="c-media__btn">
175                           <button class="l-button l-button--media" id="ebook"><i class="icon icon-book"></i> {% trans "pobierz książkę" %}</button>
176                         </div>
177                         <div class="c-media__btn">
178                           {% if first_text %}
179                             <a href="https://elevenreader.io/audiobooks/wolnelektury:{{ first_text.slug }}" target="_blank" class="l-button l-button--media"><img src="{% static 'img/elevenreader-21.png' %}" title="{% trans "Posłuchaj w ElevenReader" %}" alt="{% trans "Posłuchaj w ElevenReader" %}"></a>
180                           {% endif %}
181                         </div>
182                         <div class="c-media__btn">
183                           {% if first_text %}
184                             <a href="{% url 'book_text' first_text.slug %}" class="l-button l-button--media l-button--media--full"><i class="icon icon-eye"></i> {% trans "czytaj online" %}</a>
185                           {% endif %}
186                         </div>
187                       </div>
188                     </div>
189                   </div>
190
191
192                   {% if book.has_audio %}
193                     {% include 'catalogue/snippets/jplayer.html' %}
194                   {% endif %}
195
196
197                   <div class="c-media__popup" data-popup="ebook">
198                     <div class="c-media__popup__box">
199                       <div class="c-media__popup__box__lead">
200                         <h2>{% trans "Pobieranie e-booka" %}</h2>
201                         <p>{% trans "Wybierz wersję dla siebie" %}:</p>
202                       </div>
203                       <div class="c-media__popup__box__items">
204                         {% if book.pdf_file %}
205                           <div class="c-media__popup__box__item">
206                             <div>
207                               <h3>.pdf</h3>
208                               <p>{% trans "Jeśli planujesz wydruk albo lekturę na urządzeniu mobilnym bez dodatkowych aplikacji." %}</p>
209                             </div>
210                             <div>
211                               <a href="{{ book.pdf_url }}" class="l-button l-button--media l-button--media--full">.pdf</a>
212                             </div>
213                           </div>
214                         {% endif %}
215                         {% if book.epub_file %}
216                           <div class="c-media__popup__box__item">
217                             <div>
218                               <h3>.epub</h3>
219                               <p>{% trans "Uniwersalny format e-booków, obsługiwany przez większość czytników sprzętowych i aplikacji na urządzenia mobilne." %}</p>
220                             </div>
221                             <div>
222                               <a href="{{ book.epub_url }}" class="l-button l-button--media l-button--media--full">.epub</a>
223                             </div>
224                           </div>
225                         {% endif %}
226                         {% if book.mobi_file %}
227                           <div class="c-media__popup__box__item">
228                             <div>
229                               <h3>.mobi</h3>
230                               <p>{% trans "Natywny format dla czytnika Amazon Kindle." %}</p>
231                             </div>
232                             <div>
233                               <a href="{{ book.mobi_url }}" class="l-button l-button--media l-button--media--full">.mobi</a>
234                             </div>
235                           </div>
236                         {% endif %}
237                         {% if book.synchro_file %}
238                           <div class="c-media__popup__box__item">
239                             <div>
240                               <h3>synchrobook (epub3)</h3>
241                               <p>{% trans "Książka elektroniczna i audiobook w jednym. Wymaga aplikacji obsługującej format." %}</p>
242                             </div>
243                             <div>
244                               <a href="{{ book.synchro_file }}" class="l-button l-button--media l-button--media--full">synchrobook</a>
245                             </div>
246                           </div>
247                         {% endif %}
248                         {% if book.txt_file or book.fb2_file %}
249                           <div class="c-media__popup__box__item">
250                             <div>
251                               <h3>{% trans "inne formaty" %}</h3>
252                               <ul>
253                                 <li><a href="{% url 'custom_pdf_form' book.slug %}">{% trans "Stwórz własny PDF" %}</a></li>
254                                 {% if book.txt_file %}<li><a href="{{ book.txt_url }}">{% trans "plik tekstowy" %} (.txt)</a></li>{% endif %}
255                                 {% if book.fb2_file %}<li><a href="{{ book.fb2_url }}">{% trans "FictionBook" %}</a></li>{% endif %}
256                               </ul>
257                             </div>
258                           </div>
259                         {% endif %}
260                       </div>
261                       <button class="c-media__popup__close">
262                         <img src="{% static '2022/images/close.svg' %}" alt="{% trans 'Zamknij' %}">
263                       </button>
264                     </div>
265                   </div>
266                   {% if book.has_audio %}
267                     <div class="c-media__popup" data-popup="audiobook">
268                       <div class="c-media__popup__box">
269                         <div class="c-media__popup__box__lead">
270                           <h2>{% trans "Pobieranie audiobooka" %}</h2>
271                           <p>{% trans "Wybierz wersję dla siebie" %}:</p>
272                         </div>
273                         <div class="c-media__popup__box__items">
274                           <div class="c-media__popup__box__item">
275                             <div>
276                               <h3>.mp3</h3>
277                               <p>{% trans "Uniwersalny format, obsługiwany przez wszystkie urządzenia." %}</p>
278                             </div>
279                             <div>
280                               <a href="{% url 'download_zip_mp3' book.slug %}" class="l-button l-button--media l-button--media--full">.mp3</a>
281                             </div>
282                           </div>
283                           <div class="c-media__popup__box__item">
284                             <div>
285                               <h3>OggVorbis</h3>
286                               <p>{% trans "Otwarty format plików audio, oferujący wysokiej jakości nagranie." %}</p>
287                             </div>
288                             <div>
289                               <a href="{% url 'download_zip_ogg' book.slug %}" class="l-button l-button--media l-button--media--full">.ogg</a>
290                             </div>
291                           </div>
292                           {% if book.has_daisy_file %}
293                             <div class="c-media__popup__box__item">
294                               <div>
295                                 <h3>DAISY</h3>
296                                 <p>{% translate "Format dla osób z dysfunkcjami czytania." %}</p>
297                               </div>
298                               <div>
299                                 {% for dsy in book.media_daisy %}
300                                   <a href="{{ dsy.file.url }}" class="l-button l-button--media l-button--media--full">DAISY</a>
301                                 {% endfor %}
302                               </div>
303                             </div>
304                           {% endif %}
305                           {% if book.has_audio_epub_file %}
306                             <div class="c-media__popup__box__item">
307                               <div>
308                                 <h3>EPUB + audiobook</h3>
309                                 <p>{% trans "Książka elektroniczna i audiobook w jednym. Wymaga aplikacji obsługującej format." %}</p>
310                               </div>
311                               <div>
312                                 {% for epub in book.media_audio_epub %}
313                                   <a href="{{ epub.file.url }}" class="l-button l-button--media l-button--media--full">EPUB+audio</a>
314                                 {% endfor %}
315                               </div>
316                             </div>
317                           {% endif %}
318                         </div>
319                         <button class="c-media__popup__close">
320                           <img src="{% static '2022/images/close.svg' %}" alt="{% trans 'Zamknij' %}">
321                         </button>
322                       </div>
323                     </div>
324                   {% endif %}
325                 </div>
326               {% else %}
327                 <div style="margin-bottom: 1.5rem; font-size: 15px; like-height: 150%; color: #808080;">
328                   {% chunk 'book-preview-warn' %}
329                 </div>
330
331                 <div class="l-checkout__box">
332                   {% include 'club/donation_step1_form.html' with form=donation_form %}
333                 </div>
334               {% endif %}
335
336               <div class="l-article__overlay abstract" data-max-height="327">
337                 {% content_warning book %}
338                 {{ book.abstract|safe }}
339
340                 {% if book.toc %}
341                   <div class="toc">
342                     <h4>{% trans "Spis treści" %}:</h4>
343                     {{ book.toc|safe }}
344                   </div>
345                 {% endif %}
346               </div>
347               <button class="l-article__read-more" aria-label="{% trans 'Kliknij aby rozwinąć' %}" data-label="{% trans 'Czytaj więcej' %}" data-action="{% trans 'Zwiń tekst' %}">{% trans 'Czytaj więcej' %}</button>
348             </article>
349             {% if accessible %}
350             {% annoy_banner 'book-page-center' book=book %}
351             {% endif %}
352           </div>
353         {% endwith %}
354       </section>
355
356       {% for tag in book.authors %}
357         <section class="l-section">
358           <div class="l-author">
359             {% include 'catalogue/author_box.html' %}
360
361             {% if forloop.first %}
362               {% choose_cites 3 book=book as cites %}
363               {% if cites %}
364                 <div class="row">
365                   <div class="l-author__quotes">
366                     <div class="l-author__quotes__slider">
367                       {% for fragment in cites %}
368                         {% include "catalogue/fragment_slider_box.html" %}
369                       {% endfor %}
370                     </div>
371                   </div>
372                 </div>
373               {% endif %}
374             {% endif %}
375           </div>
376         </section>
377       {% endfor %}
378
379       <section class="l-section">
380         <div class="l-themes__wrapper">
381           {% with book.related_themes as themes %}
382             {% if themes %}
383               <h2>
384                 {% trans "Motywy występujące w tym utworze" %}
385                 <a href="/katalog/motyw/"><span>{% trans "Wszystkie motywy" %}</span> <i class="icon icon-arrow-right"></i></a></h2>
386               <div class="l-themes l-article__overlay" data-max-height="80">
387                 <ul>
388                   {% for item in themes %}
389                     <li><a href="{% url 'book_fragments' book.slug item.slug %}">{{ item }}&nbsp;({{ item.count}})</a></li>
390                   {% endfor %}
391                 </ul>
392               </div>
393               <button class="l-article__read-more" aria-label="{% trans 'Kliknij aby rozwinąć' %}" data-label="{% trans 'Zobacz więcej' %}" data-action="{% trans 'Zwiń tekst' %}">{% trans 'Zobacz więcej' %}</button>
394
395             {% endif %}
396           {% endwith %}
397           <ul class="links">
398             {% if book.wiki_link %}
399               <li><a href="{{ book.wiki_link }}">{% trans "strona utworu w Wikipedii" %}</a></li>
400             {% endif %}
401             {% if accessible %}
402             <li>
403               <a href="{{ book.xml_url }}">{% trans "źródłowy plik XML" %}</a>
404             </li>
405             <li>
406               <a target="_blank" href="{% url 'poem_from_book' book.slug %}">{% trans "miksuj treść utworu" %}</a>
407             </li>
408             <li>
409               <a target="_blank" href="{{ book.get_extra_info_json.about }}">{% trans "utwór na Platformie Redakcyjnej" %}</a>
410             </li>
411             {% endif %}
412           </ul>
413         </div>
414       </section>
415     </main>
416
417
418
419
420
421     <section class="l-section">
422       <div class="l-books__wrapper">
423         <div class="l-container">
424           <h2>{% trans "Czytaj także" %}</h2>
425           <div class="l-books">
426             {% if book.other_versions %}
427               {% for rel in book.other_versions %}
428                 <article class="l-books__item">
429                   <figure class="l-books__item__img">
430                     <a href="{{ rel.get_absolute_url }}">
431                       <img src="{% if rel.cover_clean %}{{ rel.cover_clean.url }}{% endif %}" alt="{{ rel.pretty_title }}">
432                     </a>
433                   </figure>
434                   <h3>
435                     {% for author in rel.authors %}
436                       <a href="{{ author.get_absolute_url }}">{{ author }}</a>
437                     {% endfor %}
438                   </h3>
439                   <h2><a href="{{ rel.get_absolute_url }}">{{ rel.title }}</a></h2>
440                 </article>
441               {% endfor %}
442             {% endif %}
443
444
445             {% related_books book taken=book.other_versions|length as related_books %}
446             {% for rel in related_books %}
447               <article class="l-books__item">
448                 <figure class="l-books__item__img">
449                   <a href="{{ rel.get_absolute_url }}">
450                     <img src="{% if rel.cover_clean %}{{ rel.cover_clean.url }}{% endif %}" alt="{{ rel.pretty_title }}">
451                   </a>
452                 </figure>
453                 <h3>
454                   {% for author in rel.authors %}
455                     <a href="{{ author.get_absolute_url }}">{{ author|upper }}</a>
456                   {% endfor %}
457                 </h3>
458                 <h2><a href="{{ rel.get_absolute_url }}">{{ rel.title }}</a></h2>
459               </article>
460             {% endfor %}
461
462             <article class="l-books__item l-books__item--link">
463               <a href="/katalog/kolekcje/">{% trans "i wiele innych książek, wierszy, obrazów, audiobooków…" %}</a>
464               <a href="/katalog/kolekcje/" class="icon-link"><i class="icon icon-all"></i></a>
465             </article>
466
467           </div>
468         </div>
469       </div>
470     </section>
471
472
473 {% endblock %}