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