From: Jan Szejko Date: Fri, 2 Jun 2017 13:41:20 +0000 (+0200) Subject: print on demand buttons X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/8159cf8992d55a28ee79f687ab87f332664ff155 print on demand buttons --- 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 000000000..479102515 Binary files /dev/null and b/src/wolnelektury/static/img/print-white.png differ 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 000000000..5332a8542 Binary files /dev/null and b/src/wolnelektury/static/img/print.png differ diff --git a/src/wolnelektury/static/img/print.svg b/src/wolnelektury/static/img/print.svg new file mode 100644 index 000000000..4556f6ac3 --- /dev/null +++ b/src/wolnelektury/static/img/print.svg @@ -0,0 +1,58 @@ + + + + + + + + + + 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 {