caa3de5231bbdfb77bcc6fcfe45c8f9158402926
[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         <div class="input-group">
85           <input type="url" name="url" class="form-control" placeholder="URL okładki">
86           <button type="submit" class="btn btn-sm btn-info">Ustaw</button>
87         </div>
88       </form>
89
90
91       <br><br>
92       <form action="{% url 'cover_preview' book.slug %}">
93         <input type="hidden" name="download" value="1">
94         Pobierz okładkę:
95         <div class="input-group">
96           <select class="form-control" name='cover_class'>
97             <option value="default">nowa</option>
98             <option value="m-label">nowa + label</option>
99             <option value="legacy">dawna</option>
100           </select><br>
101           <input class="form-control" name="width" type="number" required value="600" size="3" placeholder="szer.">
102           <input class="form-control" name="height" type="number" size="3" placeholder="wys.">
103           <button type="submit" class="btn btn-sm btn-primary">🡇</button>
104         </div>
105       </form>
106     </div>
107     <div class="col-lg-9">
108 <p>{% trans "Last published" %}:
109     {% if book.last_published %}
110         {{ book.last_published }}
111     {% else %}
112         &mdash;
113     {% endif %}
114 </p>
115
116 {% if publishable %}
117     <p>
118     <a href="{% url 'documents_book_xml' book.slug %}" rel="nofollow">{% trans "Full XML" %}</a><br/>
119     <a target="_blank" href="{% url 'documents_book_html' book.slug %}" rel="nofollow">{% trans "HTML version" %}</a><br/>
120     <a href="{% url 'documents_book_txt' book.slug %}" rel="nofollow">{% trans "TXT version" %}</a><br/>
121     <a href="{% url 'documents_book_pdf' book.slug %}" rel="nofollow">{% trans "PDF version" %}</a><br/>
122     <a href="{% url 'documents_book_pdf_mobile' book.slug %}" rel="nofollow">{% trans "PDF version for mobiles" %}</a><br/>
123     <a href="{% url 'documents_book_epub' book.slug %}" rel="nofollow">{% trans "EPUB version" %}</a><br/>
124     <a href="{% url 'documents_book_mobi' book.slug %}" rel="nofollow">{% trans "MOBI version" %}</a><br/>
125     </p>
126
127     {% if user.is_authenticated %}
128         <!--
129         Angel photos:
130         Angels in Ely Cathedral (http://www.flickr.com/photos/21804434@N02/4483220595/) /
131         mira66 (http://www.flickr.com/photos/21804434@N02/) /
132         CC BY 2.0 (http://creativecommons.org/licenses/by/2.0/)
133         -->
134         <form method="POST" action="{% url 'documents_publish' book.slug %}">{% csrf_token %}
135             {{ publish_options_form.as_p }}
136             <img src="{{ STATIC_URL }}img/angel-left.png" style="vertical-align: middle" />
137             <button id="publish-button" type="submit">
138               <span>{% trans "Publish" %}</span></button>
139             <img src="{{ STATIC_URL }}img/angel-right.png" style="vertical-align: middle" />
140         </form>
141
142         {% if perms.depot.add_legimibookpublish %}
143           <hr>
144           {% with thema_main=doc.book_info.thema_main thema=doc.book_info.thema %}
145             {% if thema_main or thema %}
146               <form method="post" action="{% url 'depot_legimi_publish' book.pk %}">
147                 {% csrf_token %}
148                 <button class="btn btn-primary" type="submit">
149                   Opublikuj na Legimi<br><small>w kategorii:
150                   {% if thema_main %}
151                     <tt>{{ thema_main }}</tt>
152                   {% endif %}
153                   {% for t in thema %}
154                     {% if forloop.first and thema_main %}oraz: {% endif %}
155                     <tt>{{ t }}</tt>
156                     {% if not forloop.last %}, {% endif %}
157                   {% endfor %}
158                   {% if not thema_main %}
159                     <span class="badge badge-secondary" title="Nie ustalono głównej kategorii Thema">&nbsp;*&nbsp;</small>
160                   {% endif %}
161                   </small></button>
162                 {% with llp=book.last_legimi_publish %}
163                   {% if llp %}
164                     {{ llp.created_at }} &rarr;
165                     {{ llp.started_at }} &rarr;
166                     {{ llp.finished_at }}
167                     ({{ llp.get_status_display }})
168                     <!-- {{ llp.id }} -->
169                   {% endif %}
170                 {% endwith %}
171               </form>
172             {% else %}
173               <div class="alert alert-warning">Nie można opublikować na Legimi, ponieważ nie ustalono kategorii Thema.</div>
174             {% endif %}
175           {% endwith %}
176         {% endif %}
177
178     {% else %}
179         <a href="{% url 'cas_ng_login' %}">{% trans "Log in to publish." %}</a>
180     {% endif %}
181 {% else %}
182     <p>{% trans "This book can't be published yet, because:" %}</p>
183     <ul><li>{{ publishable_error }}</li></ul>
184 {% endif %}
185
186
187
188     </div>
189   </div>
190 </div>
191 </div>
192
193
194 {% if doc %}
195   <div class="card mt-4">
196     <div class="card-header">
197       <h2>{% trans "Statistics" %}</h2>
198     </div>
199     <div class="card-body">
200       <table class="table">
201         <thead>
202           <tr>
203             <th>
204               {% trans "book" %}
205             </th>
206             <th>{% trans "characters" %}</th>
207             <th>{% trans "characters (with footnotes)" %}</th>
208             <th>{% trans "words" %}</th>
209             <th>{% trans "words (with footnotes)" %}</th>
210             <th>{% trans "wiersze (+ inne znaki)" %}</th>
211             <th>{% trans "wiersze (+ inne znaki, z przypisami)" %}</th>
212           </tr>
213         </thead>
214         <tbody>
215           {% with stats=doc.get_statistics %}
216             {% include 'documents/book_stats.html' with book=book stats=stats depth=0 %}
217           {% endwith %}
218         </tbody>
219       </table>
220     </div>
221   </div>
222 {% endif %}
223 {% endblock content %}