Fetch thumbnails from wikidata.
[wolnelektury.git] / src / catalogue / templates / catalogue / book_short.html
1 {% spaceless %}
2   {% load i18n %}
3   {% load cache %}
4   {% load catalogue_tags %}
5   {% load book_shelf_tags from social_tags %}
6   {% load static %}
7
8   {% with ga=book.get_audiobooks %}
9   {% with audiobooks=ga.0 %}
10   <div class="{% block box-class %}book-box{% if audiobooks %} audiobook-box{% endif %}{% endblock %}">
11     <div class="book-box-inner">
12
13     {% block book-box-pre %}
14       {% include "catalogue/snippets/like_button.html" %}
15     {% endblock %}
16
17     {% with book.tags_by_category as tags %}
18     <div class="book-left-column">
19       <div class="book-box-body">
20         {% block book-box-body-pre %}
21         {% endblock %}
22
23         <div class="cover-area">
24           {% if book.cover_thumb %}
25             <a href="{% block cover-link %}{{ book.get_absolute_url }}{% endblock %}">
26               <img src="{{ book.cover_thumb.url }}" alt="Cover" class="cover" />
27             </a>
28           {% endif %}
29           {% block cover-area-extra %}{% endblock %}
30         </div>
31
32         {% get_current_language as LANGUAGE_CODE %}
33         {% cache 86400 book_box_head_tags book.pk LANGUAGE_CODE %}
34         <div class="book-box-head">
35           <div class="author">
36             {% for tag in tags.author %}
37               <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>{% if not forloop.last %},
38             {% endif %}{% endfor %}{% for parent in book.parents %},
39               <a href="{{ parent.get_absolute_url }}">{{ parent.title }}</a>{% endfor %}
40           </div>
41           <div class="title">
42             <a href="{{ book.get_absolute_url }}">{{ book.title }}</a>
43           </div>
44           {% if book.translator %}
45               <div class="author">
46                   tłum. {{ book.translator }}
47               </div>
48           {% endif %}
49         </div>
50
51         <div class="tags">
52           <span class="category">
53           <span class="mono"> {% trans "Epoch" %}:</span>&nbsp;<span class="book-box-tag">
54             {% for tag in tags.epoch %}
55               <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>
56               {% if not forloop.last %}<span>, </span>{% endif %}
57             {% endfor %}
58           </span></span>
59
60           <span class="category">
61           <span class="mono"> {% trans "Kind" %}:</span>&nbsp;<span class="book-box-tag">
62             {% for tag in tags.kind %}
63               <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>
64               {% if not forloop.last %}<span>, </span>{% endif %}
65             {% endfor %}
66           </span></span>
67
68           <span class="category">
69           <span class="mono"> {% trans "Genre" %}:</span>&nbsp;<span class="book-box-tag">
70             {% for tag in tags.genre %}
71               <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>
72               {% if not forloop.last %}<span>, </span>{% endif %}
73             {% endfor %}
74           </span></span>
75
76           {% with extra_info=book.get_extra_info_json %}
77             {% if extra_info.location %}
78               <span class="category">
79               <span class="mono"> {% trans "Region" %}:</span>&nbsp;<span class="book-box-tag">
80                   {{ extra_info.location }}
81               </span></span>
82             {% endif %}
83           {% endwith %}
84
85           {% if book.is_foreign %}
86             <span class="category">
87               <span class="mono"> {% trans "Language" %}:</span>&nbsp;<span class="book-box-tag">
88                 <a>{{ book.language_name }}</a>
89               </span>
90             </span>
91           {% endif %}
92
93           {% with stage_note=book.stage_note %}
94           {% if stage_note.0 %}
95             <br>
96             <span class="category">
97               <a{% if stage_note.1 %} href="{{ stage_note.1 }}"{% endif %}>{{ stage_note.0 }}</a>
98             </span>
99           {% endif %}
100           {% endwith %}
101         </div>
102         {% endcache %}
103       </div>
104       {% book_shelf_tags book.pk %}
105
106       {% cache 86400 book_box_tools book.pk book|status:request.user LANGUAGE_CODE %}
107       {% if book|status:request.user != 'closed' %}
108         <ul class="book-box-tools">
109           <li class="book-box-read">
110             {% if book.html_file %}
111             <div>{% content_warning book %}</div>
112               <a href="{% url 'book_text' book.slug %}" class="downarrow">{% trans "Read online" %}</a>
113             {% endif %}
114             {% if book.print_on_demand %}
115               <a href="{{ book.ridero_link }}" class="downarrow print tlite-tooltip" title="{% trans "Cena książki w druku cyfrowym jest zależna od liczby stron.<br>Przed zakupem upewnij się, że cena druku na żądanie jest dla Ciebie odpowiednia.<br>Wszystkie nasze zasoby w wersji elektronicznej są zawsze dostępne bezpłatnie." %}">{% trans "Print on demand –" %}
116                   <img src="{% static 'img/ridero.png' %}" style="height: 0.8em;"/></a>
117             {% endif %}
118           </li>
119           <li class="book-box-download">
120             <a class="downarrow">{% trans "Download" %}:</a>
121             <div class="book-box-formats">
122               {% if book.pdf_file %}
123                 <span><a href="{{ book.pdf_url}}">PDF</a></span>
124               {% endif %}
125               {% if book.epub_file %}
126                 <span><a href="{{ book.epub_url}}">EPUB</a></span>
127               {% endif %}
128               {% if book.mobi_file %}
129                 <span><a href="{{ book.mobi_url}}">MOBI</a></span>
130               {% endif %}
131               {% if book.has_audio %}
132                 <span><a href="{% url 'download_zip_mp3' book.slug %}">MP3</a></span>
133               {% endif %}
134               <a class="read-more-show hide" href="#">{% trans "more" %}</a>
135               <span class="read-more-content">
136                 {% if  book.fb2_file %}
137                   <span><a href="{{ book.fb2_url}}">FB2</a></span>
138                 {% endif %}
139                 {% if  book.txt_file %}
140                   <span><a href="{{ book.txt_url}}">TXT</a></span>
141                 {% endif %}
142                 {% download_audio book mp3=False %}
143                 <br>
144                 {% custom_pdf_link_li book %}
145                 <a class="read-more-hide hide" href="#">{% trans "less" %}</a>
146               </span>
147             </div>
148           </li>
149         </ul>
150       {% else %}
151         {% block preview-info %}
152           <p class="book-box-tools book-box-tools-warn">
153             {% trans "For now this work is only available for our subscribers." %}
154             <a href="/towarzystwo/">Dołącz do Towarzystwa Przyjaciół Wolnych Lektur</a>
155           </p>
156           <div>{% content_warning book %}</div>
157         {% endblock %}
158       {% endif %}
159       {% endcache %}
160       {% block book-box-extra-info %}{% endblock %}
161       {% block box-append %}{% endblock %}
162     </div>
163     {% endwith %}
164
165     {% block right-column %}
166       {% if audiobooks %}{% if book|status:request.user != 'closed' %}
167         <div class="book-right-column">
168           {% include 'catalogue/snippets/jplayer.html' %}
169         </div>
170       {% endif %}{% endif %}
171     {% endblock %}
172     {% if book.abstract %}
173       <div class="abstract more-expand">
174         {{ book.abstract|safe }}
175       </div>
176     {% endif %}
177
178     <div class="clearboth"></div>
179     </div>
180   </div>
181   {% endwith %}
182   {% endwith %}
183 {% endspaceless %}