a286302fe4486dfe5914cd2f45ca1220ce4d74f6
[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><br/>
126               <a href="{% url 'documents_book_mobi' book.slug %}" rel="nofollow">{% trans "MOBI version" %}</a><br/>
127             </p>
128
129             {% isbn_status book %}
130
131             {% if user.is_authenticated %}
132               <!--
133                    Angel photos:
134                    Angels in Ely Cathedral (http://www.flickr.com/photos/21804434@N02/4483220595/) /
135                    mira66 (http://www.flickr.com/photos/21804434@N02/) /
136                    CC BY 2.0 (http://creativecommons.org/licenses/by/2.0/)
137               -->
138               <form method="POST" action="{% url 'documents_publish' book.slug %}">{% csrf_token %}
139                 {{ publish_options_form.as_p }}
140                 <img src="{{ STATIC_URL }}img/angel-left.png" style="vertical-align: middle" />
141                 <button id="publish-button" type="submit">
142                   <span>{% trans "Publish" %}</span></button>
143                 <img src="{{ STATIC_URL }}img/angel-right.png" style="vertical-align: middle" />
144               </form>
145
146
147               {% if perms.depot.add_sitebookpublish %}
148                 {% depot_sites book as sites %}
149                 {% for site in sites %}
150                   <hr>
151                   <h3 class="mb-3">{{ site.name }}</h3>
152                   {% if not site.errors %}
153                     <form method="post" action="{% url 'depot_site_publish' site.site_id book.pk %}">
154                       {% csrf_token %}
155                       <button class="btn btn-primary mb-3" type="submit">
156                         Opublikuj na {{ site.name }}
157                       </button>
158                     </form>
159                     {% for info in site.info %}
160                       <div class="alert alert-info">
161                         {{ info }}
162                       </div>
163                     {% endfor %}
164                   {% else %}
165                     {% for error in site.errors %}
166                       <div class="alert alert-danger">
167                         {{ error }}
168                       </div>
169                     {% endfor %}
170                   {% endif %}
171                   {% for warning in site.warnings %}
172                     <div class="alert alert-warning">
173                       {{ warning }}
174                     </div>
175                   {% endfor %}
176                   {% if site.id %}
177                     id:{{ site.id }}
178                   {% endif %}
179                   {% with last=site.last %}
180                   {% if last %}
181                     {{ last.created_at }} &rarr;
182                     {{ last.started_at }} &rarr;
183                     {{ last.finished_at }}
184                     <span title="{{ last.error }}">
185                       ({{ last.get_status_display }})
186                     </span>
187                     <!-- {{ site.last.id }} -->
188                   {% endif %}
189                   {% endwith %}
190                 {% endfor %}
191               {% endif %}
192
193             {% else %}
194               <a href="{% url 'cas_ng_login' %}">{% trans "Log in to publish." %}</a>
195             {% endif %}
196           {% else %}
197             <p>{% trans "This book can't be published yet, because:" %}</p>
198             <ul><li>{{ publishable_error }}</li></ul>
199           {% endif %}
200         </div>
201       </div>
202     </div>
203   </div>
204
205
206   {% if stats %}
207     <div class="card mt-4">
208       <div class="card-header">
209         <h2>{% trans "Statistics" %}</h2>
210       </div>
211       <div class="card-body">
212         <table class="table">
213           <thead>
214             <tr>
215               <th>
216                 {% trans "book" %}
217               </th>
218               <th>{% trans "characters" %}</th>
219               <th>{% trans "characters (with footnotes)" %}</th>
220               <th>{% trans "words" %}</th>
221               <th>{% trans "words (with footnotes)" %}</th>
222               <th>{% trans "wiersze (+ inne znaki)" %}</th>
223               <th>{% trans "wiersze (+ inne znaki, z przypisami)" %}</th>
224             </tr>
225           </thead>
226           <tbody>
227             {% include 'documents/book_stats.html' with book=doc stats=stats depth=0 %}
228         </tbody>
229       </table>
230     </div>
231   </div>
232 {% endif %}
233 {% endblock content %}