From: Radek Czajka Date: Fri, 10 Jan 2014 16:05:13 +0000 (+0100) Subject: Merge branch 'master' into rwd X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/1e9113af163a3d002b0b9c3e8c339f22af5b848a?ds=sidebyside;hp=-c Merge branch 'master' into rwd Conflicts: apps/catalogue/templates/catalogue/book_short.html apps/picture/templates/picture/picture_short.html wolnelektury/settings/static.py --- 1e9113af163a3d002b0b9c3e8c339f22af5b848a diff --combined apps/catalogue/models/book.py index 3c50a964c,64dd498d7..f85cfceca --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@@ -44,6 -44,9 +44,9 @@@ class Book(models.Model) cover = EbookField('cover', _('cover'), upload_to=book_upload_path('jpg'), null=True, blank=True) + # Cleaner version of cover for thumbs + cover_thumb = EbookField('cover_thumb', _('cover thumbnail'), + upload_to=book_upload_path('th.jpg'), null=True, blank=True) ebook_formats = constants.EBOOK_FORMATS formats = ebook_formats + ['html', 'xml'] @@@ -97,12 -100,6 +100,12 @@@ def name(self): return self.title + def language_code(self): + return constants.LANGUAGES_3TO2.get(self.language, self.language) + + def language_name(self): + return dict(settings.LANGUAGES).get(self.language_code(), "") + def book_tag_slug(self): return ('l-' + self.slug)[:120] @@@ -319,6 -316,7 +322,7 @@@ tasks.fix_tree_tags.delay(book) if 'cover' not in dont_build: book.cover.build_delay() + book.cover_thumb.build_delay() # No saves behind this point. @@@ -401,16 -399,13 +405,17 @@@ if not self.cover_info(inherit=False): if 'cover' not in app_settings.DONT_BUILD: self.cover.build_delay() + self.cover_thumb.build_delay() for format_ in constants.EBOOK_FORMATS_WITH_COVERS: if format_ not in app_settings.DONT_BUILD: getattr(self, '%s_file' % format_).build_delay() for child in self.children.all(): child.parent_cover_changed() + def other_versions(self): + """Find other versions (i.e. in other languages) of the book.""" + return type(self).objects.filter(common_slug=self.common_slug).exclude(pk=self.pk) + def related_info(self): """Keeps info about related objects (tags, media) in cache field.""" if self._related_info is not None: diff --combined apps/catalogue/templates/catalogue/book_detail.html index 480c85a28,0da819894..bb5abeb48 --- a/apps/catalogue/templates/catalogue/book_detail.html +++ b/apps/catalogue/templates/catalogue/book_detail.html @@@ -1,6 -1,5 +1,5 @@@ {% extends "base.html" %} {% load i18n %} - {% load thumbnail %} {% load common_tags catalogue_tags %} {% block titleextra %}{{ book.pretty_title }}{% endblock %} @@@ -17,9 -16,7 +16,9 @@@ {% work_list book_children %} -

{% trans "See also" %}:

+
+

{% trans "See also" %}:

{% related_books book %} +
{% endblock %} diff --combined apps/catalogue/templates/catalogue/book_mini_box.html index b5c7d9735,74202fc2f..82038e712 --- a/apps/catalogue/templates/catalogue/book_mini_box.html +++ b/apps/catalogue/templates/catalogue/book_mini_box.html @@@ -1,29 -1,14 +1,23 @@@ - {% load thumbnail %}
+
diff --combined apps/catalogue/templates/catalogue/book_short.html index 98f9bf880,d69757793..5757c6a03 --- a/apps/catalogue/templates/catalogue/book_short.html +++ b/apps/catalogue/templates/catalogue/book_short.html @@@ -1,11 -1,18 +1,10 @@@ {% load i18n %} {% load catalogue_tags social_tags %} - {% load thumbnail %}
-
+
+
-
- {% if book.cover %} - {% if main_link %}{% endif %} - Cover - {% if main_link %}{% endif %} - {% endif %} - {% block cover-area-extra %}{% endblock %} -
@@@ -27,7 -34,7 +26,7 @@@
-
+
{% for tag in related.tags.author %} {% related_tag_name tag %}{% if not forloop.last %}, {% endif %}{% endfor %}{% for title, slug in related.parents %}, @@@ -40,53 -47,29 +39,48 @@@
+
+ {% if book.cover %} + {% if main_link %}{% endif %} - Cover ++ Cover + {% if main_link %}{% endif %} + {% endif %} + {% block cover-area-extra %}{% endblock %} +
{% spaceless %} + {% trans "Epoch" %}:  {% for tag in related.tags.epoch %} {% related_tag_name tag %} - {% if not forloop.last %}{% endif %} + {% if not forloop.last %}, {% endif %} {% endfor %} - + + {% trans "Kind" %}:  {% for tag in related.tags.kind %} {% related_tag_name tag %} - {% if not forloop.last %}{% endif %} + {% if not forloop.last %}, {% endif %} {% endfor %} - + + {% trans "Genre" %}:  {% for tag in related.tags.genre %} {% related_tag_name tag %} - {% if not forloop.last %}{% endif %} + {% if not forloop.last %}, {% endif %} {% endfor %} - + + + {% if show_lang %} + + {% trans "Language" %}:  + {{ book.language_name }} + + {% endif %} {% endspaceless %}
@@@ -96,12 -79,12 +90,12 @@@ {% block book-box-extra-info %}{% endblock %} {% block box-append %} {% endblock %} +
{% block right-column %} {% endblock %}
diff --combined apps/catalogue/templates/catalogue/viewer_base.html index 1092ead87,000000000..dccd4e887 mode 100644,000000..100644 --- a/apps/catalogue/templates/catalogue/viewer_base.html +++ b/apps/catalogue/templates/catalogue/viewer_base.html @@@ -1,73 -1,0 +1,74 @@@ + +{% load i18n %} +{% load static from staticfiles %} +{% load compressed %} + + + + + {% block title %}{% endblock %} :: {% trans "Wolne Lektury" %} + + {% compressed_css "book_text" %} + {% block extrahead %}{% endblock %} + + + + + + + + {% block big-pane %} +
+ + {% block main %} +
+ {% block main-text %}{% endblock %} +
+ {% endblock main %} + {% endblock big-pane %} + + +
+ {% block footer %}{% endblock %} + +
+ + {# template #} +
+ +
+

* {% trans "Loading" %}

+
+
+
+ +
+ + + {% block js-dependencies %}{% endblock %} + + {% compressed_js "book_text" %} + - ++ {{ piwik_tag|safe }} + {% block extrabody %}{% endblock %} ++ + +