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