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