From 636fd34b05155b81691222ad80c4a3746d0c2fc1 Mon Sep 17 00:00:00 2001
From: Jan Szejko
Date: Thu, 20 Dec 2018 12:42:49 +0100
Subject: [PATCH] mobile PDF option
---
.../catalogue/locale/pl/LC_MESSAGES/django.mo | Bin 7796 -> 7891 bytes
.../catalogue/locale/pl/LC_MESSAGES/django.po | 62 +++++++++---------
.../templates/catalogue/book_detail.html | 1 +
apps/catalogue/urls.py | 1 +
apps/catalogue/views.py | 5 +-
lib/librarian | 2 +-
6 files changed, 37 insertions(+), 34 deletions(-)
diff --git a/apps/catalogue/locale/pl/LC_MESSAGES/django.mo b/apps/catalogue/locale/pl/LC_MESSAGES/django.mo
index 8c88b6b0f57032ea8e4714db5e6b1d6715421fed..87bdfbf99918ebd14b3b38bcbee449a45c4cd98f 100644
GIT binary patch
delta 2940
zcmZA3eN0t#9LMn=aP0vUgp3pD0W8!fbXW|%6#jq%2;xHQZ=p2l|RJ<26Y&{40
zGkNxU5ze4q61pBVyEtJ?6R;1o;56zlp&snT`|*8@#?zRB7x6Cq1@Fc`Q0@M)*Q1za
zEcH0#l9`8Umx=tD%^X}NXiOz1nsJT2u?JbC=|Bx|0F$r>bFd$?@JH0j6Bw0KlY(lO
ziJE9Gs(mqPf*Vm8EXVt>5u+I2yuyhZ973h^D5}FxP#vB}b#MuliEphpFowDs>lIDM
z>FCB(%t76+vIbC@=)woE2ZKuS2b}E2GpLT-w9mP)v$vL>aYv7@`I@BhwOuIqE^_CdhQGBMbvY{
zs1<&1>(@~O{Df+!_o{aBsEH(5=LR`ZLpQ3UMW_dJtt;*Q)u@S;qE@us-mgVv&W}oc
zJFn3Dx1(_WB5ph7tG(*N0e^8~;SDFq!3P
zGi9UNtwjw`hI%y>sEIY8Qoj%N+^d+#_~r;F%D@2X!Sl%eFkhhtxPtopeziukL)Fnj
zoQKO%8S$Xn`%nY7*z4V>P1lR8!JNP}JcCjC{>L~`DsG}ubsIH-X)H?}CZX=TQ3Gb+
zeB6Y~unqN@oqpY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m4{a2(6<
z9BOaF=v5Cyn@PBld=_dcn^E=pQ4{bXeYsJj3HP>@pG8gNJIkL>X8rZxWePOoYp4hR
zMU^LTGG!X-)aRg9#B2FV)XeKp&$XaBIAZrlP_N-AYHMCWt@wo9f5%5c54?wJ_#>RF7XKr3uyo3Yt!$fFhWg>sYV}%KfC@`AV-L}y_x~{~Ofdu0
zknmcj1D__Ui5IO*XipCjvC4313j&w6O=n}H6=-`85YH3)2yNR7^zR-ebUi`rCiEMi
zD~BjwNG*P~gASSYH=Af87PbyI5ygbw9$owtxCVkCinxtR|`mo#Mb%M`EXC+OU&IwR`~nQryEtCb5OcCGO`ZW#N>2$moZm
zkJwD;dX896>`}(9Cj$x8soqX(9s53_cq}7wW=UsfYggYP|9s?lu>alY;n0kod6m7b
zEq(3XU3pb4eXS*_`5td!o~IzsyCKzER8mlsMl89@>C-D;wxcd*re
NI6gVVKbf#5>_05m>dXKD
diff --git a/apps/catalogue/locale/pl/LC_MESSAGES/django.po b/apps/catalogue/locale/pl/LC_MESSAGES/django.po
index 53b753b1..6387b5d6 100644
--- a/apps/catalogue/locale/pl/LC_MESSAGES/django.po
+++ b/apps/catalogue/locale/pl/LC_MESSAGES/django.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Platforma Redakcyjna\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2016-03-15 18:38+0100\n"
+"POT-Creation-Date: 2018-12-20 12:30+0100\n"
"PO-Revision-Date: 2014-03-27 13:17+0100\n"
"Last-Translator: Radek Czajka \n"
"Language-Team: Fundacja Nowoczesna Polska =20) ? 1 : 2);\n"
"X-Generator: Poedit 1.5.4\n"
-#: forms.py:39
+#: forms.py:40
msgid "Text file must be UTF-8 encoded."
msgstr "Plik powinien mieÄ kodowanie UTF-8."
-#: forms.py:42
+#: forms.py:43
msgid "You must either enter text or upload a file"
msgstr "ProszÄ wpisaÄ tekst albo wybraÄ plik do zaÅadowania"
-#: forms.py:51
+#: forms.py:52
msgid "ZIP file"
msgstr "Plik ZIP"
-#: forms.py:52
+#: forms.py:53
msgid "Directories are documents in chunks"
msgstr "Katalogi zawierajÄ
dokumenty w czÄÅciach"
-#: forms.py:76 forms.py:165
+#: forms.py:77 forms.py:178
msgid "Assigned to"
msgstr "Przypisane do"
-#: forms.py:97 forms.py:111
+#: forms.py:98 forms.py:112
msgid "Chunk with this slug already exists"
msgstr "CzÄÅÄ z tym slugiem już istnieje"
-#: forms.py:120
+#: forms.py:121
msgid "Append to"
msgstr "DoÅÄ
cz do"
-#: views.py:168
+#: views.py:172
#, python-format
msgid "Slug already used for %s"
msgstr "Slug taki sam jak dla pliku %s"
-#: views.py:170
+#: views.py:174
msgid "Slug already used in repository."
msgstr "Dokument o tym slugu już istnieje w repozytorium."
-#: views.py:176
+#: views.py:180
msgid "File should be UTF-8 encoded."
msgstr "Plik powinien mieÄ kodowanie UTF-8."
-#: views.py:595 models/book.py:56
+#: views.py:619 models/book.py:56
msgid "books"
msgstr "ksiÄ
żki"
-#: views.py:597
+#: views.py:621
msgid "scan gallery"
msgstr "galeria skanów"
@@ -105,19 +105,19 @@ msgstr "KsiÄ
żka nie ma czÄÅci."
msgid "Not all chunks have publishable revisions."
msgstr "Niektóre czÄÅci nie sÄ
gotowe do publikacji."
-#: models/book.py:272 models/image.py:82
+#: models/book.py:272 models/image.py:86
msgid "Invalid XML"
msgstr "NieprawidÅowy XML"
-#: models/book.py:274 models/image.py:84
+#: models/book.py:274 models/image.py:88
msgid "No Dublin Core found."
msgstr "Brak sekcji Dublin Core."
-#: models/book.py:276 models/image.py:86
+#: models/book.py:276 models/image.py:90
msgid "Invalid Dublin Core"
msgstr "NieprawidÅowy Dublin Core"
-#: models/book.py:279 models/image.py:90
+#: models/book.py:279 models/image.py:94
msgid "rdf:about is not"
msgstr "rdf:about jest różny od"
@@ -216,7 +216,7 @@ msgstr "Użytkownicy aktywni od"
msgid "Activity"
msgstr "AktywnoÅÄ"
-#: templates/catalogue/base.html:8
+#: templates/catalogue/base.html:10
msgid "Platforma Redakcyjna"
msgstr "Platforma Redakcyjna"
@@ -226,8 +226,7 @@ msgid "Append book"
msgstr "DoÅÄ
cz ksiÄ
żkÄ"
#: templates/catalogue/book_detail.html:18
-#: templates/catalogue/book_edit.html:13
-#: templates/catalogue/chunk_edit.html:16
+#: templates/catalogue/book_edit.html:13 templates/catalogue/chunk_edit.html:16
#: templates/catalogue/image_detail.html:18
msgid "Save"
msgstr "Zapisz"
@@ -272,33 +271,32 @@ msgid "PDF version"
msgstr "Wersja PDF"
#: templates/catalogue/book_detail.html:72
+msgid "PDF version for mobiles"
+msgstr "Wersja PDF na telefony"
+
+#: templates/catalogue/book_detail.html:73
msgid "EPUB version"
msgstr "Wersja EPUB"
-#: templates/catalogue/book_detail.html:73
+#: templates/catalogue/book_detail.html:74
msgid "MOBI version"
msgstr "Wersja MOBI"
-#: templates/catalogue/book_detail.html:86
+#: templates/catalogue/book_detail.html:88
#: templates/catalogue/image_detail.html:57
msgid "Publish"
msgstr "Opublikuj"
-#: templates/catalogue/book_detail.html:90
+#: templates/catalogue/book_detail.html:92
#: templates/catalogue/image_detail.html:61
msgid "Log in to publish."
msgstr "Zaloguj siÄ, aby opublikowaÄ."
-#: templates/catalogue/book_detail.html:93
+#: templates/catalogue/book_detail.html:95
#: templates/catalogue/image_detail.html:64
msgid "This book can't be published yet, because:"
msgstr "Ta ksiÄ
żka nie może jeszcze zostaÄ opublikowana. Powód:"
-#: templates/catalogue/book_detail.html:103
-#: templates/catalogue/image_detail.html:72
-msgid "Comments"
-msgstr "Komentarze"
-
#: templates/catalogue/book_edit.html:5
msgid "Edit book"
msgstr "Edytuj ksiÄ
żkÄ"
@@ -494,8 +492,7 @@ msgstr "Twoje ostatnie edycje"
msgid "Recent activity for"
msgstr "Ostatnia aktywnoÅÄ dla:"
-#: templates/catalogue/upload_pdf.html:5
-#: templates/catalogue/upload_pdf.html:11
+#: templates/catalogue/upload_pdf.html:5 templates/catalogue/upload_pdf.html:11
msgid "PDF file upload"
msgstr "Åadowanie pliku PDF"
@@ -581,6 +578,9 @@ msgstr "Zmiana"
msgid "Comment"
msgstr "Komentarz"
+#~ msgid "Comments"
+#~ msgstr "Komentarze"
+
#~ msgid "Mark publishable"
#~ msgstr "Oznacz do publikacji"
diff --git a/apps/catalogue/templates/catalogue/book_detail.html b/apps/catalogue/templates/catalogue/book_detail.html
index 65a22876..4712edf3 100755
--- a/apps/catalogue/templates/catalogue/book_detail.html
+++ b/apps/catalogue/templates/catalogue/book_detail.html
@@ -69,6 +69,7 @@
{% trans "HTML version" %}
{% trans "TXT version" %}
{% trans "PDF version" %}
+ {% trans "PDF version for mobiles" %}
{% trans "EPUB version" %}
{% trans "MOBI version" %}
diff --git a/apps/catalogue/urls.py b/apps/catalogue/urls.py
index 022839e8..e81c0a36 100644
--- a/apps/catalogue/urls.py
+++ b/apps/catalogue/urls.py
@@ -43,6 +43,7 @@ urlpatterns = patterns('catalogue.views',
url(r'^book/(?P[^/]+)/epub$', 'book_epub', name="catalogue_book_epub"),
url(r'^book/(?P[^/]+)/mobi$', 'book_mobi', name="catalogue_book_mobi"),
url(r'^book/(?P[^/]+)/pdf$', 'book_pdf', name="catalogue_book_pdf"),
+ url(r'^book/(?P[^/]+)/pdf-mobile$', 'book_pdf', kwargs={'mobile': True}, name="catalogue_book_pdf_mobile"),
url(r'^chunk_add/(?P[^/]+)/(?P[^/]+)/$',
'chunk_add', name="catalogue_chunk_add"),
diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py
index 76001f9e..b6521c7f 100644
--- a/apps/catalogue/views.py
+++ b/apps/catalogue/views.py
@@ -264,7 +264,7 @@ def book_html(request, slug):
@never_cache
-def book_pdf(request, slug):
+def book_pdf(request, slug, mobile=False):
book = get_object_or_404(Book, slug=slug)
if not book.accessible(request):
return HttpResponseForbidden("Not authorized.")
@@ -272,7 +272,8 @@ def book_pdf(request, slug):
# TODO: move to celery
doc = book.wldocument()
# TODO: error handling
- pdf_file = doc.as_pdf(cover=True, ilustr_path=book.gallery_path())
+ customizations = ['26pt', 'nothemes', 'nomargins', 'notoc'] if mobile else None
+ pdf_file = doc.as_pdf(cover=True, ilustr_path=book.gallery_path(), customizations=customizations)
from catalogue.ebook_utils import serve_file
return serve_file(pdf_file.get_filename(),
book.slug + '.pdf', 'application/pdf')
diff --git a/lib/librarian b/lib/librarian
index 2efffe35..03c22584 160000
--- a/lib/librarian
+++ b/lib/librarian
@@ -1 +1 @@
-Subproject commit 2efffe35d382709702c66b9f03131662ae2605fb
+Subproject commit 03c2258429bf8f80e88025fce45126960bfcd827
--
2.20.1