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