New covers.
[redakcja.git] / src / documents / templates / documents / book_detail.html
index 3dbaf21..ee053d5 100644 (file)
@@ -13,7 +13,8 @@
       <h1>{{ book.title }}</h1>
     </div>
     <div class="card-body">
-    
+      <div class="row">
+       <div class="col-md-8">
 
 
 {% if editable %}<form method='POST'>{% csrf_token %}{% endif %}
 
     <p style="text-align:right"><a class="btn btn-sm btn-danger" href="{% url 'documents_book_append' book.slug %}">{% trans "Append to other book" %}</a></p>
 {% endif %}
+
+
+       </div>
+       <div class="col-md-4">
+          {% with cbook=book.catalogue_book %}
+            {% if cbook %}
+             W katalogu:
+             <a href="{% url 'catalogue_book' cbook.slug %}">{{ cbook }}</a>
+            {% endif %}
+          {% endwith %}
+       </div>
+      </div>
     </div>
-    </div>
+  </div>
 
   <div class="card mt-4">
     <div class="card-header">
   </div>
 <div class="card-body">
   <div class="row">
-<div class="col-lg-3">
-<img class="cover-preview" src="{% url 'cover_preview' book.slug %}" />
-{% if book.dc_cover_image %}
-    <a href="{{ book.dc_cover_image.get_absolute_url }}">{{ book.dc_cover_image }}</a>
-{% endif %}
-<br><br>
-<form action="{% url 'cover_preview' book.slug %}">
-<input type="hidden" name="download" value="1">
-Okładka w rozmiarze
-<input name="width" type="number" required value="600"> x <input name="height" type="number" required value="833">
-<button type="submit" class="btn btn-sm btn-primary">Pobierz</button>
-</form>
-</div>
-<div class="col-lg-9">
-<p>{% trans "Last published" %}: 
+    <div class="col-lg-3">
+      <img class="cover-preview" src="{% url 'cover_preview' book.slug %}" />
+      {% if book.dc_cover_image %}
+        <a href="{{ book.dc_cover_image.get_absolute_url }}">{{ book.dc_cover_image }}</a>
+      {% endif %}
+      <br><br>
+
+      <form action="{% url 'cover_quick_import' book.pk %}" method="post">
+        {% csrf_token %}
+        <div class="input-group">
+          <input type="url" name="url" class="form-control" placeholder="URL okładki">
+          <button type="submit" class="btn btn-sm btn-info">Ustaw</button>
+        </div>
+      </form>
+
+
+      <br><br>
+      <form action="{% url 'cover_preview' book.slug %}">
+        <input type="hidden" name="download" value="1">
+        Pobierz okładkę:
+        <div class="input-group">
+          <select class="form-control" name='cover_class'>
+           <option value="default">nowa</option>
+           <option value="m-label">nowa + label</option>
+            <option value="legacy">dawna</option>
+          </select><br>
+          <input class="form-control" name="width" type="number" required value="600" size="3" placeholder="szer.">
+          <input class="form-control" name="height" type="number" size="3" placeholder="wys.">
+          <button type="submit" class="btn btn-sm btn-primary">🡇</button>
+        </div>
+      </form>
+    </div>
+    <div class="col-lg-9">
+<p>{% trans "Last published" %}:
     {% if book.last_published %}
         {{ book.last_published }}
     {% else %}
@@ -103,9 +135,39 @@ Okładka w rozmiarze
             {{ publish_options_form.as_p }}
             <img src="{{ STATIC_URL }}img/angel-left.png" style="vertical-align: middle" />
             <button id="publish-button" type="submit">
-                <span>{% trans "Publish" %}</span></button>
+              <span>{% trans "Publish" %}</span></button>
             <img src="{{ STATIC_URL }}img/angel-right.png" style="vertical-align: middle" />
-            </form>
+        </form>
+
+        {% if perms.depot.add_legimibookpublish %}
+          <hr>
+          {% with thema=doc.book_info.thema %}
+            {% if thema %}
+              <form method="post" action="{% url 'depot_legimi_publish' book.pk %}">
+                {% csrf_token %}
+                <button class="btn btn-primary" type="submit">
+                  Opublikuj na Legimi<br><small>w kategorii:
+                  {% for t in thema %}
+                    <tt>{{ t }}</tt>
+                    {% if not forloop.last %}, {% endif %}
+                  {% endfor %}
+                  </small></button>
+                {% with llp=book.last_legimi_publish %}
+                  {% if llp %}
+                    {{ llp.created_at }} &rarr;
+                    {{ llp.started_at }} &rarr;
+                    {{ llp.finished_at }}
+                    ({{ llp.get_status_display }})
+                    <!-- {{ llp.id }} -->
+                  {% endif %}
+                {% endwith %}
+              </form>
+            {% else %}
+              <div class="alert alert-warning">Nie można opublikować na Legimi, ponieważ nie ustaiono kategorii Thema.</div>
+            {% endif %}
+          {% endwith %}
+        {% endif %}
+
     {% else %}
         <a href="{% url 'cas_ng_login' %}">{% trans "Log in to publish." %}</a>
     {% endif %}
@@ -114,6 +176,41 @@ Okładka w rozmiarze
     <ul><li>{{ publishable_error }}</li></ul>
 {% endif %}
 
+
+
+    </div>
+  </div>
+</div>
 </div>
+
+
+{% if doc %}
+  <div class="card mt-4">
+    <div class="card-header">
+      <h2>{% trans "Statistics" %}</h2>
+    </div>
+    <div class="card-body">
+      <table class="table">
+        <thead>
+          <tr>
+            <th>
+              {% trans "book" %}
+            </th>
+            <th>{% trans "characters" %}</th>
+            <th>{% trans "characters (with footnotes)" %}</th>
+            <th>{% trans "words" %}</th>
+            <th>{% trans "words (with footnotes)" %}</th>
+            <th>{% trans "wiersze (+ inne znaki)" %}</th>
+            <th>{% trans "wiersze (+ inne znaki, z przypisami)" %}</th>
+          </tr>
+        </thead>
+        <tbody>
+          {% with stats=doc.get_statistics %}
+            {% include 'documents/book_stats.html' with book=book stats=stats depth=0 %}
+          {% endwith %}
+        </tbody>
+      </table>
+    </div>
   </div>
+{% endif %}
 {% endblock content %}