Use unmanaged keys instead of some magic.
[redakcja.git] / src / catalogue / templates / catalogue / book_detail.html
old mode 100755 (executable)
new mode 100644 (file)
index 60e426d..85cfcc9
-{% extends "catalogue/base.html" %}
-{% load book_list i18n %}
+{% extends "documents/base.html" %}
 
+{% load i18n %}
+{% load pagination_tags %}
 
-{% block titleextra %}{{ book.title }}{% endblock %}
 
-
-{% block content %}
-
-
-<h1>{{ book.title }}</h1>
-
-
-{% if editable %}<form method='POST'>{% csrf_token %}{% endif %}
-<table class='editable'><tbody>
-    {{ form.as_table }}
-    {% if editable %}
-        <tr><td></td><td><button type="submit">{% trans "Save" %}</button></td></tr>
-    {% endif %}
-</tbody></table>
-{% if editable %}</form>{% endif %}
-
-{% if editable %}
-    {% if book.gallery %}
-    <p><a href="{% url 'catalogue_book_gallery' book.slug %}">{% trans "Edit gallery" %}</a></p>
-    {% endif %}
-
-    <p><a href="{% url 'catalogue_book_append' book.slug %}">{% trans "Append to other book" %}</a></p>
-{% endif %}
-
-
-<div class='section'>
-
-    <h2>{% trans "Chunks" %}</h2>
-
-    <table class='single-book-list'><tbody>
-    {% for chunk in book %}
-        {% include 'catalogue/book_list/chunk.html' %}
-    {% endfor %}
-    </tbody></table>
-
-</div>
-
-
-
-<div class='section'>
-
-
-<h2>{% trans "Publication" %}</h2>
-
-<div class="cover-preview">
-<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 %}
-</div>
-
-<p>{% trans "Last published" %}: 
-    {% if book.last_published %}
-        {{ book.last_published }}
-    {% else %}
-        &mdash;
-    {% endif %}
-</p>
-
-{% if publishable %}
-    <p>
-    <a href="{% url 'catalogue_book_xml' book.slug %}" rel="nofollow">{% trans "Full XML" %}</a><br/>
-    <a target="_blank" href="{% url 'catalogue_book_html' book.slug %}" rel="nofollow">{% trans "HTML version" %}</a><br/>
-    <a href="{% url 'catalogue_book_txt' book.slug %}" rel="nofollow">{% trans "TXT version" %}</a><br/>
-    <a href="{% url 'catalogue_book_pdf' book.slug %}" rel="nofollow">{% trans "PDF version" %}</a><br/>
-    <a href="{% url 'catalogue_book_pdf_mobile' book.slug %}" rel="nofollow">{% trans "PDF version for mobiles" %}</a><br/>
-    <a href="{% url 'catalogue_book_epub' book.slug %}" rel="nofollow">{% trans "EPUB version" %}</a><br/>
-    <a href="{% url 'catalogue_book_mobi' book.slug %}" rel="nofollow">{% trans "MOBI version" %}</a><br/>
-    </p>
-
-    {% if user.is_authenticated %}
-        <!--
-        Angel photos:
-        Angels in Ely Cathedral (http://www.flickr.com/photos/21804434@N02/4483220595/) /
-        mira66 (http://www.flickr.com/photos/21804434@N02/) /
-        CC BY 2.0 (http://creativecommons.org/licenses/by/2.0/)
-        -->
-        <form method="POST" action="{% url 'catalogue_publish' book.slug %}">{% csrf_token %}
-            {{ 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>
-            <img src="{{ STATIC_URL }}img/angel-right.png" style="vertical-align: middle" />
-            </form>
-    {% else %}
-        <a href="{% url 'cas_ng_login' %}">{% trans "Log in to publish." %}</a>
-    {% endif %}
-{% else %}
-    <p>{% trans "This book can't be published yet, because:" %}</p>
-    <ul><li>{{ publishable_error }}</li></ul>
-{% endif %}
-
-<div style="clear: both;"></div>
-</div>
+{% block titleextra %}{% trans "Catalogue" %}{% endblock %}
 
 
+{% block content %}
+  <div class="card">
+    <div class="card-header">
+      <h1>{% trans "Catalogue" %}</h1>
+    </div>
+    <div class="card-body">
+      <table class="table">
+        {% for author in book.authors.all %}
+          <tr>
+            <th>
+              <a href="{{ author.get_absolute_url }}">
+                {{ author }}
+              </a>
+            </th>
+            <td>
+              {{ author.pd_year|default_if_none:"-" }}
+            </td>
+            <td>
+              {{ author.wikidata_link }}
+            </td>
+            <td>
+              {{ author.get_priority_display }}
+            </td>
+          </tr>
+        {% endfor %}
+        {% for author in book.translator_set.all %}
+          <tr>
+            <th>
+              <a href="{{ author.get_absolute_url }}">
+                {{ author }}
+              </a>
+            </th>
+            <td>
+              {{ author.pd_year|default_if_none:"-" }}
+            </td>
+            <td>
+              {{ author.wikidata_link }}
+            </td>
+            <td>
+              {{ author.get_priority_display }}
+            </td>
+          </tr>
+        {% endfor %}
+        <tr>
+          <td>
+            &nbsp;
+            <a href="{{ book.get_absolute_url }}">
+              {{ book.title }}
+            </a>
+          </td>
+          <td>
+            {{ book.pd_year|default_if_none:"-" }}
+          </td>
+          <td>
+            {{ book.wikidata_link }}
+          </td>
+          <td>
+            {{ book.get_priorty_display }}
+          </td>
+          <td>
+            {% for b in book.document_books.all %}
+              <a href="{{ b.get_absolute_url }}">
+                {{ b }}
+              </a>
+            {% endfor %}
+          </td>
+        </tr>
+      </table>
+    </div>
+  </div>
 {% endblock content %}