From 8159cf8992d55a28ee79f687ab87f332664ff155 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Fri, 2 Jun 2017 15:41:20 +0200 Subject: [PATCH] print on demand buttons --- .../migrations/0013_book_print_on_demand.py | 19 +++++ src/catalogue/models/book.py | 6 +- .../templates/catalogue/book_short.html | 3 + src/wolnelektury/static/img/print-white.png | Bin 0 -> 348 bytes src/wolnelektury/static/img/print-white.svg | 67 ++++++++++++++++++ src/wolnelektury/static/img/print.png | Bin 0 -> 848 bytes src/wolnelektury/static/img/print.svg | 58 +++++++++++++++ .../static/scss/main/book_box.scss | 10 ++- 8 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 src/catalogue/migrations/0013_book_print_on_demand.py create mode 100644 src/wolnelektury/static/img/print-white.png create mode 100644 src/wolnelektury/static/img/print-white.svg create mode 100644 src/wolnelektury/static/img/print.png create mode 100644 src/wolnelektury/static/img/print.svg diff --git a/src/catalogue/migrations/0013_book_print_on_demand.py b/src/catalogue/migrations/0013_book_print_on_demand.py new file mode 100644 index 000000000..c2ceaeadf --- /dev/null +++ b/src/catalogue/migrations/0013_book_print_on_demand.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0012_auto_20161020_1407'), + ] + + operations = [ + migrations.AddField( + model_name='book', + name='print_on_demand', + field=models.BooleanField(default=False, verbose_name='print on demand'), + ), + ] diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index c537e5d62..db50f3e3c 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -13,7 +13,7 @@ from django.db.models import permalink import django.dispatch from django.contrib.contenttypes.fields import GenericRelation from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _, get_language import jsonfield from fnpdjango.storage import BofhFileSystemStorage from ssify import flush_ssi_includes @@ -60,6 +60,7 @@ class Book(models.Model): extra_info = jsonfield.JSONField(_('extra information'), default={}) gazeta_link = models.CharField(blank=True, max_length=240) wiki_link = models.CharField(blank=True, max_length=240) + print_on_demand = models.BooleanField(_('print on demand'), default=False) # files generated during publication cover = EbookField( @@ -601,6 +602,9 @@ class Book(models.Model): except BookPopularity.DoesNotExist: BookPopularity.objects.create(book=self, count=count) + def ridero_link(self): + return 'https://ridero.eu/%s/books/wl_%s/' % (get_language(), self.slug.replace('-', '_')) + def add_file_fields(): for format_ in Book.formats: diff --git a/src/catalogue/templates/catalogue/book_short.html b/src/catalogue/templates/catalogue/book_short.html index 0cba65cc9..0d644093b 100644 --- a/src/catalogue/templates/catalogue/book_short.html +++ b/src/catalogue/templates/catalogue/book_short.html @@ -84,6 +84,9 @@ {% if book.html_file %} {% trans "Read online" %} {% endif %} + {% if book.print_on_demand %} + {% trans "Print on demand" %} + {% endif %}
  • {% trans "Download" %}: diff --git a/src/wolnelektury/static/img/print-white.png b/src/wolnelektury/static/img/print-white.png new file mode 100644 index 0000000000000000000000000000000000000000..479102515a0df6f5db28d517801189023423690a GIT binary patch literal 348 zcmeAS@N?(olHy`uVBq!ia0vp^JV4CN!3HF~3v%Lt6icy_X9x!n)NrJ90QsB+9+AaB z_18g|(Me-=1yE43#5JNMI6tkVJh3R1p}f3YFEcN@I61K(RWH9NefB#WDWIa8o-U3d z8WU?T8hSe=iZnco?$&dq n{xkl+zs#kW-5{=`HrIZir_NcM8Q)WZo@DTJ^>bP0l+XkKu%>{f literal 0 HcmV?d00001 diff --git a/src/wolnelektury/static/img/print-white.svg b/src/wolnelektury/static/img/print-white.svg new file mode 100644 index 000000000..3b5ef8fe1 --- /dev/null +++ b/src/wolnelektury/static/img/print-white.svg @@ -0,0 +1,67 @@ + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/src/wolnelektury/static/img/print.png b/src/wolnelektury/static/img/print.png new file mode 100644 index 0000000000000000000000000000000000000000..5332a8542de18a00357362093fa68aa114b57c28 GIT binary patch literal 848 zcmV-W1F!svP)^)ghd=`9vl6oC$#e3@y&wIfcyUiu%nxx*IV_Y6U(5L+KFunodc5p0PH9; z*xsyH&)_2wc5mEmK7irvR*6JN}FZ zg}=C{w!!vrD-%5AkxfRL&3dF8WVR8p2Pk(AhcoC&u&WO+B=*Yf9t(YH=p(uRY*G47 z*qYY+)wh6)`9LDQlnOTXY+HJVM1K%|9!PVg74H7|1GQRZK3Hu_GPcRNGuQ=0t2)UK z7Je4EH&?k4&X$OHdp;{|G5EDB`KSXA79huza8?!g*QCfr-8@2@-q%h=N*GDDp9IukxgJ4 zz;(pu{ozdhtYHf>9Skq+v?zT7tS{(t+Rbz+@5p!(*;mMBBs;9IE3qPeN@l|D#P|7E=#N@Vn!gKVOJETtC*gPBtCBaKCo7n>^5nC4Mk=W<*eJfYZ z{KeAI>ej3)hB~jJSsS@#?ymq@pHM$wX7K9lvC->yp^M(vV# z!}HbI+Q>zBUx!%wdA%e~d&FR?cH~^%Ubap;Dv#EmO58g;YBm4tsA)4zW|5B1HHN2( avVQ|@c`c=E6&B|J0000 + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/src/wolnelektury/static/scss/main/book_box.scss b/src/wolnelektury/static/scss/main/book_box.scss index 23575ce99..a1915b9d1 100755 --- a/src/wolnelektury/static/scss/main/book_box.scss +++ b/src/wolnelektury/static/scss/main/book_box.scss @@ -395,9 +395,13 @@ display: inline-block; background: #0D7E85; color: white; - @include size(width, 200px); + @include size(width, 170px); text-align: center; @include size(margin-bottom, 5px); + @include size(margin-right, 30px); + } + a.print { + margin-right: 0; } a:before { @@ -410,6 +414,10 @@ position: relative; bottom: 2px; } + + a.print:before { + content: url("/static/img/print-white.png"); + } } .book-box-download { -- 2.20.1