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