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