Minor visuals.
[wolnelektury.git] / src / catalogue / templates / catalogue / book_text.html
index 629cb5b..17c4896 100644 (file)
@@ -1,16 +1,27 @@
 {% extends "catalogue/viewer_base.html" %}
-{% load i18n %}
-{% load catalogue_tags ssify %}
+{% load i18n l10n %}
+{% load catalogue_tags %}
+{% load chunks %}
 {% load thumbnail %}
-{% load cache %}
+{% load annoy_banners from annoy %}
 
 
 {% block title %}{{ book.pretty_title }}{% endblock %}
 
 
+{% block extrahead %}
+   <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
+   integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
+         crossorigin=""/>
+    <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
+   integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
+   crossorigin=""></script>
+{% endblock %}
+
 {% block menu %}
   <li>
     <a href="{{ book.get_absolute_url }}" id="menu-book" data-box="book-short">
+      <span class="label">{% trans "Click to download" %}:</span>
       <img src="{% if book.cover_thumb %}{% thumbnail book.cover_thumb '240x332' as thumb %}{{ thumb.url }}{% empty %}{{ book.cover_thumb.url }}{% endthumbnail %}{% endif %}"
            width="120" height="166"
            alt="{{ book.pretty_title }}"
@@ -27,7 +38,7 @@
   {% endif %}
 
   <li id="menu-toc">
-    <a href="#" data-box="toc">
+    <a href="#" data-box="wltoc">
       <span class="label">{% trans "Table of contents" %}</span>
     </a>
   </li>
     </a>
   </li>
 
-  <li id="menu-settings">
-    <a href="#" data-box="settings">
-      <span class="label">{% trans "Settings" %}</span>
-    </a>
-  </li>
-
   <li id="menu-nota_red">
     <a href="#" data-box="nota_red">
       <span class="label">{% trans "Edit. note" %}</span>
       <span class="label">{% trans "Infobox" %}</span>
     </a>
   </li>
+
+  <a href="#" class="settings-switch" id="settings-line-numbers"
+     data-setting="always-hide-line-numbers"><span>{% trans "Numbering" %}</span></a>
+  <a href="#" class="settings-switch" id="settings-themes"
+     data-setting="always-hide-themes"><span>{% trans "Themes" %}</span></a>
+  <a href="#" class="settings-switch" id="settings-annotations"
+     data-setting="no-annotations"><span>{% trans "Footnotes" %}</span></a>
+  <a href="#" class="settings-switch" id="settings-references"
+     data-setting="no-references"><span>{% trans "References" %}</span></a>
+
 {% endblock menu %}
 
 
 {% block big-pane %}
+
   <article id="main-text">
-    <!--#include file='{{ book.html_file.url }}'-->
+    {% with next=book.get_next_text prev=book.get_prev_text %}
+      {% if next %}
+        <a style="float:right; padding: 1em;" href="{% url 'book_text' next.slug %}">{{ next.title }}&nbsp;&rarr;</a>
+      {% endif %}
+      {% if prev %}
+        <a style="display:inline-block;padding: 1em;" href="{% url 'book_text' prev.slug %}">&larr;&nbsp;{{ prev.title }}</a>
+      {% endif %}
+      <div style="text-align:center; margin-top:1em;">
+      {% content_warning book %}
+      </div>
+      <div style="clear:both;"></div>
+      {{ book_text|safe }}
+    {% endwith %}
   </article>
 
+
+
   <article id="other-text">
     <a class="other-text-close" href="#">{% trans "Close" %}</a>
     <div id="other-text-waiter">{% trans "Please wait..." %}</div>
     <div id="other-text-body" style="display: none;"></div>
   </article>
-{% endblock big-pane %}
+
+  <div id="reference-box">
+    <div id="reference-map"></div>
+    <a id="reference-close" href="#">x</a>
+    <div id="reference-images">
+    </div>
+    <a id="reference-link" target="_blank"></a>
+  </div>
+
 
 
+{% endblock big-pane %}
+
 {% block footer %}
+  <div id="wltoc" class="box">
+    {% if book.parent %}
+      {% for b in book.ancestor.all %}
+        {% if forloop.counter > 1 %}
+          <li>
+        {% endif %}
+        <a href="{{ b.get_absolute_url }}">{{ b.title }}</a>
+        <ol>
+      {% endfor %}
+        {% for b in book.get_siblings %}
+          <li>
+            {% if b == book %}
+              <strong>{{ b.title }}</strong>
+              <div id="heretoc"></div>
+            {% else %}
+              <a href="{% url 'book_text' b.get_first_text.slug %}">{{ b.title }}</a>
+            {% endif %}
+          </li>
+        {% endfor %}
+
+        {% for b in book.ancestor.all %}
+        </ol>
+        {% if not forloop.counter.last %}
+          </li>
+        {% endif %}
+        {% endfor %}
+    {% else %}
+      <strong>{{ book.title }}</strong>
+      <div id="heretoc"></div>
+    {% endif %}
+  </div>
+
   <div id="info" class="box">
       {% book_info book %}
   </div>
           {% for other_version in book.other_versions %}
             <li>
               <a class="display-other"
-                 data-other="{{ other_version.html_file.url }}"
+                 data-other="{{ other_version.html_url }}"
                  href="{% url 'book_text' other_version.slug %}">
-                {% cache 86400 book_mini_box other_version.pk %}
-                  {% include 'catalogue/book_mini_box.html' with book=other_version no_link=True %}
-                {% endcache %}
-                {#% ssi_include 'catalogue_book_mini_nolink' pk=other_version.pk %#}
+                {{ other_version.mini_box_nolink }}
               </a>
             </li>
           {% endfor %}
     </div>
   {% endif %}
 
-  <div class="box" id="settings">
-    <h2>{% trans "Settings" %}</h2>
-    <a href="#" class="settings-switch" id="settings-line-numbers"
-       data-setting="always-hide-line-numbers">{% trans "Display line numbers" %}</a><br/>
-    <a href="#" class="settings-switch" id="settings-themes"
-       data-setting="always-hide-themes">{% trans "Display themes" %}</a><br/>
-    <a href="#" class="settings-switch" id="settings-annotations"
-       data-setting="no-annotations">{% trans "Display footnotes" %}</a><br/>
+  <div class="box" id="book-short">
+    {% include 'catalogue/book_short.html' %}
   </div>
 
-  <div class="box" id="book-short">
-    {% ssi_include 'catalogue_book_short' pk=book.pk %}
+  <div id="annoy-stubs">
+    {% annoy_banners 'book-text-intermission' %}
+
+    {% for insert in inserts %}
+      {% include 'annoy/dynamic_insert.html' %}
+    {% endfor %}
   </div>
+
+  {% localize off %}
+  <script type="application/json" id="interesting-references">
+   {
+       {% for ref in book.references %}
+       {% if ref.entity.is_interesting %}
+       "{{ ref.entity.uri }}": {
+           {% if ref.entity.lat and ref.entity.lon %}
+           "location": [{{ ref.entity.lat }}, {{ ref.entity.lon }}],
+           {% endif %}
+           "images": {{ ref.entity.images|safe }},
+           "label": "{{ ref.entity.label }}",
+           "description": "{{ ref.entity.description }}",
+           "wikipedia_link": "{{ ref.entity.wikipedia_link }}"
+       }{% if not forloop.last %},{% endif %}
+       {% endif %}
+       {% endfor %}
+  }
+  </script>
+  {% endlocalize %}
 {% endblock footer %}