Cover quick import.
[redakcja.git] / src / documents / templates / documents / book_detail.html
1 {% extends "documents/base.html" %}
2 {% load book_list i18n %}
3 {% load bootstrap4 %}
4
5
6 {% block titleextra %}{{ book.title }}{% endblock %}
7
8
9 {% block content %}
10
11   <div class="card mt-4">
12     <div class="card-header">
13       <h1>{{ book.title }}</h1>
14     </div>
15     <div class="card-body">
16       <div class="row">
17         <div class="col-md-8">
18
19
20 {% if editable %}<form method='POST'>{% csrf_token %}{% endif %}
21     {% bootstrap_form form %}
22         {% if editable %}
23         {% buttons %}
24         <button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
25         {% endbuttons %}
26     {% endif %}
27 {% if editable %}</form>{% endif %}
28
29 {% if editable %}
30     {% if book.gallery %}
31     <p><a href="{% url 'documents_book_gallery' book.slug %}">{% trans "Edit gallery" %}</a></p>
32     {% endif %}
33
34     <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>
35 {% endif %}
36
37
38         </div>
39         <div class="col-md-4">
40           {% with cbook=book.catalogue_book %}
41             {% if cbook %}
42               W katalogu:
43               <a href="{% url 'catalogue_book' cbook.slug %}">{{ cbook }}</a>
44             {% endif %}
45           {% endwith %}
46         </div>
47       </div>
48     </div>
49   </div>
50
51   <div class="card mt-4">
52     <div class="card-header">
53       <h2>{% trans "Chunks" %}</h2>
54     </div>
55     <div class="card-body">
56
57     <table class='single-book-list table'><tbody>
58     {% for chunk in book %}
59         {% include 'documents/book_list/chunk.html' %}
60     {% endfor %}
61     </tbody></table>
62     </div>
63   </div>
64
65
66
67
68 <div class='card mt-4'>
69
70 <div class="card-header">
71   <h2>{% trans "Publication" %}</h2>
72   </div>
73 <div class="card-body">
74   <div class="row">
75 <div class="col-lg-3">
76 <img class="cover-preview" src="{% url 'cover_preview' book.slug %}" />
77 {% if book.dc_cover_image %}
78   <a href="{{ book.dc_cover_image.get_absolute_url }}">{{ book.dc_cover_image }}</a>
79 {% endif %}
80 <br><br>
81
82 <form action="{% url 'cover_quick_import' book.pk %}" method="post">
83   {% csrf_token %}
84   <input type="url" name="url">
85   <button type="submit" class="btn btn-sm btn-info">></button>
86 </form>
87
88
89 <br><br>
90 <form action="{% url 'cover_preview' book.slug %}">
91 <input type="hidden" name="download" value="1">
92 OkÅ‚adka w rozmiarze
93 <input name="width" type="number" required value="600"> x <input name="height" type="number" required value="833">
94 <button type="submit" class="btn btn-sm btn-primary">Pobierz</button>
95 </form>
96 </div>
97 <div class="col-lg-9">
98 <p>{% trans "Last published" %}:
99     {% if book.last_published %}
100         {{ book.last_published }}
101     {% else %}
102         &mdash;
103     {% endif %}
104 </p>
105
106 {% if publishable %}
107     <p>
108     <a href="{% url 'documents_book_xml' book.slug %}" rel="nofollow">{% trans "Full XML" %}</a><br/>
109     <a target="_blank" href="{% url 'documents_book_html' book.slug %}" rel="nofollow">{% trans "HTML version" %}</a><br/>
110     <a href="{% url 'documents_book_txt' book.slug %}" rel="nofollow">{% trans "TXT version" %}</a><br/>
111     <a href="{% url 'documents_book_pdf' book.slug %}" rel="nofollow">{% trans "PDF version" %}</a><br/>
112     <a href="{% url 'documents_book_pdf_mobile' book.slug %}" rel="nofollow">{% trans "PDF version for mobiles" %}</a><br/>
113     <a href="{% url 'documents_book_epub' book.slug %}" rel="nofollow">{% trans "EPUB version" %}</a><br/>
114     <a href="{% url 'documents_book_mobi' book.slug %}" rel="nofollow">{% trans "MOBI version" %}</a><br/>
115     </p>
116
117     {% if user.is_authenticated %}
118         <!--
119         Angel photos:
120         Angels in Ely Cathedral (http://www.flickr.com/photos/21804434@N02/4483220595/) /
121         mira66 (http://www.flickr.com/photos/21804434@N02/) /
122         CC BY 2.0 (http://creativecommons.org/licenses/by/2.0/)
123         -->
124         <form method="POST" action="{% url 'documents_publish' book.slug %}">{% csrf_token %}
125             {{ publish_options_form.as_p }}
126             <img src="{{ STATIC_URL }}img/angel-left.png" style="vertical-align: middle" />
127             <button id="publish-button" type="submit">
128                 <span>{% trans "Publish" %}</span></button>
129             <img src="{{ STATIC_URL }}img/angel-right.png" style="vertical-align: middle" />
130             </form>
131     {% else %}
132         <a href="{% url 'cas_ng_login' %}">{% trans "Log in to publish." %}</a>
133     {% endif %}
134 {% else %}
135     <p>{% trans "This book can't be published yet, because:" %}</p>
136     <ul><li>{{ publishable_error }}</li></ul>
137 {% endif %}
138
139 </div>
140   </div>
141 </div>
142 </div>
143
144 {% if doc %}
145   <div class="card mt-4">
146     <div class="card-header">
147       <h2>{% trans "Statistics" %}</h2>
148     </div>
149     <div class="card-body">
150       <table class="table">
151         <thead>
152           <tr>
153             <th>
154               {% trans "book" %}
155             </th>
156             <th>{% trans "characters" %}</th>
157             <th>{% trans "characters (with footnotes)" %}</th>
158             <th>{% trans "words" %}</th>
159             <th>{% trans "words (with footnotes)" %}</th>
160           </tr>
161         </thead>
162         <tbody>
163           {% with stats=book.wldocument.get_statistics %}
164             {% include 'documents/book_stats.html' with book=book stats=stats depth=0 %}
165           {% endwith %}
166         </tbody>
167       </table>
168     </div>
169   </div>
170 {% endif %}
171 {% endblock content %}