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']
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]
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.
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:
{% extends "base.html" %}
{% load i18n %}
- {% load thumbnail %}
{% load common_tags catalogue_tags %}
{% block titleextra %}{{ book.pretty_title }}{% endblock %}
{% work_list book_children %}
-<h2 class="main-last"><span class="mono">{% trans "See also" %}:</span></h2>
+<section class="see-also">
+<h1>{% trans "See also" %}:</h1>
{% related_books book %}
+</section>
{% endblock %}
- {% load thumbnail %}
<div class="book-mini-box">
+ <div class="book-mini-box-inner">
+ {% if with_link %}
<a href="{{ book.get_absolute_url }}">
+ {% endif %}
{% if book.cover %}
- <img src="
- {% thumbnail book.cover "139x193" as thumb %}
- {{ thumb.url }}
- {% empty %}
- {{ book.cover.url }}
- {% endthumbnail %}
- " alt="{{ author_str }} – {{ book.title }}" class="cover" />
+ <img src="{{ book.cover_thumb.url }}"
+ alt="{{ author_str }} – {{ book.title }}" class="cover" />
{% endif %}
+ {% if show_lang %}
+ <span class="language" title="{{ book.language_name }}">{{ book.language_code }}</span>
+ {% endif %}
<div class="desc">
<span class="mono author">{{ author_str }}</span>
<span class="title">{{ book.title }}</span>
</div>
+ {% if with_link %}
</a>
+ {% endif %}
+ </div>
</div>
{% load i18n %}
{% load catalogue_tags social_tags %}
- {% load thumbnail %}
<div class="{% block box-class %}book-box{% endblock %}">
-<div class="book-box-inner" style="position: relative;">
+<div class="book-box-inner">
+<div class="book-left-column">
-<div class="cover-area">
- {% if book.cover %}
- {% if main_link %}<a href="{{ main_link }}">{% endif %}
- <img src="{{ book.cover_thumb.url }}"
- alt="Cover" class="cover" />
- {% if main_link %}</a>{% endif %}
- {% endif %}
- {% block cover-area-extra %}{% endblock %}
-</div>
<div class="book-box-body">
<div class="book-box-head">
- <div class="mono author">
+ <div class="author">
{% for tag in related.tags.author %}
<a href="{% tag_url 'author' tag.slug %}">{% related_tag_name tag %}</a>{% if not forloop.last %},
{% endif %}{% endfor %}{% for title, slug in related.parents %},
</div>
</div>
- <img src="
- {% thumbnail book.cover "139x193" as thumb %}
- {{ thumb.url }}
- {% empty %}
- {{ book.cover.url }}
- {% endthumbnail %}
- " alt="Cover" class="cover" />
+<div class="cover-area">
+ {% if book.cover %}
+ {% if main_link %}<a href="{{ main_link }}">{% endif %}
++ <img src="{{ book.cover_thumb.url }}"
++ alt="Cover" class="cover" />
+ {% if main_link %}</a>{% endif %}
+ {% endif %}
+ {% block cover-area-extra %}{% endblock %}
+</div>
<div class="tags">
{% spaceless %}
+ <span class="category">
<span class="mono"> {% trans "Epoch" %}:</span> <span class="book-box-tag">
{% for tag in related.tags.epoch %}
<a href="{% tag_url 'epoch' tag.slug %}">{% related_tag_name tag %}</a>
- {% if not forloop.last %}<span>, </span>{% endif %}
+ {% if not forloop.last %}<span>, </span>{% endif %}
{% endfor %}
- </span>
+ </span></span>
+ <span class="category">
<span class="mono"> {% trans "Kind" %}:</span> <span class="book-box-tag">
{% for tag in related.tags.kind %}
<a href="{% tag_url 'kind' tag.slug %}">{% related_tag_name tag %}</a>
- {% if not forloop.last %}<span>, </span>{% endif %}
+ {% if not forloop.last %}<span>, </span>{% endif %}
{% endfor %}
- </span>
+ </span></span>
+ <span class="category">
<span class="mono"> {% trans "Genre" %}:</span> <span class="book-box-tag">
{% for tag in related.tags.genre %}
<a href="{% tag_url 'genre' tag.slug %}">{% related_tag_name tag %}</a>
- {% if not forloop.last %}<span>, </span>{% endif %}
+ {% if not forloop.last %}<span>, </span>{% endif %}
{% endfor %}
- </span>
+ </span></span>
+
+ {% if show_lang %}
+ <span class="category">
+ <span class="mono"> {% trans "Language" %}:</span> <span class="book-box-tag">
+ <a>{{ book.language_name }}</a>
+ </span></span>
+ {% endif %}
{% endspaceless %}
</div>
<ul class="book-box-tools">
<li class="book-box-read">
{% if book.html_file %}
- <a href="{% url 'book_text' book.slug %}" class="mono downarrow">{% trans "Read online" %}</a>
+ <a href="{% url 'book_text' book.slug %}" class="downarrow">{% trans "Read online" %}</a>
{% endif %}
</li>
<li class="book-box-download hoverget">
- <a class="mono downarrow hoverclick">{% trans "Download" %}</a>
- <div class="book-box-formats mono">
+ <a class="downarrow hoverclick">{% trans "Download" %}</a>
+ <div class="book-box-formats">
{% if book.pdf_file %}
<span><a href="{{ book.pdf_file.url}}">PDF</a> {% trans "to print" %}</span>
{% endif %}
</li>
<li class="book-box-audiobook">
{% if related.media.mp3 or related.media.ogg %}
- <a href="{% url 'book_player' book.slug %}" class="open-player mono downarrow">{% trans "Listen" %}</a>
+ <a href="{% url 'book_player' book.slug %}" class="open-player downarrow">{% trans "Listen" %}</a>
{% endif %}
</li>
</ul>
{% block book-box-extra-info %}{% endblock %}
{% block box-append %}
{% endblock %}
+ </div>
{% block right-column %}
{% endblock %}
<div class="clearboth"></div>
--- /dev/null
- <script src="{% static "js/modernizr.custom.19652.js" %}"></script>
+<!DOCTYPE html>
+{% load i18n %}
+{% load static from staticfiles %}
+{% load compressed %}
+<html class="no-js">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+ <title>{% block title %}{% endblock %} :: {% trans "Wolne Lektury" %}</title>
+ <link rel="icon" href="{% static "img/favicon.png" %}" type="image/x-icon" />
+ {% compressed_css "book_text" %}
+ {% block extrahead %}{% endblock %}
+
+ </head>
+ <body id="{% block body-id %}reader{% endblock %}">
+ <nav id="no-menu"><ul>
+ <li><a href="#" id="menu-toggle-on"></a></li>
+ {% block no-menu-extra %}{% endblock %}
+ </ul></nav>
+
+ <nav id="menu"><ul>
+ <li><a href="#" id="menu-toggle-off"></a></li>
+
+ <li><a href="/">
+ <img src="{% static 'img/logo-neon.png' %}" width="80"
+ alt="Wolne Lektury"
+ title="Wolne Lektury">
+ </a></li>
+
+ {% block menu %}
+ {% endblock menu %}
+
+ </ul></nav>
+
+ {% block big-pane %}
+ <div id="big-pane">
+
+ {% block main %}
+ <article id="main-text">
+ {% block main-text %}{% endblock %}
+ </article>
+ {% endblock main %}
+ {% endblock big-pane %}
+
+
+ <footer>
+ {% block footer %}{% endblock %}
+
+ <div id="box-underlay"></div>
+
+ {# template #}
+ <div id="ajaxable-window" class='dialog-window'>
+ <div class="header"><a href="#" class="jqmClose">{% trans "Close" %}</a></div>
+ <div class="target">
+ <p><img src="{% static "img/indicator.gif" %}" alt="*"/> {% trans "Loading" %}</p>
+ </div>
+ </div>
+ </footer>
+
+ </div>
+
+ <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ {% block js-dependencies %}{% endblock %}
+ <script type="text/javascript">
+ var LANGUAGE_CODE = "{{ LANGUAGE_CODE }}";
+ var STATIC_URL = "{{ STATIC_URL }}";
+ </script>
+ {% compressed_js "book_text" %}
+
++ {{ piwik_tag|safe }}
+ {% block extrabody %}{% endblock %}
++ <script src="{% static "js/modernizr.custom.19652.js" %}"></script>
+ </body>
+</html>