b9dd6abe287f0ee85e622f3153b72d1e53ca6f42
[redakcja.git] / src / documents / templates / documents / book_detail.html
1 {% extends "documents/base.html" %}
2 {% load book_list i18n %}
3 {% load bootstrap4 %}
4 {% load depot %}
5 {% load isbn %}
6
7
8 {% block titleextra %}{{ book.title }}{% endblock %}
9
10
11 {% block content %}
12
13   <div class="card mt-4">
14     <div class="card-header">
15       <h1>{{ book.title }}</h1>
16     </div>
17     <div class="card-body">
18       <div class="row">
19         <div class="col-md-8">
20
21
22           {% if editable %}<form method='POST'>{% csrf_token %}{% endif %}
23             {% bootstrap_form form %}
24             {% if editable %}
25               {% buttons %}
26               <button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
27         {% endbuttons %}
28             {% endif %}
29             {% if editable %}</form>{% endif %}
30
31             {% if editable %}
32               {% if book.gallery %}
33                 <p><a href="{% url 'documents_book_gallery' book.slug %}">{% trans "Edit gallery" %}</a></p>
34               {% endif %}
35
36               <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>
37             {% endif %}
38
39
40         </div>
41         <div class="col-md-4">
42           {% with cbook=book.catalogue_book %}
43             {% if cbook %}
44               W katalogu:
45               <a href="{% url 'catalogue_book' cbook.slug %}">{{ cbook }}</a>
46             {% endif %}
47           {% endwith %}
48         </div>
49       </div>
50     </div>
51   </div>
52
53   <div class="card mt-4">
54     <div class="card-header">
55       <h2>{% trans "Chunks" %}</h2>
56     </div>
57     <div class="card-body">
58
59       <table class='single-book-list table'><tbody>
60         {% for chunk in book %}
61           {% include 'documents/book_list/chunk.html' %}
62         {% endfor %}
63       </tbody></table>
64     </div>
65   </div>
66
67
68
69
70   <div class='card mt-4'>
71
72     <div class="card-header">
73       <h2>
74         {% trans "Publication" %}
75         |
76         {% if book.project %}
77           {% if book.project.can_sell %}
78             <span title="Książka do sprzedaży">💶</span>
79           {% else %}
80             <span title="Książka nie do sprzedaży">🙅</span>
81           {% endif %}
82         {% else %}
83           <span title="Brak informacji o możliwości sprzedaży">❓</span>
84         {% endif %}
85         {% if has_audio %}
86           | 🎧
87           {% if can_sell_audio %}
88             <span title="Audiobook do sprzedaży">💶</span>
89           {% else %}
90             <span title="Audiobook nie do sprzedaży">🙅</span>
91           {% endif %}
92         {% endif %}
93       </h2>
94
95     </div>
96     <div class="card-body">
97       <div class="row">
98         <div class="col-lg-3">
99           <img class="cover-preview" src="{% url 'cover_preview' book.slug %}" />
100           {% if book.dc_cover_image %}
101             <a href="{{ book.dc_cover_image.get_absolute_url }}">{{ book.dc_cover_image }}</a>
102           {% endif %}
103           <br><br>
104
105           <form action="{% url 'cover_quick_import' book.pk %}" method="post">
106             {% csrf_token %}
107             <div class="input-group">
108               <input type="url" name="url" class="form-control" placeholder="URL okładki">
109               <button type="submit" class="btn btn-sm btn-info">Ustaw</button>
110             </div>
111           </form>
112
113
114           <br><br>
115           <form action="{% url 'cover_preview' book.slug %}">
116             <input type="hidden" name="download" value="1">
117             Pobierz okładkę:
118             <div class="input-group">
119               <select class="form-control" name='cover_class'>
120                 <option value="default">nowa</option>
121                 <option value="m-label">nowa + label</option>
122                 <option value="legacy">dawna</option>
123               </select><br>
124               <input class="form-control" name="width" type="number" required value="600" size="3" placeholder="szer.">
125               <input class="form-control" name="height" type="number" size="3" placeholder="wys.">
126               <button type="submit" class="btn btn-sm btn-primary">🡇</button>
127             </div>
128           </form>
129         </div>
130         <div class="col-lg-9">
131           <p>{% trans "Last published" %}:
132             {% if book.last_published %}
133               {{ book.last_published }}
134             {% else %}
135               &mdash;
136             {% endif %}
137           </p>
138
139           {% if publishable %}
140             <p>
141               <a href="{% url 'documents_book_xml' book.slug %}" rel="nofollow">{% trans "Full XML" %}</a><br/>
142               <a target="_blank" href="{% url 'documents_book_html' book.slug %}" rel="nofollow">{% trans "HTML version" %}</a><br/>
143               <a href="{% url 'documents_book_txt' book.slug %}" rel="nofollow">{% trans "TXT version" %}</a><br/>
144               <a href="{% url 'documents_book_pdf' book.slug %}" rel="nofollow">{% trans "PDF version" %}</a><br/>
145               <a href="{% url 'documents_book_pdf_mobile' book.slug %}" rel="nofollow">{% trans "PDF version for mobiles" %}</a><br/>
146               <a href="{% url 'documents_book_epub' book.slug %}" rel="nofollow">{% trans "EPUB version" %}</a>
147               <a href="{% url 'documents_book_epubcheck' book.slug %}" rel="nofollow">sprawdź</a><br/>
148               <a href="{% url 'documents_book_mobi' book.slug %}" rel="nofollow">{% trans "MOBI version" %}</a><br/>
149             </p>
150
151             <p><a href="./synchro">Sprawdź synchronizację</a></p>
152
153             {% isbn_status book %}
154
155             {% if user.is_authenticated %}
156               <!--
157                    Angel photos:
158                    Angels in Ely Cathedral (http://www.flickr.com/photos/21804434@N02/4483220595/) /
159                    mira66 (http://www.flickr.com/photos/21804434@N02/) /
160                    CC BY 2.0 (http://creativecommons.org/licenses/by/2.0/)
161               -->
162               <form method="POST" action="{% url 'documents_publish' book.slug %}">{% csrf_token %}
163                 {{ publish_options_form.as_p }}
164                 <img src="{{ STATIC_URL }}img/angel-left.png" style="vertical-align: middle" />
165                 <button id="publish-button" type="submit">
166                   <span>{% trans "Publish" %}</span></button>
167                 <img src="{{ STATIC_URL }}img/angel-right.png" style="vertical-align: middle" />
168               </form>
169
170
171               {% if perms.depot.add_sitebookpublish %}
172                 {% depot_sites book as sites %}
173                 {% for site in sites %}
174                   <hr>
175                   <h3 class="mb-3">{{ site.name }}</h3>
176                   {% if not site.errors %}
177                     <form method="post" action="{% url 'depot_site_publish' site.site_id book.pk %}">
178                       {% csrf_token %}
179                       <button class="btn btn-primary mb-3" type="submit">
180                         Opublikuj na {{ site.name }}
181                       </button>
182                     </form>
183                     {% for info in site.info %}
184                       <div class="alert alert-info">
185                         {{ info }}
186                       </div>
187                     {% endfor %}
188                   {% else %}
189                     {% for error in site.errors %}
190                       <div class="alert alert-danger">
191                         {{ error }}
192                       </div>
193                     {% endfor %}
194                   {% endif %}
195                   {% for warning in site.warnings %}
196                     <div class="alert alert-warning">
197                       {{ warning }}
198                     </div>
199                   {% endfor %}
200                   {% if site.id %}
201                     id:{{ site.id }}
202                   {% endif %}
203                   {% with last=site.last %}
204                   {% if last %}
205                     {{ last.created_at }} &rarr;
206                     {{ last.started_at }} &rarr;
207                     {{ last.finished_at }}
208                     <span title="{{ last.error }}">
209                       ({{ last.get_status_display }})
210                     </span>
211                     <!-- {{ site.last.id }} -->
212                   {% endif %}
213                   {% endwith %}
214                 {% endfor %}
215               {% endif %}
216
217             {% else %}
218               <a href="{% url 'cas_ng_login' %}">{% trans "Log in to publish." %}</a>
219             {% endif %}
220           {% else %}
221             <p>{% trans "This book can't be published yet, because:" %}</p>
222             <ul><li>{{ publishable_error }}</li></ul>
223           {% endif %}
224         </div>
225       </div>
226     </div>
227   </div>
228
229
230   {% if stats %}
231     <div class="card mt-4">
232       <div class="card-header">
233         <h2>{% trans "Statistics" %}</h2>
234       </div>
235       <div class="card-body">
236         <table class="table">
237           <thead>
238             <tr>
239               <th>
240                 {% trans "book" %}
241               </th>
242               <th>{% trans "characters" %}</th>
243               <th>{% trans "characters (with footnotes)" %}</th>
244               <th>{% trans "words" %}</th>
245               <th>{% trans "words (with footnotes)" %}</th>
246               <th>{% trans "wiersze (+ inne znaki)" %}</th>
247               <th>{% trans "wiersze (+ inne znaki, z przypisami)" %}</th>
248             </tr>
249           </thead>
250           <tbody>
251             {% include 'documents/book_stats.html' with book=doc stats=stats depth=0 %}
252         </tbody>
253       </table>
254     </div>
255   </div>
256 {% endif %}
257 {% endblock content %}