Switch cover.
[wolnelektury.git] / src / catalogue / templates / catalogue / book_text.html
1 {% extends "catalogue/viewer_base.html" %}
2 {% load i18n l10n %}
3 {% load catalogue_tags %}
4 {% load chunks %}
5 {% load thumbnail %}
6 {% load annoy_banners from annoy %}
7
8
9 {% block title %}{{ book.pretty_title }}{% endblock %}
10
11
12 {% block extrahead %}
13   <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
14         integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
15         crossorigin=""/>
16   <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
17           integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
18           crossorigin=""></script>
19 {% endblock %}
20
21 {% block menu %}
22   <li>
23     <a href="{{ book.get_absolute_url }}" id="menu-book" data-box="book-short">
24       <span class="label">{% trans "Click to download" %}:</span>
25       <img src="{% if book.cover_clean %}{% thumbnail book.cover_clean '240x332' as thumb %}{{ thumb.url }}{% empty %}{{ book.cover_clean.url }}{% endthumbnail %}{% endif %}"
26            width="120" height="166"
27            alt="{{ book.pretty_title }}"
28            title="{{ book.pretty_title }}">
29     </a>
30   </li>
31
32   {% if book.other_versions.exists %}
33     <li id="menu-other">
34       <a href="#" data-box="other">
35         <span class="label">{% trans "Other versions" %}</span>
36       </a>
37     </li>
38   {% endif %}
39
40   <li id="menu-toc">
41     <a href="#" data-box="wltoc">
42       <span class="label">{% trans "Table of contents" %}</span>
43     </a>
44   </li>
45
46   <li id="menu-themes">
47     <a href="#" data-box="themes">
48       <span class="label">{% trans "Themes" %}</span>
49     </a>
50   </li>
51
52   <li id="menu-nota_red">
53     <a href="#" data-box="nota_red">
54       <span class="label">{% trans "Edit. note" %}</span>
55     </a>
56   </li>
57
58   <li id="menu-info">
59     <a href="#info" data-box="info">
60       <span class="label">{% trans "Infobox" %}</span>
61     </a>
62   </li>
63
64   <a href="#" class="settings-switch" id="settings-line-numbers"
65      data-setting="always-hide-line-numbers"><span>{% trans "Numbering" %}</span></a>
66   <a href="#" class="settings-switch" id="settings-themes"
67      data-setting="always-hide-themes"><span>{% trans "Themes" %}</span></a>
68   <a href="#" class="settings-switch" id="settings-annotations"
69      data-setting="no-annotations"><span>{% trans "Footnotes" %}</span></a>
70   <a href="#" class="settings-switch" id="settings-references"
71      data-setting="no-references"><span>{% trans "References" %}</span></a>
72
73 {% endblock menu %}
74
75
76 {% block big-pane %}
77
78   <article id="main-text">
79     {% with next=book.get_next_text prev=book.get_prev_text %}
80       {% if next %}
81         <a style="float:right; padding: 1em;" href="{% url 'book_text' next.slug %}">{{ next.title }}&nbsp;&rarr;</a>
82       {% endif %}
83       {% if prev %}
84         <a style="display:inline-block;padding: 1em;" href="{% url 'book_text' prev.slug %}">&larr;&nbsp;{{ prev.title }}</a>
85       {% endif %}
86       <div style="text-align:center; margin-top:1em;">
87         {% content_warning book %}
88       </div>
89       <div style="clear:both;"></div>
90       {{ book_text|safe }}
91     {% endwith %}
92   </article>
93
94
95
96   <article id="other-text">
97     <a class="other-text-close" href="#">{% trans "Close" %}</a>
98     <div id="other-text-waiter">{% trans "Please wait..." %}</div>
99     <div id="other-text-body" style="display: none;"></div>
100   </article>
101
102   <div id="reference-box">
103     <div id="reference-map"></div>
104     <a id="reference-close" href="#">x</a>
105     <div id="reference-images">
106     </div>
107     <a id="reference-link" target="_blank"></a>
108   </div>
109
110
111
112
113 {% endblock big-pane %}
114
115 {% block footer %}
116   {% if book.has_sync_file %}
117     <div id="player-bar">
118       {% include 'catalogue/snippets/2022_jplayer_reader.html' %}
119     </div>
120     <script type="application/json" id="smil">
121      {{ book.get_sync|safe }}
122     </script>
123   {% endif %}
124   <div id="wltoc" class="box">
125     {% if book.parent %}
126       {% for b in book.ancestors %}
127         {% if forloop.counter > 1 %}
128           <li>
129         {% endif %}
130         <a href="{% if b.html_file %}{% url 'book_text' b.slug %}{% else %}{{ b.get_absolute_url }}{% endif %}">{{ b.title }}</a>
131         <ol>
132       {% endfor %}
133       {% for b in book.get_siblings %}
134         <li>
135           {% if b == book %}
136             <strong>{{ b.title }}</strong>
137             <div id="heretoc"></div>
138           {% else %}
139             <a href="{% url 'book_text' b.get_first_text.slug %}">{{ b.title }}</a>
140           {% endif %}
141         </li>
142       {% endfor %}
143
144       {% for b in book.ancestor.all %}
145         </ol>
146         {% if not forloop.counter.last %}
147           </li>
148         {% endif %}
149       {% endfor %}
150     {% else %}
151       <strong>{{ book.title }}</strong>
152       <div id="heretoc"></div>
153       <ol>
154         {% for c in book.get_children %}
155           <li><a href="{% url 'book_text' c.get_first_text.slug %}">{{ c.title }}</a></li>
156         {% endfor %}
157       </ol>
158     {% endif %}
159   </div>
160
161   <div id="info" class="box">
162     {% book_info book %}
163   </div>
164
165   {% if book.other_versions.exists %}
166     <div class="box" id="other">
167       <h2>{% trans "Other versions of the book" %}</h2>
168       <a class="other-text-close" href="#">{% trans "Close the other version" %}</a>
169       <ul>
170         {% spaceless %}
171           {% for other_version in book.other_versions %}
172             <li>
173               <a class="display-other"
174                  data-other="{{ other_version.html_url }}"
175                  href="{% url 'book_text' other_version.slug %}">
176                 {{ other_version.mini_box_nolink }}
177               </a>
178             </li>
179           {% endfor %}
180         {% endspaceless %}
181       </ul>
182     </div>
183   {% endif %}
184
185   <div class="box" id="book-short">
186     {% include 'catalogue/book_short.html' %}
187   </div>
188
189   <div id="annoy-stubs">
190     {% annoy_banners 'book-text-intermission' %}
191
192     {% for insert in inserts %}
193       {% include 'annoy/dynamic_insert.html' %}
194     {% endfor %}
195   </div>
196
197
198   <div id="marker">
199
200   </div>
201
202   {% localize off %}
203   <script type="application/json" id="interesting-references">
204    {
205        {% for ref in book.references %}
206        {% if ref.entity.is_interesting %}
207        "{{ ref.entity.uri }}": {
208            {% if ref.entity.lat and ref.entity.lon %}
209            "location": [{{ ref.entity.lat }}, {{ ref.entity.lon }}],
210            {% endif %}
211            "images": {{ ref.entity.images|safe }},
212            "label": "{{ ref.entity.label }}",
213            "description": "{{ ref.entity.description }}",
214            "wikipedia_link": "{{ ref.entity.wikipedia_link }}"
215        },
216        {% endif %}
217        {% endfor %}
218        "": null
219    }
220   </script>
221
222   {% endlocalize %}
223 {% endblock footer %}