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