Switch cover.
[wolnelektury.git] / src / catalogue / templates / catalogue / book_short.html
1 {% spaceless %}
2   {% load i18n %}
3   {% load thumbnail %}
4   {% load cache %}
5   {% load catalogue_tags %}
6   {% load book_shelf_tags from social_tags %}
7   {% load static %}
8
9   {% with ga=book.get_audiobooks %}
10   {% with audiobooks=ga.0 %}
11   <div class="{% block box-class %}book-box{% if audiobooks %} audiobook-box{% endif %}{% endblock %}">
12     <div class="book-box-inner">
13
14     {% block book-box-pre %}
15       {% include "catalogue/snippets/like_button.html" %}
16     {% endblock %}
17
18     {% with book.tags_by_category as tags %}
19     <div class="book-left-column">
20       <div class="book-box-body">
21         {% block book-box-body-pre %}
22         {% endblock %}
23
24         <div class="cover-area">
25           {% if book.cover_clean %}
26             <a href="{% block cover-link %}{{ book.get_absolute_url }}{% endblock %}">
27               <img src="{% thumbnail book.cover_clean '139x193' as th %}{{ th.url }}{% endthumbnail %}" alt="Cover" class="cover" />
28             </a>
29           {% endif %}
30           {% block cover-area-extra %}{% endblock %}
31         </div>
32
33         {% get_current_language as LANGUAGE_CODE %}
34         {% cache 86400 book_box_head_tags book.pk LANGUAGE_CODE %}
35         <div class="book-box-head">
36           <div class="author">
37             {% for tag in tags.author %}
38               <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>{% if not forloop.last %},
39             {% endif %}{% endfor %}{% for parent in book.parents %},
40               <a href="{{ parent.get_absolute_url }}">{{ parent.title }}</a>{% endfor %}
41           </div>
42           <div class="title">
43             <a href="{{ book.get_absolute_url }}">{{ book.title }}</a>
44           </div>
45           {% if book.translator %}
46               <div class="author">
47                   tłum. {{ book.translator }}
48               </div>
49           {% endif %}
50         </div>
51
52         <div class="tags">
53           <span class="category">
54           <span class="mono"> {% trans "Epoch" %}:</span>&nbsp;<span class="book-box-tag">
55             {% for tag in tags.epoch %}
56               <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>
57               {% if not forloop.last %}<span>, </span>{% endif %}
58             {% endfor %}
59           </span></span>
60
61           <span class="category">
62           <span class="mono"> {% trans "Kind" %}:</span>&nbsp;<span class="book-box-tag">
63             {% for tag in tags.kind %}
64               <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>
65               {% if not forloop.last %}<span>, </span>{% endif %}
66             {% endfor %}
67           </span></span>
68
69           <span class="category">
70           <span class="mono"> {% trans "Genre" %}:</span>&nbsp;<span class="book-box-tag">
71             {% for tag in tags.genre %}
72               <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>
73               {% if not forloop.last %}<span>, </span>{% endif %}
74             {% endfor %}
75           </span></span>
76
77           {% with extra_info=book.get_extra_info_json %}
78             {% if extra_info.location %}
79               <span class="category">
80               <span class="mono"> {% trans "Region" %}:</span>&nbsp;<span class="book-box-tag">
81                   {{ extra_info.location }}
82               </span></span>
83             {% endif %}
84           {% endwith %}
85
86           {% if book.is_foreign %}
87             <span class="category">
88               <span class="mono"> {% trans "Language" %}:</span>&nbsp;<span class="book-box-tag">
89                 <a>{{ book.language_name }}</a>
90               </span>
91             </span>
92           {% endif %}
93
94           {% with stage_note=book.stage_note %}
95           {% if stage_note.0 %}
96             <br>
97             <span class="category">
98               <a{% if stage_note.1 %} href="{{ stage_note.1 }}"{% endif %}>{{ stage_note.0 }}</a>
99             </span>
100           {% endif %}
101           {% endwith %}
102         </div>
103         {% endcache %}
104       </div>
105       {% book_shelf_tags book.pk %}
106
107       {% cache 86400 book_box_tools book.pk book|status:request.user LANGUAGE_CODE %}
108       {% if book|status:request.user != 'closed' %}
109         <ul class="book-box-tools">
110           <li class="book-box-read">
111             {% if book.html_file %}
112             <div>{% content_warning book %}</div>
113               <a href="{% url 'book_text' book.slug %}" class="downarrow">{% trans "Read online" %}</a>
114             {% endif %}
115             {% if book.print_on_demand %}
116               <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 –" %}
117                   <img src="{% static 'img/ridero.png' %}" style="height: 0.8em;"/></a>
118             {% endif %}
119           </li>
120           <li class="book-box-download">
121             <div class="book-box-formats">
122               {% trans "Download an ebook" %}:<br>
123               {% if book.pdf_file %}
124                 <a href="{{ book.pdf_url}}">PDF</a>
125               {% endif %}
126               {% if book.epub_file %}
127                 <a href="{{ book.epub_url}}">EPUB</a>
128               {% endif %}
129               {% if book.mobi_file %}
130                 <a href="{{ book.mobi_url}}">MOBI</a>
131               {% endif %}
132               {% if  book.fb2_file %}
133                 <a href="{{ book.fb2_url}}">FB2</a>
134               {% endif %}
135               {% if  book.txt_file %}
136                 <a href="{{ book.txt_url}}">TXT</a>
137               {% endif %}
138             </div>
139             {% if book.has_mp3_file %}
140               <div class="book-box-formats">
141                 {% trans "Download audiobook" %}:<br>
142                 {% download_audio book %}
143               </div>
144             {% endif %}
145             <div class="book-box-formats">
146                 {% custom_pdf_link_li book %}
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="{% url 'club_join' %}">Wspieraj Wolne Lektury</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 %}