a771c1778cf406d91c6792f9080a3793dfa984c2
[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       <img src="{% if book.cover_thumb %}{% thumbnail book.cover_thumb '240x332' as thumb %}{{ thumb.url }}{% empty %}{{ book.cover_thumb.url }}{% endthumbnail %}{% endif %}"
25            width="120" height="166"
26            alt="{{ book.pretty_title }}"
27            title="{{ book.pretty_title }}">
28     </a>
29   </li>
30
31   {% if book.other_versions.exists %}
32     <li id="menu-other">
33       <a href="#" data-box="other">
34         <span class="label">{% trans "Other versions" %}</span>
35       </a>
36     </li>
37   {% endif %}
38
39   <li id="menu-toc">
40     <a href="#" data-box="wltoc">
41       <span class="label">{% trans "Table of contents" %}</span>
42     </a>
43   </li>
44
45   <li id="menu-themes">
46     <a href="#" data-box="themes">
47       <span class="label">{% trans "Themes" %}</span>
48     </a>
49   </li>
50
51   <li id="menu-nota_red">
52     <a href="#" data-box="nota_red">
53       <span class="label">{% trans "Edit. note" %}</span>
54     </a>
55   </li>
56
57   <li id="menu-info">
58     <a href="#info" data-box="info">
59       <span class="label">{% trans "Infobox" %}</span>
60     </a>
61   </li>
62
63   <a href="#" class="settings-switch" id="settings-line-numbers"
64      data-setting="always-hide-line-numbers"><span>{% trans "Numbering" %}</span></a>
65   <a href="#" class="settings-switch" id="settings-themes"
66      data-setting="always-hide-themes"><span>{% trans "Themes" %}</span></a>
67   <a href="#" class="settings-switch" id="settings-annotations"
68      data-setting="no-annotations"><span>{% trans "Footnotes" %}</span></a>
69   <a href="#" class="settings-switch" id="settings-references"
70      data-setting="no-references"><span>{% trans "References" %}</span></a>
71
72 {% endblock menu %}
73
74
75 {% block big-pane %}
76
77   <article id="main-text">
78     {% with next=book.get_next_text prev=book.get_prev_text %}
79       {% if next %}
80         <a style="float:right; padding: 1em;" href="{% url 'book_text' next.slug %}">{{ next.title }}&nbsp;&rarr;</a>
81       {% endif %}
82       {% if prev %}
83         <a style="display:inline-block;padding: 1em;" href="{% url 'book_text' prev.slug %}">&larr;&nbsp;{{ prev.title }}</a>
84       {% endif %}
85       <div style="clear:both;"></div>
86       {{ book_text|safe }}
87     {% endwith %}
88   </article>
89
90
91
92   <article id="other-text">
93     <a class="other-text-close" href="#">{% trans "Close" %}</a>
94     <div id="other-text-waiter">{% trans "Please wait..." %}</div>
95     <div id="other-text-body" style="display: none;"></div>
96   </article>
97
98   <div id="reference-box">
99     <div id="reference-map"></div>
100     <a id="reference-close" href="#">x</a>
101     <div id="reference-images">
102     </div>
103     <a id="reference-link" target="_blank"></a>
104   </div>
105
106
107
108 {% endblock big-pane %}
109
110 {% block footer %}
111   <div id="wltoc" class="box">
112     {% if book.parent %}
113       {% for b in book.ancestor.all %}
114         {% if forloop.counter > 1 %}
115           <li>
116         {% endif %}
117         <a href="{{ b.get_absolute_url }}">{{ b.title }}</a>
118         <ol>
119       {% endfor %}
120         {% for b in book.get_siblings %}
121           <li>
122             {% if b == book %}
123               <strong>{{ b.title }}</strong>
124               <div id="heretoc"></div>
125             {% else %}
126               <a href="{% url 'book_text' b.get_first_text.slug %}">{{ b.title }}</a>
127             {% endif %}
128           </li>
129         {% endfor %}
130
131         {% for b in book.ancestor.all %}
132         </ol>
133         {% if not forloop.counter.last %}
134           </li>
135         {% endif %}
136         {% endfor %}
137     {% else %}
138       <strong>{{ book.title }}</strong>
139       <div id="heretoc"></div>
140     {% endif %}
141   </div>
142
143   <div id="info" class="box">
144       {% book_info book %}
145   </div>
146
147   {% if book.other_versions.exists %}
148     <div class="box" id="other">
149       <h2>{% trans "Other versions of the book" %}</h2>
150       <a class="other-text-close" href="#">{% trans "Close the other version" %}</a>
151       <ul>
152         {% spaceless %}
153           {% for other_version in book.other_versions %}
154             <li>
155               <a class="display-other"
156                  data-other="{{ other_version.html_url }}"
157                  href="{% url 'book_text' other_version.slug %}">
158                 {{ other_version.mini_box_nolink }}
159               </a>
160             </li>
161           {% endfor %}
162         {% endspaceless %}
163       </ul>
164     </div>
165   {% endif %}
166
167   <div class="box" id="book-short">
168     {% include 'catalogue/book_short.html' %}
169   </div>
170
171   <div id="annoy-stubs">
172     {% annoy_banners 'book-text-intermission' %}
173
174     {% for insert in inserts %}
175       {% include 'annoy/dynamic_insert.html' %}
176     {% endfor %}
177   </div>
178
179   {% localize off %}
180   <script type="application/json" id="interesting-references">
181    {
182        {% for ref in book.reference_set.all %}
183        {% if ref.entity.is_interesting %}
184        "{{ ref.entity.uri }}": {
185            {% if ref.entity.lat and ref.entity.lon %}
186            "location": [{{ ref.entity.lat }}, {{ ref.entity.lon }}],
187            {% endif %}
188            "images": {{ ref.entity.images|safe }},
189            "label": "{{ ref.entity.label }}",
190            "description": "{{ ref.entity.description }}",
191            "wikipedia_link": "{{ ref.entity.wikipedia_link }}"
192        }{% if not forloop.last %},{% endif %}
193        {% endif %}
194        {% endfor %}
195   }
196   </script>
197   {% endlocalize %}
198 {% endblock footer %}