Generally working version.
authorRadek Czajka <rczajka@rczajka.pl>
Thu, 31 Dec 2015 21:07:56 +0000 (22:07 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Thu, 31 Dec 2015 16:14:09 +0000 (17:14 +0100)
64 files changed:
fabfile.py
src/ajaxable/templates/ajaxable/form.html
src/ajaxable/templates/ajaxable/form_on_page.html
src/catalogue/constants.py
src/catalogue/helpers.py
src/catalogue/locale/pl/LC_MESSAGES/django.mo
src/catalogue/locale/pl/LC_MESSAGES/django.po
src/catalogue/management/commands/importbooks.py
src/catalogue/models/book.py
src/catalogue/models/collection.py
src/catalogue/models/tag.py
src/catalogue/static/jplayer/jplayer.blue.monday.css
src/catalogue/static/player/player.js
src/catalogue/tasks.py
src/catalogue/templates/catalogue/audiobook_list.html
src/catalogue/templates/catalogue/book_detail.html
src/catalogue/templates/catalogue/book_short.html
src/catalogue/templates/catalogue/book_wide.html
src/catalogue/templates/catalogue/catalogue.html
src/catalogue/templates/catalogue/collection.html
src/catalogue/templates/catalogue/collection_box.html [new file with mode: 0644]
src/catalogue/templates/catalogue/collections.html [new file with mode: 0644]
src/catalogue/templates/catalogue/inline_tag_list.html
src/catalogue/templates/catalogue/menu.html [deleted file]
src/catalogue/templates/catalogue/plain_list.html [new file with mode: 0644]
src/catalogue/templates/catalogue/player.html
src/catalogue/templates/catalogue/search_multiple_hits.html
src/catalogue/templates/catalogue/snippets/custom_pdf_link_li.html
src/catalogue/templates/catalogue/tag_box.html [new file with mode: 0644]
src/catalogue/templates/catalogue/tag_catalogue.html [new file with mode: 0644]
src/catalogue/templates/catalogue/tagged_object_list.html
src/catalogue/templatetags/catalogue_tags.py
src/catalogue/urls.py
src/catalogue/utils.py
src/catalogue/views.py
src/picture/models.py
src/picture/templates/picture/picture_short.html
src/picture/templates/picture/picture_viewer.html
src/picture/templates/picture/picture_wide.html
src/search/templatetags/search_tags.py
src/wolnelektury/celery.py
src/wolnelektury/locale/pl/LC_MESSAGES/django.mo
src/wolnelektury/locale/pl/LC_MESSAGES/django.po
src/wolnelektury/settings/custom.py
src/wolnelektury/settings/static.py
src/wolnelektury/static/js/base.js
src/wolnelektury/static/js/contrib/jquery.paging.min.js [new file with mode: 0644]
src/wolnelektury/static/scss/book_text/menu.scss
src/wolnelektury/static/scss/main/base.scss
src/wolnelektury/static/scss/main/book_box.scss
src/wolnelektury/static/scss/main/dialogs.scss
src/wolnelektury/static/scss/main/header.scss
src/wolnelektury/static/scss/main/main_page.scss
src/wolnelektury/static/scss/main/menu.scss
src/wolnelektury/static/scss/main/picture_box.scss
src/wolnelektury/static/scss/main/tag.scss
src/wolnelektury/static/scss/social/shelf_tags.scss
src/wolnelektury/templates/account/base.html
src/wolnelektury/templates/main_page.html
src/wolnelektury/templates/socialaccount/connections.html
src/wolnelektury/templates/socialaccount/login_cancelled.html
src/wolnelektury/templates/superbase.html
src/wolnelektury/templates/user.html
src/wolnelektury/views.py

index a7bc768..e614e9c 100644 (file)
@@ -19,6 +19,14 @@ def production():
     ]
 
 
+@task
+def beta():
+    env.hosts = ['giewont.icm.edu.pl']
+    env.user = 'lektury'
+    env.app_path = '/srv/wolnelektury.pl/beta'
+    env.services = []
+
+
 @task
 def staging():
     env.hosts = ['san.nowoczesnapolska.org.pl:2223']
index 13586ac..963f411 100755 (executable)
@@ -17,4 +17,6 @@
 </ol>
 </form>
 
-{% block extra %}{% endblock %}
\ No newline at end of file
+<div class="form-extra">
+{% block extra %}{% endblock %}
+</div>
index 61175d5..8e49523 100755 (executable)
@@ -5,10 +5,14 @@
 
 {% block body %}
 
+    <div class="white-box">
+
     {% include ajax_template %}
 
     {% if response_data.message %}
         <p>{{ response_data.message }}</p>
     {% endif %}
 
+    </div>
+
 {% endblock %}
index 36f4f5d..d1a5dde 100644 (file)
@@ -36,3 +36,13 @@ LANGUAGES_3TO2 = {
     'rus': 'ru',
     'ukr': 'uk',
 }
+
+CATEGORIES_NAME_PLURAL = {
+    'author': _('authors'),
+    'epoch': _('epochs'),
+    'kind': _('kinds'),
+    'genre': _('genres'),
+    'theme': _('themes'),
+    'set': _('sets'),
+    'thing': _('things'),
+}
index 7ca2cbd..b48c483 100644 (file)
@@ -2,57 +2,91 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
+from django.conf import settings
 from django.contrib.contenttypes.models import ContentType
 from django.db.models import Count
 from .models import Tag, Book
+from os.path import getmtime
+import cPickle
+from collections import defaultdict
+
 
 
 BOOK_CATEGORIES = ('author', 'epoch', 'genre', 'kind')
 
 
-def get_top_level_related_tags(tags=None, categories=BOOK_CATEGORIES):
+_COUNTERS = None
+_COUNTER_TIME = None
+def get_top_level_related_tags(tags, categories=None):
     """
     Finds tags related to given tags through books, and counts their usage.
 
     Takes ancestry into account: if a tag is applied to a book, its
     usage on the book's descendants is ignored.
+    """
+    global _COUNTERS, _COUNTER_TIME
+    # First, check that we have a valid and recent version of the counters.
+    if getmtime(settings.CATALOGUE_COUNTERS_FILE) > _COUNTER_TIME:
+        with open(settings.CATALOGUE_COUNTERS_FILE) as f:
+            _COUNTERS = cPickle.load(f)
 
-    This is tested for PostgreSQL 9.1+, and might not work elsewhere.
-    It particular, it uses raw SQL using WITH clause, which is
-    supported in SQLite from v. 3.8.3, and is missing in MySQL.
-    http://bugs.mysql.com/bug.php?id=16244
+    tagids = tuple(sorted(t.pk for t in tags))
+    try:
+        related_ids = _COUNTERS['next'][tagids]
+    except KeyError:
+        return
 
-    """
-    # First, find all tag relations of relevant books.
-    bct = ContentType.objects.get_for_model(Book)
-    relations = Tag.intermediary_table_model.objects.filter(
-        content_type=bct)
-    if tags is not None:
-        tagged_books = Book.tagged.with_all(tags).only('pk')
-        relations = relations.filter(
-            object_id__in=tagged_books).exclude(
-            tag_id__in=[tag.pk for tag in tags])
-
-    rel_sql, rel_params = relations.query.sql_with_params()
-
-    # Exclude those relations between a book and a tag,
-    # for which there is a relation between the book's ancestor
-    # and the tag and 
-
-    return Tag.objects.raw('''
-        WITH AllTagged AS (''' + rel_sql + ''')
-        SELECT catalogue_tag.*, COUNT(catalogue_tag.id) AS count
-        FROM catalogue_tag, AllTagged
-        WHERE catalogue_tag.id=AllTagged.tag_id
-            AND catalogue_tag.category IN %s
-            AND NOT EXISTS (
-                SELECT AncestorTagged.id
-                FROM catalogue_book_ancestor Ancestor,
-                    AllTagged AncestorTagged
-                WHERE Ancestor.from_book_id=AllTagged.object_id
-                    AND AncestorTagged.content_type_id=%s
-                    AND AncestorTagged.object_id=Ancestor.to_book_id
-                    AND AncestorTagged.tag_id=AllTagged.tag_id
-            )
-        GROUP BY catalogue_tag.id
-        ORDER BY sort_key''', rel_params + (categories, bct.pk))
+    related = Tag.objects.filter(pk__in=related_ids)
+
+    # TODO: do we really need that?
+    if categories is not None:
+        related = related.filter(category__in=categories)
+
+    for tag in related:
+        tag.count = _COUNTERS['count'][tuple(sorted(tagids + (tag.pk,)))]
+        yield tag
+
+    #~ return related
+
+
+def update_counters():
+    def combinations(things):
+        if len(things):
+            for c in combinations(things[1:]):
+                yield c
+                yield (things[0],) + c
+        else:
+            yield ()
+
+    def count_for_book(book, count_by_combination=None, parent_combinations=None):
+        if not parent_combinations:
+            parent_combinations = set()
+        tags = sorted(tuple(t.pk for t in book.tags.filter(category__in=('author', 'genre', 'epoch', 'kind'))))
+        combs = list(combinations(tags))
+        for c in combs:
+            if c not in parent_combinations:
+                count_by_combination[c] += 1
+        combs_for_child = set(list(parent_combinations) + combs)
+        for child in book.children.all():
+            count_for_book(child, count_by_combination, combs_for_child)
+
+    count_by_combination = defaultdict(lambda: 0)
+    for b in Book.objects.filter(parent=None):
+        count_for_book(b, count_by_combination)
+
+    next_combinations = defaultdict(set)
+    # Now build an index of all combinations.
+    for c in count_by_combination.keys():
+        if not c:
+            continue
+        for n in c:
+            rest = tuple(x for x in c if x != n)
+            next_combinations[rest].add(n)
+
+    counters = {
+        "count": dict(count_by_combination),
+        "next": dict(next_combinations),
+    }
+
+    with open(settings.CATALOGUE_COUNTERS_FILE, 'w') as f:
+        cPickle.dump(counters, f)
index 739f69b..b45c14e 100644 (file)
Binary files a/src/catalogue/locale/pl/LC_MESSAGES/django.mo and b/src/catalogue/locale/pl/LC_MESSAGES/django.mo differ
index c1a8aac..6f14722 100644 (file)
@@ -5,8 +5,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WolneLektury\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-10-16 13:54+0200\n"
-"PO-Revision-Date: 2014-10-16 13:55+0100\n"
+"POT-Creation-Date: 2015-12-31 16:45+0100\n"
+"PO-Revision-Date: 2015-12-31 16:45+0100\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
 "Language-Team: Fundacja Nowoczesna Polska <fundacja@nowoczesnapolska.org."
 "pl>\n"
@@ -15,13 +15,41 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "X-Translated-Using: django-rosetta 0.5.6\n"
-"X-Generator: Poedit 1.5.4\n"
+"X-Generator: Poedit 1.8.4\n"
 
 #: constants.py:10
 msgid "Creative Commons Attribution-ShareAlike 3.0 Unported"
 msgstr ""
 "Creative Commons Uznanie autorstwa – Na tych samych warunkach 3.0 Unported"
 
+#: constants.py:41
+msgid "authors"
+msgstr "autorzy"
+
+#: constants.py:42
+msgid "epochs"
+msgstr "epoki"
+
+#: constants.py:43
+msgid "kinds"
+msgstr "rodzaje"
+
+#: constants.py:44
+msgid "genres"
+msgstr "gatunki"
+
+#: constants.py:45
+msgid "themes"
+msgstr "motywy"
+
+#: constants.py:46
+msgid "sets"
+msgstr "półki"
+
+#: constants.py:47
+msgid "things"
+msgstr "przedmioty"
+
 #: forms.py:27
 msgid "Please supply an XML."
 msgstr "Proszę podać XML."
@@ -74,7 +102,7 @@ msgstr "Duży"
 msgid "Queue is full. Please try again later."
 msgstr "Kolejka jest pełna. Proszę spróbować ponownie później."
 
-#: models/book.py:43 models/collection.py:13
+#: models/book.py:43 models/collection.py:14
 msgid "title"
 msgstr "tytuł"
 
@@ -87,8 +115,8 @@ msgstr "klucz sortowania"
 msgid "sort key by author"
 msgstr "Znalezieni autorzy"
 
-#: models/book.py:46 models/book.py:48 models/collection.py:14
-#: models/collection.py:17 models/tag.py:34
+#: models/book.py:46 models/book.py:48 models/collection.py:15
+#: models/collection.py:18 models/tag.py:34
 msgid "slug"
 msgstr "slug"
 
@@ -96,8 +124,8 @@ msgstr "slug"
 msgid "language code"
 msgstr "Kod języka"
 
-#: models/book.py:51 models/book.py:160 models/collection.py:15
-#: models/tag.py:38 models/tag.py:144
+#: models/book.py:51 models/book.py:169 models/collection.py:16
+#: models/tag.py:38 models/tag.py:154
 msgid "description"
 msgstr "opis"
 
@@ -122,7 +150,7 @@ msgstr "okładka"
 msgid "cover thumbnail"
 msgstr "podgląd okładki"
 
-#: models/book.py:92 models/collection.py:20
+#: models/book.py:92 models/collection.py:21
 msgid "book"
 msgstr "książka"
 
@@ -130,21 +158,21 @@ msgstr "książka"
 msgid "books"
 msgstr "książki"
 
-#: models/book.py:258
+#: models/book.py:267
 #, python-format
 msgid "Book \"%s\" does not exist."
 msgstr "Utwór \"%s\" nie istnieje."
 
-#: models/book.py:272
+#: models/book.py:281
 #, python-format
 msgid "Book %s already exists"
 msgstr "Książka %s już istnieje"
 
-#: models/book.py:519
+#: models/book.py:529
 msgid "This work needs modernisation"
 msgstr "Ten utwór wymaga uwspółcześnienia"
 
-#: models/book.py:546 models/bookmedia.py:27
+#: models/book.py:556 models/bookmedia.py:27
 #, python-format
 msgid "%s file"
 msgstr "plik %s"
@@ -165,19 +193,19 @@ msgstr "plik"
 msgid "book media"
 msgstr "media książki"
 
-#: models/collection.py:18
+#: models/collection.py:19
 msgid "book slugs"
 msgstr "slugi utworów"
 
-#: models/collection.py:20 models/tag.py:20
+#: models/collection.py:21 models/tag.py:20
 msgid "kind"
 msgstr "rodzaj"
 
-#: models/collection.py:24
+#: models/collection.py:25
 msgid "collection"
 msgstr "kolekcja"
 
-#: models/collection.py:25
+#: models/collection.py:26
 msgid "collections"
 msgstr "kolekcje"
 
@@ -237,18 +265,20 @@ msgstr "tag"
 msgid "tags"
 msgstr "tagi"
 
-#: templates/catalogue/audiobook_list.html:8
-#: templates/catalogue/audiobook_list.html:17
+#: templates/catalogue/audiobook_list.html:6
+#: templates/catalogue/audiobook_list.html:11
+msgid "Audiobooks"
+msgstr "Audiobooki"
+
+#: templates/catalogue/audiobook_list.html:14
 msgid "Listing of all audiobooks"
 msgstr "Spis wszystkich audiobooków"
 
-#: templates/catalogue/audiobook_list.html:13
-msgid "Latest MP3 audiobooks"
-msgstr "Ostatnio dodane audiobooki w formacie MP3"
-
-#: templates/catalogue/audiobook_list.html:14
-msgid "Latest Ogg Vorbis audiobooks"
-msgstr "Ostatnio dodane audiobooki w formacie Ogg Vorbis"
+#: templates/catalogue/audiobook_list.html:17
+#: templates/catalogue/daisy_list.html:7
+#: templates/catalogue/daisy_list.html:13
+msgid "Listing of all DAISY files"
+msgstr "Spis wszystkich plików DAISY"
 
 #: templates/catalogue/book_detail.html:23
 #: templates/catalogue/book_text.html:20
@@ -256,11 +286,55 @@ msgid "Other versions"
 msgstr "Inne wersje"
 
 #: templates/catalogue/book_detail.html:31
-#: templates/catalogue/tagged_object_list.html:75
-#: templates/catalogue/tagged_object_list.html:118
 msgid "See also"
 msgstr "Zobacz też"
 
+#: templates/catalogue/book_detail.html:40
+#: templates/catalogue/book_text.html:30
+#: templates/catalogue/tagged_object_list.html:24
+msgid "Themes"
+msgstr "Motywy"
+
+#: templates/catalogue/book_detail.html:47
+msgid "Information about the work"
+msgstr "Informacje o utworze"
+
+#: templates/catalogue/book_detail.html:58
+msgid "Source"
+msgstr "Źródło"
+
+#: templates/catalogue/book_detail.html:58
+msgid "of the book"
+msgstr "utworu"
+
+#: templates/catalogue/book_detail.html:59
+msgid "in"
+msgstr "w serwisie"
+
+#: templates/catalogue/book_detail.html:61
+msgid "Source XML file"
+msgstr "Źródłowy plik XML"
+
+#: templates/catalogue/book_detail.html:63
+msgid "Book on"
+msgstr "Utwór na"
+
+#: templates/catalogue/book_detail.html:63
+msgid "Editor's Platform"
+msgstr "Platformie Redakcyjnej"
+
+#: templates/catalogue/book_detail.html:66
+msgid "Book description on Lektury.Gazeta.pl"
+msgstr "Opis lektury w Lektury.Gazeta.pl"
+
+#: templates/catalogue/book_detail.html:69
+msgid "Book description on Wikipedia"
+msgstr "Opis lektury w Wikipedii"
+
+#: templates/catalogue/book_detail.html:71
+msgid "Mix this book"
+msgstr "Miksuj treść utworu"
+
 #: templates/catalogue/book_fragments.html:5
 #: templates/catalogue/book_fragments.html:11
 msgid "Theme"
@@ -350,43 +424,34 @@ msgstr "Język"
 msgid "Read online"
 msgstr "Czytaj online"
 
-#: templates/catalogue/book_short.html:101
-#: templates/catalogue/book_wide.html:72 views.py:594
+#: templates/catalogue/book_short.html:101 views.py:588
 msgid "Download"
 msgstr "Pobierz"
 
-#: templates/catalogue/book_short.html:104
-msgid "to print"
-msgstr "do druku"
-
-#: templates/catalogue/book_short.html:107
-msgid "for an e-book reader"
-msgstr "na czytnik e-booków"
+#: templates/catalogue/book_short.html:173 templates/catalogue/player.html:84
+msgid "Artist"
+msgstr "Czyta"
 
-#: templates/catalogue/book_short.html:110
-msgid "for Kindle"
-msgstr "na Kindle"
+#: templates/catalogue/book_short.html:174 templates/catalogue/player.html:85
+msgid "Director"
+msgstr "Reżyseruje"
 
-#: templates/catalogue/book_short.html:113
-msgid "FictionBook"
-msgstr "FictionBook"
+#: templates/catalogue/book_short.html:190
+msgid "previous"
+msgstr "poprzednia"
 
-#: templates/catalogue/book_short.html:116
-msgid "for advanced usage"
-msgstr "do zadań specjalnych"
+#: templates/catalogue/book_short.html:191
+msgid "Part"
+msgstr "Część"
 
-#: templates/catalogue/book_short.html:122
-msgid "Listen"
-msgstr "Słuchaj"
+#: templates/catalogue/book_short.html:192
+msgid "next"
+msgstr "następna"
 
 #: templates/catalogue/book_text.html:26
 msgid "Table of contents"
 msgstr "Spis treści"
 
-#: templates/catalogue/book_text.html:30 templatetags/catalogue_tags.py:336
-msgid "Themes"
-msgstr "Motywy"
-
 #: templates/catalogue/book_text.html:34 templates/catalogue/book_text.html:91
 msgid "Settings"
 msgstr "Ustawienia"
@@ -428,104 +493,50 @@ msgstr "Wyświetlaj motywy"
 msgid "Display footnotes"
 msgstr "Wyświetlaj przypisy"
 
-#: templates/catalogue/book_wide.html:23
-#: templates/catalogue/tagged_object_list.html:61
-msgid "Motifs and themes"
-msgstr "Motywy i tematy"
-
-#: templates/catalogue/book_wide.html:52
-msgid "See"
-msgstr "Zobacz"
-
-#: templates/catalogue/book_wide.html:55
-msgid "Source"
-msgstr "Źródło"
-
-#: templates/catalogue/book_wide.html:55
-msgid "of the book"
-msgstr "utworu"
-
-#: templates/catalogue/book_wide.html:56
-msgid "in"
-msgstr "w serwisie"
-
-#: templates/catalogue/book_wide.html:58
-msgid "Source XML file"
-msgstr "Źródłowy plik XML"
-
-#: templates/catalogue/book_wide.html:60
-msgid "Book on"
-msgstr "Utwór na"
-
-#: templates/catalogue/book_wide.html:60
-msgid "Editor's Platform"
-msgstr "Platformie Redakcyjnej"
-
-#: templates/catalogue/book_wide.html:63
-msgid "Book description on Lektury.Gazeta.pl"
-msgstr "Opis lektury w Lektury.Gazeta.pl"
-
-#: templates/catalogue/book_wide.html:66
-msgid "Book description on Wikipedia"
-msgstr "Opis lektury w Wikipedii"
-
-#: templates/catalogue/book_wide.html:68
-msgid "Mix this book"
-msgstr "Miksuj treść utworu"
-
-#: templates/catalogue/book_wide.html:76
-msgid "Download all audiobooks for this book"
-msgstr "Pobierz wszystkie audiobooki tego utworu"
-
-#: templates/catalogue/catalogue.html:6 templates/catalogue/catalogue.html:11
-#: templates/catalogue/menu.html:6
+#: templates/catalogue/catalogue.html:6
 msgid "Catalogue"
 msgstr "Katalog"
 
-#: templates/catalogue/catalogue.html:16
+#: templates/catalogue/catalogue.html:11
+msgid "All works"
+msgstr "Wszystkie utwory"
+
+#: templates/catalogue/catalogue.html:17
 msgid "Download the catalogue in PDF format."
 msgstr "Pobierz katalog w formacie PDF."
 
-#: templates/catalogue/catalogue.html:19
-#: templates/catalogue/search_multiple_hits.html:20
-#: templates/catalogue/tagged_object_list.html:27
-#: templatetags/catalogue_tags.py:332
-msgid "Authors"
-msgstr "Autorzy"
-
-#: templates/catalogue/catalogue.html:22
-#: templates/catalogue/search_multiple_hits.html:28
-#: templates/catalogue/tagged_object_list.html:35
-#: templatetags/catalogue_tags.py:334
-msgid "Kinds"
-msgstr "Rodzaje"
+#: templates/catalogue/catalogue.html:20
+#: templates/catalogue/tag_list_split.html:3
+#: templates/catalogue/tagged_object_list.html:6
+#: templates/catalogue/tagged_object_list.html:14
+msgid "Literature"
+msgstr "Literatura"
 
-#: templates/catalogue/catalogue.html:25
-#: templates/catalogue/search_multiple_hits.html:36
-#: templates/catalogue/tagged_object_list.html:43
-#: templatetags/catalogue_tags.py:333
-msgid "Genres"
-msgstr "Gatunki"
+#: templates/catalogue/catalogue.html:23
+#: templates/catalogue/collections.html:6
+#: templates/catalogue/collections.html:11
+msgid "Collections"
+msgstr "Kolekcje"
 
-#: templates/catalogue/catalogue.html:28
-#: templates/catalogue/search_multiple_hits.html:44
-#: templates/catalogue/tagged_object_list.html:51
-#: templatetags/catalogue_tags.py:335
-msgid "Epochs"
-msgstr "Epoki"
+#: templates/catalogue/catalogue.html:26
+#: templates/catalogue/tag_list_split.html:8
+#: templates/catalogue/tagged_object_list.html:6
+#: templates/catalogue/tagged_object_list.html:14
+msgid "Gallery"
+msgstr "Galeria"
 
-#: templates/catalogue/catalogue.html:31
-msgid "Themes and topics"
-msgstr "Motywy i tematy"
+#: templates/catalogue/collection_box.html:5
+msgid "Collection"
+msgstr "Kolekcja"
 
-#: templates/catalogue/catalogue.html:34 templates/catalogue/menu.html:19
-msgid "Collections"
-msgstr "Kolekcje"
+#: templates/catalogue/collection_box.html:15
+#, python-format
+msgid "and %(c)s more"
+msgstr "oraz %(c)s więcej"
 
-#: templates/catalogue/daisy_list.html:7
-#: templates/catalogue/daisy_list.html:13
-msgid "Listing of all DAISY files"
-msgstr "Spis wszystkich plików DAISY"
+#: templates/catalogue/collections.html:17
+msgid "All collections"
+msgstr "Wszystkie kolekcje"
 
 #: templates/catalogue/daisy_list.html:10
 msgid "Latest DAISY audiobooks"
@@ -545,34 +556,18 @@ msgstr "Rozwiń fragment"
 msgid "Hide fragment"
 msgstr "Zwiń fragment"
 
-#: templates/catalogue/inline_tag_list.html:4
-#: templates/catalogue/tag_list.html:6
-msgid "See full category"
-msgstr "Zobacz całą kategorię"
-
-#: templates/catalogue/menu.html:5
-msgid "Catalogue of the library"
-msgstr "Katalog biblioteki"
+#: templates/catalogue/inline_tag_list.html:6
+msgid "Chosen"
+msgstr "Wybrane"
 
-#: templates/catalogue/menu.html:13 templates/catalogue/menu.html.py:21
-msgid "Please wait…"
-msgstr "Proszę czekać…"
+#: templates/catalogue/inline_tag_list.html:14
+#: templates/catalogue/inline_tag_list.html:23
+msgid "Available"
+msgstr "Dostępne"
 
-#: templates/catalogue/menu.html:26
-msgid "All books"
-msgstr "Wszystkie utwory"
-
-#: templates/catalogue/menu.html:29
-msgid "Audiobooks"
-msgstr "Audiobooki"
-
-#: templates/catalogue/menu.html:32
-msgid "DAISY"
-msgstr "DAISY"
-
-#: templates/catalogue/menu.html:36 templates/catalogue/tag_list_split.html:8
-msgid "Gallery"
-msgstr "Galeria"
+#: templates/catalogue/inline_tag_list.html:32
+msgid "Other"
+msgstr "Inne"
 
 #: templates/catalogue/picture_detail.html:29
 msgid "Work is licensed under "
@@ -622,31 +617,23 @@ msgstr "Strona utworu"
 msgid "Download as"
 msgstr "Pobierz jako"
 
-#: templates/catalogue/player.html:88
-msgid "Artist"
-msgstr "Czyta"
-
-#: templates/catalogue/player.html:89
-msgid "Director"
-msgstr "Reżyseruje"
-
-#: templates/catalogue/player.html:108
+#: templates/catalogue/player.html:104
 msgid "Audiobooks were prepared as a part of the projects:"
 msgstr "Audiobooki przygotowane w ramach projektów:"
 
-#: templates/catalogue/player.html:113
+#: templates/catalogue/player.html:109
 #, python-format
 msgid "%(cs)s, funded by %(fb)s"
 msgstr "%(cs)s, finansowanego przez %(fb)s"
 
-#: templates/catalogue/player.html:125
+#: templates/catalogue/player.html:121
 #, python-format
 msgid ""
 "Audiobooks were prepared as a part of the %(cs)s project funded by %(fb)s."
 msgstr ""
 "Audiobooki przygotowane w ramach projektu %(cs)s finansowanego przez %(fb)s."
 
-#: templates/catalogue/player.html:127
+#: templates/catalogue/player.html:123
 #, python-format
 msgid "Audiobooks were prepared as a part of the %(cs)s project."
 msgstr "Audiobooki przygotowane w ramach projektu %(cs)s."
@@ -688,28 +675,48 @@ msgstr "Szukaj"
 msgid "Did you mean"
 msgstr "Czy chodziło Ci o"
 
-#: templates/catalogue/search_multiple_hits.html:55
+#: templates/catalogue/search_multiple_hits.html:20
+#: templates/catalogue/tagged_object_list.html:19
+msgid "Authors"
+msgstr "Autorzy"
+
+#: templates/catalogue/search_multiple_hits.html:30
+#: templates/catalogue/tagged_object_list.html:22
+msgid "Kinds"
+msgstr "Rodzaje"
+
+#: templates/catalogue/search_multiple_hits.html:40
+#: templates/catalogue/tagged_object_list.html:21
+msgid "Genres"
+msgstr "Gatunki"
+
+#: templates/catalogue/search_multiple_hits.html:50
+#: templates/catalogue/tagged_object_list.html:20
+msgid "Epochs"
+msgstr "Epoki"
+
+#: templates/catalogue/search_multiple_hits.html:63
 msgid "Results by title"
 msgstr "Znalezione w tytułach"
 
-#: templates/catalogue/search_multiple_hits.html:70
+#: templates/catalogue/search_multiple_hits.html:78
 msgid "Results by authors"
 msgstr "Znalezieni autorzy"
 
-#: templates/catalogue/search_multiple_hits.html:83
+#: templates/catalogue/search_multiple_hits.html:91
 msgid "Results by translators"
 msgstr "Znalezieni tłumacze"
 
-#: templates/catalogue/search_multiple_hits.html:96
+#: templates/catalogue/search_multiple_hits.html:104
 msgid "Results in text"
 msgstr "Znalezione w treści"
 
-#: templates/catalogue/search_multiple_hits.html:113
+#: templates/catalogue/search_multiple_hits.html:121
 msgid "Other results"
 msgstr "Inne wyniki"
 
 #: templates/catalogue/search_no_hits.html:19
-#: templates/catalogue/tagged_object_list.html:162
+#: templates/catalogue/tagged_object_list.html:61
 msgid "Sorry! Search cirteria did not match any resources."
 msgstr "Przepraszamy! Brak wyników spełniających kryteria podane w zapytaniu."
 
@@ -727,7 +734,7 @@ msgstr ""
 msgid "Sorry! Search query must have at least two characters."
 msgstr "Przepraszamy! Zapytanie musi zawierać co najmniej dwa znaki."
 
-#: templates/catalogue/snippets/custom_pdf_link_li.html:5
+#: templates/catalogue/snippets/custom_pdf_link_li.html:3
 msgid "Download a custom PDF"
 msgstr "Stwórz własny plik PDF"
 
@@ -736,30 +743,43 @@ msgstr "Stwórz własny plik PDF"
 msgid "Free license"
 msgstr "Wolna licencja"
 
-#: templates/catalogue/tag_list_split.html:3
-msgid "Literature"
-msgstr "Literatura"
+#: templates/catalogue/tag_catalogue.html:11
+msgid "on Wolne Lektury"
+msgstr "w Wolnych Lekturach"
 
-#: templates/catalogue/tagged_object_list.html:79
-#: templates/catalogue/tagged_object_list.html:132
-msgid "in Culture.pl"
-msgstr "w Culture.pl"
+#: templates/catalogue/tag_list.html:6
+msgid "See full category"
+msgstr "Zobacz całą kategorię"
 
-#: templates/catalogue/tagged_object_list.html:84
-#: templates/catalogue/tagged_object_list.html:122
+#: templates/catalogue/tagged_object_list.html:58
+msgid "All matching works"
+msgstr "Pasujące utwory"
+
+#: templates/catalogue/tagged_object_list.html:70
+msgid "Motifs and themes"
+msgstr "Motywy i tematy"
+
+#: templates/catalogue/tagged_object_list.html:87
+msgid "No description."
+msgstr "Brak opisu."
+
+#: templates/catalogue/tagged_object_list.html:93
 msgid "in Lektury.Gazeta.pl"
 msgstr "w serwisie Lektury.Gazeta.pl"
 
-#: templates/catalogue/tagged_object_list.html:89
-#: templates/catalogue/tagged_object_list.html:127
+#: templates/catalogue/tagged_object_list.html:99
 msgid "in Wikipedia"
 msgstr "w Wikipedii"
 
+#: templates/catalogue/tagged_object_list.html:105
+msgid "in Culture.pl"
+msgstr "w Culture.pl"
+
 #: templates/catalogue/viewer_base.html:55
 msgid "Loading"
 msgstr "Ładowanie"
 
-#: views.py:558
+#: views.py:552
 #, python-format
 msgid ""
 "An error occurred: %(exception)s\n"
@@ -770,19 +790,61 @@ msgstr ""
 "\n"
 "%(tb)s"
 
-#: views.py:559
+#: views.py:553
 msgid "Book imported successfully"
 msgstr "Książka zaimportowana"
 
-#: views.py:561
+#: views.py:555
 #, python-format
 msgid "Error importing file: %r"
 msgstr "Błąd podczas importowania pliku: %r"
 
-#: views.py:593
+#: views.py:587
 msgid "Download custom PDF"
 msgstr "Stwórz własny PDF"
 
+#~ msgid "Latest MP3 audiobooks"
+#~ msgstr "Ostatnio dodane audiobooki w formacie MP3"
+
+#~ msgid "Latest Ogg Vorbis audiobooks"
+#~ msgstr "Ostatnio dodane audiobooki w formacie Ogg Vorbis"
+
+#~ msgid "to print"
+#~ msgstr "do druku"
+
+#~ msgid "for an e-book reader"
+#~ msgstr "na czytnik e-booków"
+
+#~ msgid "for Kindle"
+#~ msgstr "na Kindle"
+
+#~ msgid "FictionBook"
+#~ msgstr "FictionBook"
+
+#~ msgid "for advanced usage"
+#~ msgstr "do zadań specjalnych"
+
+#~ msgid "Listen"
+#~ msgstr "Słuchaj"
+
+#~ msgid "See"
+#~ msgstr "Zobacz"
+
+#~ msgid "Download all audiobooks for this book"
+#~ msgstr "Pobierz wszystkie audiobooki tego utworu"
+
+#~ msgid "Themes and topics"
+#~ msgstr "Motywy i tematy"
+
+#~ msgid "Catalogue of the library"
+#~ msgstr "Katalog biblioteki"
+
+#~ msgid "Please wait…"
+#~ msgstr "Proszę czekać…"
+
+#~ msgid "DAISY"
+#~ msgstr "DAISY"
+
 #~ msgid "book count"
 #~ msgstr "liczba książek"
 
index 338fea6..559124b 100644 (file)
@@ -4,13 +4,11 @@
 #
 import os
 import sys
-import time
 from optparse import make_option
 from django.conf import settings
 from django.core.management.base import BaseCommand
 from django.core.management.color import color_style
 from django.core.files import File
-from catalogue.utils import trim_query_log
 from librarian.picture import ImageStore
 from wolnelektury.management.profile import profile
 
@@ -31,8 +29,6 @@ class Command(BaseCommand):
             help="Skip building specified formats"),
         make_option('-S', '--no-search-index', action='store_false', dest='search_index', default=True,
             help='Skip indexing imported works for search'),
-        make_option('-w', '--wait-until', dest='wait_until', metavar='TIME',
-            help='Wait until specified time (Y-M-D h:m:s)'),
         make_option('-p', '--picture', action='store_true', dest='import_picture', default=False,
             help='Import pictures'),
     )
@@ -81,14 +77,6 @@ class Command(BaseCommand):
         verbose = options.get('verbose')
         import_picture = options.get('import_picture')
 
-        wait_until = None
-        if options.get('wait_until'):
-            wait_until = time.mktime(time.strptime(options.get('wait_until'), '%Y-%m-%d %H:%M:%S'))
-            if verbose > 0:
-                print "Will wait until %s; it's %f seconds from now" % (
-                    time.strftime('%Y-%m-%d %H:%M:%S',
-                    time.localtime(wait_until)), wait_until - time.time())
-
         index = None
         if options.get('search_index') and not settings.NO_SEARCH_INDEX:
             index = Index()
@@ -100,74 +88,59 @@ class Command(BaseCommand):
                 raise e
 
         # Start transaction management.
-        transaction.commit_unless_managed()
-        transaction.enter_transaction_management()
-        transaction.managed(True)
-
-        files_imported = 0
-        files_skipped = 0
-
-        for dir_name in directories:
-            if not os.path.isdir(dir_name):
-                print self.style.ERROR("%s: Not a directory. Skipping." % dir_name)
-            else:
-                # files queue
-                files = sorted(os.listdir(dir_name))
-                postponed = {}
-                while files:
-                    trim_query_log(0)
-                    file_name = files.pop(0)
-                    file_path = os.path.join(dir_name, file_name)
-                    file_base, ext = os.path.splitext(file_path)
-
-                    # Skip files that are not XML files
-                    if not ext == '.xml':
-                        continue
-
-                    if verbose > 0:
-                        print "Parsing '%s'" % file_path
-                    else:
-                        sys.stdout.write('.')
-                        sys.stdout.flush()
-
-                    # Import book files
-                    try:
-                        if import_picture:
-                            self.import_picture(file_path, options)
+        with transaction.atomic():
+            files_imported = 0
+            files_skipped = 0
+
+            for dir_name in directories:
+                if not os.path.isdir(dir_name):
+                    print self.style.ERROR("%s: Not a directory. Skipping." % dir_name)
+                else:
+                    # files queue
+                    files = sorted(os.listdir(dir_name))
+                    postponed = {}
+                    while files:
+                        file_name = files.pop(0)
+                        file_path = os.path.join(dir_name, file_name)
+                        file_base, ext = os.path.splitext(file_path)
+
+                        # Skip files that are not XML files
+                        if not ext == '.xml':
+                            continue
+
+                        if verbose > 0:
+                            print "Parsing '%s'" % file_path
                         else:
-                            self.import_book(file_path, options)
-
-                        files_imported += 1
-                        transaction.commit()
-
-                    except (Book.AlreadyExists, Picture.AlreadyExists):
-                        print self.style.ERROR('%s: Book or Picture already imported. Skipping. To overwrite use --force.' %
-                            file_path)
-                        files_skipped += 1
-
-                    except Book.DoesNotExist, e:
-                        if file_name not in postponed or postponed[file_name] < files_imported:
-                            # push it back into the queue, maybe the missing child will show up
-                            if verbose:
-                                print self.style.NOTICE('Waiting for missing children')
-                            files.append(file_name)
-                            postponed[file_name] = files_imported
-                        else:
-                            # we're in a loop, nothing's being imported - some child is really missing
-                            raise e
+                            sys.stdout.write('.')
+                            sys.stdout.flush()
+
+                        # Import book files
+                        try:
+                            if import_picture:
+                                self.import_picture(file_path, options)
+                            else:
+                                self.import_book(file_path, options)
+
+                            files_imported += 1
+
+                        except (Book.AlreadyExists, Picture.AlreadyExists):
+                            print self.style.ERROR('%s: Book or Picture already imported. Skipping. To overwrite use --force.' %
+                                file_path)
+                            files_skipped += 1
+
+                        except Book.DoesNotExist, e:
+                            if file_name not in postponed or postponed[file_name] < files_imported:
+                                # push it back into the queue, maybe the missing child will show up
+                                if verbose:
+                                    print self.style.NOTICE('Waiting for missing children')
+                                files.append(file_name)
+                                postponed[file_name] = files_imported
+                            else:
+                                # we're in a loop, nothing's being imported - some child is really missing
+                                raise e
 
         # Print results
         print
         print "Results: %d files imported, %d skipped, %d total." % (
             files_imported, files_skipped, files_imported + files_skipped)
         print
-
-        if wait_until:
-            print 'Waiting...'
-            try:
-                time.sleep(wait_until - time.time())
-            except IOError:
-                print "it's already too late"
-
-        transaction.commit()
-        transaction.leave_transaction_management()
index 5f68e09..1524c34 100644 (file)
@@ -55,8 +55,8 @@ 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)
-    # files generated during publication
 
+    # files generated during publication
     cover = EbookField('cover', _('cover'),
             null=True, blank=True,
             upload_to=_cover_upload_to,
@@ -96,6 +96,15 @@ class Book(models.Model):
     def __unicode__(self):
         return self.title
 
+    def get_initial(self):
+        try:
+            return re.search(r'\w', self.title, re.U).group(0)
+        except AttributeError:
+            return None
+
+    def author_str(self):
+        return ", ".join(str(t) for t in self.tags.filter(category='author'))
+
     def save(self, force_insert=False, force_update=False, **kwargs):
         from sortify import sortify
 
@@ -311,6 +320,7 @@ class Book(models.Model):
                 notify_cover_changed.append(child)
 
         cls.repopulate_ancestors()
+        tasks.update_counters.delay()
 
         # No saves beyond this point.
 
index 098501e..bae1cc4 100644 (file)
@@ -6,6 +6,7 @@ from django.conf import settings
 from django.db import models
 from django.utils.translation import ugettext_lazy as _
 from ssify import flush_ssi_includes
+import re
 
 
 class Collection(models.Model):
@@ -28,6 +29,12 @@ class Collection(models.Model):
     def __unicode__(self):
         return self.title
 
+    def get_initial(self):
+        try:
+            return re.search(r'\w', self.title, re.U).group(0)
+        except AttributeError:
+            return None
+
     @models.permalink
     def get_absolute_url(self):
         return ("collection", [self.slug])
@@ -39,6 +46,10 @@ class Collection(models.Model):
                     for slug in slugs]
         return models.Q(slug__in=slugs)
 
+    def get_books(self):
+        from catalogue.models import Book
+        return Book.objects.filter(self.get_query())
+
     def flush_includes(self, languages=True):
         if not languages:
             return
index 02bf6c0..5575d6a 100644 (file)
@@ -128,9 +128,21 @@ class Tag(TagBase):
     def __repr__(self):
         return "Tag(slug=%r)" % self.slug
 
+    def get_initial(self):
+        if self.category == 'author':
+            return self.sort_key[0]
+        elif self.name:
+            return self.name[0]
+        else:
+            return None
+
     @permalink
     def get_absolute_url(self):
-        return ('catalogue.views.tagged_object_list', [self.url_chunk])
+        return ('tagged_object_list', [self.url_chunk])
+
+    @permalink
+    def get_absolute_gallery_url(self):
+        return ('tagged_object_list_gallery', [self.url_chunk])
 
     @classmethod
     @permalink
@@ -147,6 +159,7 @@ class Tag(TagBase):
     @staticmethod
     def get_tag_list(tags):
         if isinstance(tags, basestring):
+            if not tags: return []
             real_tags = []
             ambiguous_slugs = []
             category = None
index f8b314b..d1214c5 100644 (file)
  * Date: 1st September 2011\r
  */\r
 \r
+.jp-audio .title {\r
+    font-size: 11px;\r
+    position: relative;\r
+    left: 10px;\r
+    top: 5px;\r
+    z-index: 100;\r
+}\r
+.play-prev, .play-next {\r
+    cursor: pointer;\r
+}\r
+\r
 div.jp-audio,\r
 div.jp-video {\r
 \r
@@ -31,7 +42,7 @@ div.jp-video {
        position:relative;\r
 }\r
 div.jp-audio {\r
-       width:420px;\r
+       width: 340px;\r
 }\r
 div.jp-video-270p {\r
        width:480px;\r
@@ -111,7 +122,7 @@ div.jp-interface ul.jp-controls {
 }
 
 div.jp-audio ul.jp-controls {
-       width: 380px;\r
+       width: 320px;\r
        padding:20px 20px 0 20px;\r
 }
 
@@ -198,8 +209,8 @@ div.jp-audio div.jp-progress {
        height:15px;\r
 }\r
 div.jp-audio div.jp-type-single div.jp-progress {\r
-       left:110px;\r
-       width:186px;\r
+       left:70px;\r
+       width:150px;\r
 }\r
 div.jp-audio div.jp-type-playlist div.jp-progress {\r
        left:166px;\r
@@ -243,7 +254,7 @@ a.jp-volume-max {
 
 div.jp-audio div.jp-type-single a.jp-mute,\r
 div.jp-audio div.jp-type-single a.jp-unmute {
-       margin-left: 210px;     
+       margin-left: 180px;
 }
 
 div.jp-audio div.jp-type-playlist a.jp-mute,\r
@@ -252,7 +263,7 @@ div.jp-audio div.jp-type-playlist a.jp-unmute {
 }
 \r
 div.jp-audio a.jp-volume-max {\r
-       margin-left: 56px;      \r
+       margin-left: 56px;\r
 }\r
 \r
 div.jp-video a.jp-mute,\r
@@ -302,7 +313,7 @@ div.jp-volume-bar {
 }\r
 div.jp-audio div.jp-volume-bar {\r
        top:37px;\r
-       left:330px;\r
+       left:260px;\r
 }\r
 div.jp-video div.jp-volume-bar {\r
        top:17px;\r
@@ -323,8 +334,8 @@ div.jp-audio div.jp-time-holder {
        top:50px;\r
 }\r
 div.jp-audio div.jp-type-single div.jp-time-holder {\r
-       left:110px;\r
-       width:186px;\r
+       left:70px;\r
+       width:150px;\r
 }\r
 div.jp-audio div.jp-type-playlist div.jp-time-holder {\r
        left:166px;\r
@@ -387,6 +398,7 @@ div.jp-title li {
        font-weight:bold;\r
 }\r
 div.jp-playlist li {\r
+    display: none;\r
        padding:5px 0 4px 20px;\r
        border-bottom:1px solid #eee;\r
 }\r
index 69dceed..a41d2c0 100755 (executable)
@@ -1,34 +1,53 @@
 (function($) {
     $(function() {
 
-      $("#jplayer").each(function() {
+      $(".jp-jplayer").each(function() {
        var $self = $(this);
+        var $root = $self.parent();
+        var $number = $('.number', $root);
         $self.jPlayer({
             swfPath: "/static/jplayer/",
             solution: "html,flash",
             supplied: $self.attr('data-supplied'),
-    
+            cssSelectorAncestor: "#" + $self.attr("data-player"),
+
             ready: function() {
                 var player = $(this);
                 var setMedia = function(elem) {
                     var li = $(elem).parent();
-                    $('.jp-playlist-current').removeClass('jp-playlist-current');
-                    $(li).addClass('jp-playlist-current');
                     var media = {}
-    
-                    $('.mp3', li).each(function() {media['mp3'] = $(this).attr('href')});
-                    $('.ogg', li).each(function() {media['oga'] = $(this).attr('href')});
-    
+
+                    media['mp3'] = li.attr('data-mp3');
+                    media['oga'] = li.attr('data-ogg');
+
+                    $(".title", $root).html(li.html());
                     return player.jPlayer("setMedia", media);
                 };
-                setMedia($('.play').first()).jPlayer("play");
-    
-                $('.play').click(function() {
-                    setMedia(this).jPlayer("play");
+
+                $('.play-next', $root).click(function() {
+                    var next = parseInt($number.text()) + 1;
+                    var p = $('.play:eq(' + next + ')', $root);
+                    if (p.length) {
+                        setMedia(p).jPlayer("play");
+                        $number.text(next)
+                    }
+                });
+                $('.play-prev', $root).click(function() {
+                    var next = parseInt($number.text()) - 1;
+                    if (next < 1)
+                        return;
+                    var p = $('.play:eq(' + next + ')', $root);
+                    setMedia(p).jPlayer("play");
+                    $number.text(next)
                 });
+
+                setMedia($('.play', $root).first());
+
             }
         });
       });
 
+
+
     });
-})(jQuery)
\ No newline at end of file
+})(jQuery)
index a2b8be0..4807339 100644 (file)
@@ -57,3 +57,9 @@ def build_custom_pdf(book_id, customizations, file_name, waiter_id=None):
     finally:
         if waiter_id is not None:
             WaitedFile.objects.filter(pk=waiter_id).delete()
+
+
+@task(ignore_result=True)
+def update_counters():
+    from .helpers import update_counters
+    update_counters()
index 75576f4..7eda46e 100644 (file)
@@ -1,21 +1,21 @@
-{% extends "catalogue/book_list.html" %}
+{% extends "base.html" %}
 {% load i18n %}
-{% load catalogue_tags %}
+{% load catalogue_tags switch_tag social_tags %}
 {% load ssi_include from ssify %}
 
-{% block bodyid %}book-a-list{% endblock %}
+{% block titleextra %}{% trans "Audiobooks" %}{% endblock %}
 
-{% block titleextra %}{% trans "Listing of all audiobooks" %}{% endblock %}
+{% block bodyid %}audiobooks{% endblock %}
 
-{% block metadescription %}Darmowe audiobooki na wolnej licencji. Lektury czytane przez znanych aktorów.{% endblock %}
+{% block body %}
+    <h1>{% trans "Audiobooks" %}</h1>
 
-{% block extrahead %}
-    <link rel="alternate" type="application/atom+xml" title="{% trans "Latest MP3 audiobooks" %}" href="{% url 'audiobook_feed' 'mp3' %}" />
-    <link rel="alternate" type="application/atom+xml" title="{% trans "Latest Ogg Vorbis audiobooks" %}" href="{% url 'audiobook_feed' 'ogg' %}" />
-{% endblock %}
+    {% work_list best %}
+    <h2>{% trans "Listing of all audiobooks" %}</h2>
+    {% plain_list books by_author=True %}
+
+    <h2>{% trans "Listing of all DAISY files" %}</h2>
+    {% plain_list daisy by_author=True %}
 
-{% block book_list_header %}{% trans "Listing of all audiobooks" %}{% endblock %}
 
-{% block book_list_info %}
-{% ssi_include 'chunk' key='audiobook-list' %}
 {% endblock %}
index 7e8128f..b87e9eb 100644 (file)
 {% endif %}
 
 <section class="see-also" style="display: inline-block;">
-<h1>{% trans "See also" %}:</h1>
+<h2>{% trans "See also" %}:</h2>
 {% related_books book taken=book.other_versions|length %}
 </section>
 {% endspaceless %}
 
+
+
+{% with book.related_themes as themes %}
+{% if themes %}
+    <h2>{% trans "Themes" %}</h2>
+    {% plain_list themes book=book %}
+{% endif %}
+{% endwith %}
+
+
+
+<h2>{% trans "Information about the work" %}</h2>
+{% for tag in tags %}
+        <div class="white-box">
+            <a style="display:block" href="{{ tag.get_absolute_url }}">
+        {% ssi_include 'catalogue_tag_box' pk=tag.pk %}
+        </a>
+        </div>
+{% endfor %}
+
+
+      {% if extra_info.source_url %}
+      <div class="white-box"><a href="{{ extra_info.source_url }}">{% trans "Source" %}</a> {% trans "of the book" %}
+      {% trans "in" %} {% source_name extra_info.source_url %}</div>
+      {% endif %}
+      <div class="white-box"><a href="{{ book.xml_file.url }}">{% trans "Source XML file" %}</a></div>
+      {% if extra_info.about and not hide_about %}
+      <div class="white-box">{% trans "Book on" %} <a href="{{ extra_info.about }}">{% trans "Editor's Platform" %}</a></div>
+      {% endif %}
+      {% if book.gazeta_link %}
+      <div class="white-box"><a href="{{ book.gazeta_link }}">{% trans "Book description on Lektury.Gazeta.pl" %}</a></div>
+      {% endif %}
+      {% if book.wiki_link %}
+      <div class="white-box"><a href="{{ book.wiki_link }}">{% trans "Book description on Wikipedia" %}</a></div>
+      {% endif %}
+      <div class="white-box"><a href="{% url 'poem_from_book' book.slug %}">{% trans "Mix this book" %}</a></div>
+
+
+
+
 {% endblock %}
index b069cb5..a2b0a5c 100644 (file)
 <div class="book-box-body">
 
 
-{% likes_book book.pk as likes %}
-<div class="star {{ likes.if }}{{ likes.else }}un{{ likes.endif }}like">
-    <div class="if-like" >
-        <a id="social-book-sets-{{ book.slug }}" data-callback='social-book-sets' class='ajaxable' href='{% url "social_book_sets" book.slug %}'>★</a>
-    </div>
-    <div class="if-unlike">
-        <form id="social-like-book-{{ book.slug }}" data-callback='social-like-book' method='post' class='ajax-form' action='{% url "social_like_book" book.slug %}'>
-            {% ssi_csrf_token %}
-            <button type='submit'>☆</button>
-        </form>
+    {% likes_book book.pk as likes %}
+    <div class="star {{ likes.if }}{{ likes.else }}un{{ likes.endif }}like">
+        <div class="if-like" >
+            <a id="social-book-sets-{{ book.slug }}" data-callback='social-book-sets' class='ajaxable' href='{% url "social_book_sets" book.slug %}'>★</a>
+        </div>
+        <div class="if-unlike">
+            <form id="social-like-book-{{ book.slug }}" data-callback='social-like-book' method='post' class='ajax-form' action='{% url "social_like_book" book.slug %}'>
+                {% ssi_csrf_token %}
+                <button type='submit'>☆</button>
+            </form>
+        </div>
     </div>
-</div>
-
 
-        <div class="book-box-head">
-            <div class="author">
-                {% for tag in tags.author %}
-                    <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>{% if not forloop.last %},
-                {% endif %}{% endfor %}{% for parent in parents %},
-                    <a href="{{ parent.get_absolute_url }}">{{ parent.title }}</a>{% endfor %}
-            </div>
-            <div class="title">
-                {% if main_link %}<a href="{{ main_link }}">{% endif %}{{ book.title }}{% if main_link %}</a>{% endif %}
-            </div>
+    <div class="book-box-head">
+        <div class="author">
+            {% for tag in tags.author %}
+                <a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a>{% if not forloop.last %},
+            {% endif %}{% endfor %}{% for parent in parents %},
+                <a href="{{ parent.get_absolute_url }}">{{ parent.title }}</a>{% endfor %}
+        </div>
+        <div class="title">
+            {% if main_link %}<a href="{{ main_link }}">{% endif %}{{ book.title }}{% if main_link %}</a>{% endif %}
         </div>
+    </div>
+
+    <div class="cover-area">
+        {% if book.cover_thumb %}
+            {% 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="cover-area">
-    {% if book.cover_thumb %}
-        {% 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 %}
 
             <a href="{% url 'book_text' book.slug %}" class="downarrow">{% trans "Read online" %}</a>
         {% endif %}
         </li>
-        <li class="book-box-download hoverget">
-            <a class="downarrow hoverclick">{% trans "Download" %}</a>
+        <li class="book-box-download">
+            <a class="downarrow">{% 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>
+             <span><a href="{{ book.pdf_file.url}}">PDF</a></span>
              {% endif %}
-             {% if  book.epub_file %}
-             <span><a href="{{ book.epub_file.url}}">EPUB</a> {% trans "for an e-book reader" %}</span>
+             {% custom_pdf_link_li book %}
+             {% if book.epub_file %}
+             <span><a href="{{ book.epub_file.url}}">EPUB</a></span>
              {% endif %}
-             {% if  book.mobi_file %}
-             <span><a href="{{ book.mobi_file.url}}">MOBI</a> {% trans "for Kindle" %}</span>
+             {% if book.mobi_file %}
+             <span><a href="{{ book.mobi_file.url}}">MOBI</a></span>
              {% endif %}
              {% if  book.fb2_file %}
-             <span><a href="{{ book.fb2_file.url}}">FB2</a> {% trans "FictionBook" %}</span>
+             <span><a href="{{ book.fb2_file.url}}">FB2</a></span>
              {% endif %}
              {% if  book.txt_file %}
-             <span><a href="{{ book.txt_file.url}}">TXT</a> {% trans "for advanced usage" %}</span>
+             <span><a href="{{ book.txt_file.url}}">TXT</a></span>
              {% endif %}
+             {% download_audio book %}
             </div>
-        </li>
-        <li class="book-box-audiobook">
-        {% if has_audio %}
-            <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 %}
+
+
+{% if audiobooks %}
+<div class="jp-type-playlist">
+  <div id="jplayer" class="jp-jplayer" data-player="jp_container_{{ book.pk }}"
+    data-supplied="{% if have_oggs %}oga,{% endif %}mp3"></div>
+  <div id="jp_container_{{ book.pk }}" class="jp-audio">
+    <div class="jp-type-single">
+        <span class="title"></span>
+      <div class="jp-gui jp-interface">
+        <ul class="jp-controls">
+          <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
+          <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
+          <li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
+          <li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
+        </ul>
+        <div class="jp-progress">
+          <div class="jp-seek-bar">
+            <div class="jp-play-bar"></div>
+          </div>
+        </div>
+        <div class="jp-volume-bar">
+          <div class="jp-volume-bar-value"></div>
+        </div>
+        <div class="jp-time-holder">
+          <div class="jp-current-time"></div>
+          <div class="jp-duration"></div>
+        </div>
+      </div>
+      <div class="jp-playlist">
+        <ul>
+
+        {% for i in audiobooks %}
+          <li data-mp3='{{ i.mp3.file.url }}' data-ogg='{{ i.ogg.file.url }}'>
+            <div class='play'>{{ i.mp3.name }}
+            <div class='extra-info'>
+              {% trans "Artist" %}: <span class='artist'>{{ i.mp3.extra_info.artist_name }}</span>,
+              {% trans "Director" %}: <span class='director'>{{ i.mp3.extra_info.director_name }}</span>
+            </div>
+            </div>
+          </li>
+        {% endfor %}
+
+        </ul>
+      </div>
+
+      <div class="jp-no-solution">
+        <span>Update Required</span>
+        To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
+      </div>
+    </div>
+  </div>
+<div>
+<a class="play-prev">« {% trans "previous" %}</a>
+{% trans "Part" %} <span class="number">1</span> / {{ audiobooks|length }}
+<a class="play-next">{% trans "next" %} »</a>
+</div>
+</div>
+
+
+{% endif %}
+
+
     <div class="clearboth"></div>
 </div>
 </div>
-{% endspaceless %}
\ No newline at end of file
+{% endspaceless %}
index b84acdb..4d56175 100644 (file)
 
 
 
-{% block book-box-extra-info %}
-{% if themes %}
-    <div class="hidden-box-wrapper" id="theme-list-wrapper">
-        <p><a class="mono hidden-box-trigger theme-list-link"
-                href="#">{% trans "Motifs and themes" %}</a></p>
-        <div class="hidden-box">
-            <ul>
-            {% for theme in themes %}
-                <li><a href="{% url 'book_fragments' book.slug theme.slug %}">{{ theme }} ({{ theme.count }})</a></li>
-            {% endfor %}
-            </ul>
-        </div>
-    </div>
-{% else %}
-       <p>&nbsp;</p>
-{% endif %}
-{% endblock %}
 
 
 {% block right-column %}
     {{ fragment_promo.endif }}
   </div>
 
-  <div class="other-tools">
-    <h2 class="mono">{% trans "See" %}</h2>
-    <ul class="plain">
-      {% if extra_info.source_url %}
-      <li><a href="{{ extra_info.source_url }}">{% trans "Source" %}</a> {% trans "of the book" %}
-        {% trans "in" %} {% source_name extra_info.source_url %}</li>
-      {% endif %}
-      <li><a href="{{ book.xml_file.url }}">{% trans "Source XML file" %}</a></li>
-      {% if extra_info.about and not hide_about %}
-      <li>{% trans "Book on" %} <a href="{{ extra_info.about }}">{% trans "Editor's Platform" %}</a></li>
-      {% endif %}
-      {% if book.gazeta_link %}
-      <li><a href="{{ book.gazeta_link }}">{% trans "Book description on Lektury.Gazeta.pl" %}</a></li>
-      {% endif %}
-      {% if book.wiki_link %}
-      <li><a href="{{ book.wiki_link }}">{% trans "Book description on Wikipedia" %}</a></li>
-      {% endif %}
-      <li><a href="{% url 'poem_from_book' book.slug %}">{% trans "Mix this book" %}</a></li>
-    </ul>
-  </div>
-  <div class="other-download">
-    <h2 class="mono">{% trans "Download" %}</h2>
-    <ul class="plain">
-      <li>
-       {% if related.media.mp3 or related.media.ogg or related.media.daisy %}
-        {% trans "Download all audiobooks for this book" %}:
-           {% download_audio book %}. 
-       {% endif %}
-      </li>
-      {% custom_pdf_link_li book %}
-    </ul>
-  </div>
 </div>
 {% endblock %}
index c7cee40..6b69578 100644 (file)
@@ -8,7 +8,8 @@
 {% block bodyid %}catalogue-catalogue{% endblock %}
 
 {% block body %}
-    <h1>{% trans "Catalogue" %}</h1>
+    <h1>{% trans "All works" %}</h1>
+
 
     <div class="normal-text catalogue-catalogue">
 
         {% trans "Download the catalogue in PDF format." %}
     </a></p>
 
-    <h2 class="white-box">{% trans "Authors" %}<a name="autorzy"></a></h2>
-    <div class="white-box">{{ output.author }}</div>
-
-    <h2 class="white-box">{% trans "Kinds" %}<a name="rodzaje"></a></h2>
-    <div class="white-box" lang="pl">{{ output.kind }}</div>
-
-    <h2 class="white-box">{% trans "Genres" %}<a name="gatunki"></a></h2>
-    <div class="white-box" lang="pl">{{ output.genre }}</div>
+    <h2>{% trans "Literature" %}</h2>
+    {% plain_list books by_author=True paged=False %}
 
-    <h2 class="white-box">{% trans "Epochs" %}<a name="epoki"></a></h2>
-    <div class="white-box" lang="pl">{{ output.epoch }}</div>
+    <h2>{% trans "Collections" %}</h2>
+    {% plain_list collections paged=False %}
 
-    <h2 class="white-box">{% trans "Themes and topics" %}<a name="motywy"></a></h2>
-    <div class="white-box" lang="pl">{{ output.theme }}</div>
+    <h2>{% trans "Gallery" %}</h2>
+    {% plain_list pictures by_author=True paged=False %}
 
-    <h2 class="white-box">{% trans "Collections" %}<a name="kolekcje"></a></h2>
-    <div class="white-box" lang="pl">{{ output.collections }}</div>
 
     </div>
 {% endblock %}
index 4bb12c9..cf43ef3 100755 (executable)
@@ -1,10 +1,17 @@
-{% extends "catalogue/book_list.html" %}
+{% extends "base.html" %}
 {% load i18n %}
+{% load catalogue_tags %}
 
-{% block titleextra %}{{ context.collection.title }}{% endblock %}
+{% block titleextra %}{{ collection.title }}{% endblock %}
+
+{% block bodyid %}collection{% endblock %}
+
+{% block body %}
+    <h1>{{ collection.title }}</h1>
+
+    {{ collection.description|safe }}
+
+    {% plain_list collection.get_books by_author=True %}
 
-{% block book_list_header %}{{ context.collection.title }}{% endblock %}
 
-{% block book_list_info %}
-{{ context.collection.description|safe }}
 {% endblock %}
diff --git a/src/catalogue/templates/catalogue/collection_box.html b/src/catalogue/templates/catalogue/collection_box.html
new file mode 100644 (file)
index 0000000..7c09294
--- /dev/null
@@ -0,0 +1,21 @@
+{% spaceless %}
+{% load i18n %}
+{% load ssi_include from ssify %}
+<div class="collection-box white-box">
+    <h2><a href="{{ obj.get_absolute_url }}">{% trans "Collection" %}: {{ obj }}</a></h2>
+    {% if obj.description %}
+    {{ obj.description|safe|truncatewords_html:40 }}
+    {% endif %}
+    {% for b in obj.get_books|slice:":5" %}
+        {% ssi_include 'catalogue_book_mini' pk=b.pk %}
+    {% endfor %}
+    {% with obj.get_books.count|add:-5 as more %}
+        {% if more > 0 %}
+            <a href="{{ obj.get_absolute_url }}">
+                {% blocktrans with c=more %}and {{ c }} more{% endblocktrans %}
+            </a>
+        {% endif %}
+    {% endwith %}
+
+</div>
+{% endspaceless %}
diff --git a/src/catalogue/templates/catalogue/collections.html b/src/catalogue/templates/catalogue/collections.html
new file mode 100644 (file)
index 0000000..1c69872
--- /dev/null
@@ -0,0 +1,22 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load catalogue_tags %}
+{% load ssi_include from ssify %}
+
+{% block titleextra %}{% trans "Collections" %}{% endblock %}
+
+{% block bodyid %}collections{% endblock %}
+
+{% block body %}
+    <h1>{% trans "Collections" %}</h1>
+
+    {% for obj in best %}
+        {% ssi_include 'catalogue_collection_box' pk=obj.pk %}
+    {% endfor %}
+
+    <h2>{% trans "All collections" %}</h2>
+    {% plain_list objects %}
+
+
+
+{% endblock %}
index 59b1acc..920b555 100755 (executable)
@@ -1,17 +1,37 @@
 {% load i18n %}
 {% load catalogue_tags %}
-{% if one_tag %}
-    {% trans "See full category" %} <a href="{% catalogue_url one_tag %}">{{ one_tag }}</a>
-{% else %}
-       <ul>
        {% if choices %}
+        {% if category_choices %}
+            <ul>
+            <li class="header">{% trans "Chosen" %}:</li>
+            {% for tag in category_choices %}
+                <li class="active">{{ tag }} <a href="{% if gallery %}{% catalogue_url_gallery choices -tag %}{% else %}{% catalogue_url choices -tag %}{% endif %}">X</a></li>
+            {% endfor %}
+            </ul>
+        {% endif %}
+        {% if tags %}
+        <ul>
+        <li class="header">{% trans "Available" %}:</li>
         {% for tag in tags %}
-            <li><a href="{% catalogue_url choices tag %}">{{ tag }}{% if tag.count %}&nbsp;({{ tag.count }}){% endif %}</a></li>
+            <li><a href="{% if gallery %}{% catalogue_url_gallery choices tag %}{% else %}{% catalogue_url choices tag %}{% endif %}">{{ tag }}{% if tag.count %}&nbsp;({{ tag.count }}){% endif %}</a></li>
         {% endfor %}
-        {% else %}
+        </ul>
+        {% endif %}
+    {% else %}
+        {% if tags %}
+        <ul>
+        <li class="header">{% trans "Available" %}:</li>
         {% for tag in tags %}
-            <li><a href="{{ tag.get_absolute_url }}">{% if tag.count %}&nbsp;({{ tag.count }}){% endif %}</a></li>
+            <li><a href="{% if gallery %}{{ tag.get_absolute_gallery_url }}{% else %}{{ tag.get_absolute_url }}{% endif %}">{{ tag }} {% if tag.count %}&nbsp;({{ tag.count }}){% endif %}</a></li>
         {% endfor %}
+        </ul>
+        {% endif %}
     {% endif %}
+    {% if other %}
+       <ul>
+        <li class="header">{% trans "Other" %}:</li>
+        {% for tag in other %}
+            <li class="other"><a href="{% if gallery %}{{ tag.get_absolute_gallery_url }}{% else %}{{ tag.get_absolute_url }}{% endif %}">{{ tag }}</a></li>
+        {% endfor %}
     </ul>
-{% endif %}
+    {% endif %}
diff --git a/src/catalogue/templates/catalogue/menu.html b/src/catalogue/templates/catalogue/menu.html
deleted file mode 100644 (file)
index 5ddbd3b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-{% spaceless %}
-{% load i18n static %}
-
-<a id="show-menu" href="{% url 'catalogue' %}">
-    <span class="long">{% trans "Catalogue of the library" %}</span>
-    <span class="short">{% trans "Catalogue" %}</span>
-</a>
-<ul id="menu">
-    {% for category, name, hash in categories %}
-       <li class="hidden-box-wrapper menu">
-               <a href="{% url 'catalogue' %}#{{ hash }}" class="hidden-box-trigger menu load-menu">{{ name }}</a>
-               <div class="hidden-box" id="menu-{{ category }}">
-            <img src="{% static "img/indicator.gif" %}" alt="{% trans "Please wait…" %}" />
-        </div>
-       </li>
-    {% endfor %}
-
-       <li class="hidden-box-wrapper menu">
-               <a href="{% url 'catalogue' %}#kolekcje" class="hidden-box-trigger menu load-menu">{% trans "Collections" %}</a>
-               <div class="hidden-box" id="menu-collections">
-            <img src="{% static "img/indicator.gif" %}" alt="{% trans "Please wait…" %}" />
-        </div>
-       </li>
-
-       <li class="menu">
-               <a href="{% url 'book_list' %}" class="menu">{% trans "All books" %}</a>
-       </li>
-       <li class="menu">
-               <a href="{% url 'audiobook_list' %}" class="menu">{% trans "Audiobooks" %}</a>
-       </li>
-       <li class="menu">
-               <a href="{% url 'daisy_list' %}" class="menu">{% trans "DAISY" %}</a>
-       </li>
-       <li class="menu">
-               <a href="{% url 'picture_list_thumb' %}" class="menu">
-                       <span class='mono'>{% trans "Gallery" %}</span></a>
-       </li>
-
-</ul>
-
-{% endspaceless %}
\ No newline at end of file
diff --git a/src/catalogue/templates/catalogue/plain_list.html b/src/catalogue/templates/catalogue/plain_list.html
new file mode 100644 (file)
index 0000000..276e55e
--- /dev/null
@@ -0,0 +1,19 @@
+{% spaceless %}
+{% load catalogue_tags %}
+
+
+<div class='{% if paged %}plain-list-paged {% endif %}plain-list-container white-box'>
+<div class='plain-list' style=''>
+{% for initial, object_list in names %}
+    {% if initial %}
+        <p class="header">{{ initial }}</p>
+    {% endif %}
+    {% for item in object_list %}
+        <p><a href="{% if book %}{% url 'book_fragments' book.slug item.slug %}{% elif choice %}{% if gallery %}{% catalogue_url_gallery choice item %}{% else %}{% catalogue_url choice item %}{% endif %}{% elif gallery %}{{ item.get_absolute_gallery_url }}{% else %}{{ item.get_absolute_url }}{% endif %}">{{ item }}{% if item.count %}&nbsp;({{ item.count}}){% endif %}</a></p>
+    {% endfor %}
+{% endfor %}
+</div>
+<div class="pager"></div>
+</div>
+
+{% endspaceless %}
index 701fbe8..5ddb913 100755 (executable)
@@ -6,7 +6,7 @@
     {% load thumbnail %}
     <head>
         <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
-        <meta name="description" 
+        <meta name="description"
             content="{{ book.title }} - darmowy audiobook na wolnej licencji" />
         <title>{% trans "Wolne Lektury" %} ::
             {{ book.title }} - {{ audiobook }}</title>
@@ -26,7 +26,7 @@
                 {% endthumbnail %}
             " alt="Cover" style="float: left; margin: .5em 1em 1em 1em;" />
         {% endif %}
-       
+
 
 <h1>{% book_title book %}</h1>
 
 
         {% for i in audiobooks %}
           <li>
-            <span class='jp-free-media'>
-              (<a class='mp3' href='{{ i.mp3.file.url }}'>mp3</a>{% if i.ogg %}
-              | <a class='ogg' href='{{ i.ogg.file.url }}'>ogg</a>{% endif %})
-            </span>
             <div class='play'>{{ i.mp3.name }}
             <div class='extra-info'>
               {% trans "Artist" %}: <span class='artist'>{{ i.mp3.extra_info.artist_name }}</span>,
index d1e1ded..24a7a79 100644 (file)
       <div class="inline-tag-lists top-tag-list">
        {% if tags.author %}
        <div>
-         <div class="mono inline-header">{% trans "Authors" %}:</div>
-         <div class="inline-body">
-           {% inline_tag_list tags.author %}
-         </div>
+         <h2>{% trans "Authors" %}:</h2>
+      {% for tag in tags.author %}
+      <a class="tag-box" href="{{ tag.get_absolute_url }}">
+      {% ssi_include "catalogue_tag_box" pk=tag.pk %}
+      </a>
+      {% endfor %}
        </div>
        {% endif %}
        {% if tags.kind %}
        <div>
-         <div class="mono inline-header">{% trans "Kinds" %}:</div>
-         <div class="inline-body">
-           {% inline_tag_list tags.kind %}
-         </div>
+         <h2>{% trans "Kinds" %}:</h2>
+      {% for tag in tags.kind %}
+      <a class="tag-box" href="{{ tag.get_absolute_url }}">
+      {% ssi_include "catalogue_tag_box" pk=tag.pk %}
+      </a>
+      {% endfor %}
        </div>
        {% endif %}
        {% if tags.genre %}
        <div>
-         <div class="mono inline-header">{% trans "Genres" %}:</div>
-         <div class="inline-body">
-           {% inline_tag_list tags.genre  %}
-         </div>
+         <h2>{% trans "Genres" %}:</h2>
+      {% for tag in tags.genre %}
+      <a class="tag-box" href="{{ tag.get_absolute_url }}">
+      {% ssi_include "catalogue_tag_box" pk=tag.pk %}
+      </a>
+      {% endfor %}
        </div>
        {% endif %}
        {% if tags.epoch %}
        <div class="inline-tag-list">
-         <div class="mono inline-header">{% trans "Epochs" %}:</div>
-         <div class="inline-body">
-           {% inline_tag_list tags.epoch  %}
-         </div>
+         <h2>{% trans "Epochs" %}:</h2>
+      {% for tag in tags.epoch %}
+      <a class="tag-box" href="{{ tag.get_absolute_url }}">
+      {% ssi_include "catalogue_tag_box" pk=tag.pk %}
+      </a>
+      {% endfor %}
        </div>
        {% endif %}
       </div>
@@ -63,7 +71,7 @@
       </ol>
     </div>
     {% endif %}
-    
+
     {% if results.author %}
     <div class="book-list-header">
       <div class="book-box-inner">
index 353ad8b..1528f3a 100644 (file)
@@ -1,7 +1,4 @@
 {% load i18n %}
 {% if not NO_CUSTOM_PDF %}
-<li>
-    <a href="{% url 'custom_pdf_form' book.slug %}" id="custom-pdf"
-        class="ajaxable">{% trans "Download a custom PDF" %}</a>
-</li>
+    <a href="{% url 'custom_pdf_form' book.slug %}">{% trans "Download a custom PDF" %}</a>
 {% endif %}
diff --git a/src/catalogue/templates/catalogue/tag_box.html b/src/catalogue/templates/catalogue/tag_box.html
new file mode 100644 (file)
index 0000000..122b670
--- /dev/null
@@ -0,0 +1,13 @@
+{% spaceless %}
+{% load i18n %}
+{% load catalogue_tags %}
+<div class="white-box normal-text">
+    <h2>{% trans tag.category as c %}{{ c|capfirst }}: {{ tag }}</h2>
+    {% if tag.description %}
+    {{ tag.description|safe|truncatewords_html:40 }}
+    {% else %}
+    <em>No description</em>
+    {% endif %}
+
+</div>
+{% endspaceless %}
diff --git a/src/catalogue/templates/catalogue/tag_catalogue.html b/src/catalogue/templates/catalogue/tag_catalogue.html
new file mode 100644 (file)
index 0000000..0279a0e
--- /dev/null
@@ -0,0 +1,23 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load plain_list from catalogue_tags %}
+{% load ssi_include from ssify %}
+
+{% block titleextra %}{{ title }}{% endblock %}
+
+{% block bodyid %}tag-catalogue{% endblock %}
+
+{% block body %}
+<h1>{{ title|title }} {% trans "on Wolne Lektury" %}</h1>
+
+{% for tag in best %}
+      <a class="tag-box" href="{{ tag.get_absolute_url }}">
+      {% ssi_include "catalogue_tag_box" pk=tag.pk %}
+      </a>
+{% endfor %}
+
+<h2>All {{ title }}</h2>
+
+{% plain_list tags %}
+
+{% endblock %}
index 3df560a..033cf9a 100644 (file)
 {% load catalogue_tags switch_tag social_tags %}
 {% load ssi_include from ssify %}
 
-{% block titleextra %}{% title_from_tags tags %}{% endblock %}
+{% block titleextra %}{% if tags %}{% title_from_tags tags %}{% elif gallery %}{% trans "Gallery" %}{% else %}{% trans "Literature" %}{% endif %}{% endblock %}
 
 {% block bodyid %}tagged-object-list{% endblock %}
 
 {% block body %}
-<div class="left-column">
-  <div class="page-desc">
-    <h1>{% html_title_from_tags tags %}</h1>
-
-    {% with tags|last as last_tag %}
-    {% if last_tag.has_description %}
-    <div id="description" class="normal-text">
-      <div id='description-long' style="display:none">{{ last_tag.description|safe }}</div>
-      <div id='description-short'>{{ last_tag.description|safe|truncatewords_html:40 }}</div>
+<div class="tabbed-filter">
+    <h1>{% if tags %}
+        {% html_title_from_tags tags %}
+        {% elif gallery %}{% trans "Gallery" %}{% else %}{% trans "Literature" %}
+        {% endif %}
+    </h1>
+
+    <div class="tabs">
+        <a class="tab white-box" data-id="authors">{% trans "Authors" %}</a>
+        <a class="tab white-box" data-id="epochs">{% trans "Epochs" %}</a>
+        <a class="tab white-box" data-id="genres">{% trans "Genres" %}</a>
+        <a class="tab white-box" data-id="kinds">{% trans "Kinds" %}</a>
+        {% if theme_is_set %}
+        <a class="tab white-box" data-id="themes">{% trans "Themes" %}</a>
+        {% endif %}
     </div>
-    {% endif %}
 
-    <div class="clearboth"></div>
-    <div class="inline-tag-lists">
-      {% if categories.author %}
-      <div>
-       <div class="mono inline-header">{% trans "Authors" %}:</div>
-       <div class="inline-body">
-         {% inline_tag_list categories.author tags %}
-        </div>
-      </div>
-      {% endif %}
-      {% if categories.kind %}
-      <div>
-       <div class="mono inline-header">{% trans "Kinds" %}:</div>
-       <div class="inline-body">
-         {% inline_tag_list categories.kind tags %}
-        </div>
-      </div>
-      {% endif %}
-      {% if categories.genre %}
-      <div>
-       <div class="mono inline-header">{% trans "Genres" %}:</div>
-       <div class="inline-body">
-         {% inline_tag_list categories.genre tags %}
-        </div>
-      </div>
-      {% endif %}
-      {% if categories.epoch %}
-      <div class="inline-tag-list">
-       <div class="mono inline-header">{% trans "Epochs" %}:</div>
-       <div class="inline-body">
-         {% inline_tag_list categories.epoch tags %}
-        </div>
-      </div>
-      {% endif %}
-
-      {% if categories.theme %}
-      <div class="hidden-box-wrapper">
-       <p><a href="#" class="hidden-box-trigger theme-list-link mono">
-            {% trans "Motifs and themes" %}</a></p>
-       <div class="hidden-box">
-          {% tag_list categories.theme tags %}
-       </div>
-      </div>
-      {% endif %}
+</div>
+<div class="tabbed-filter-contents">
+    <div id="authors" class="white-box normal-text tab-content">
+        {% inline_tag_list categories.author tags 'author' gallery=gallery %}
+    </div>
+    <div id="epochs" class="white-box normal-text tab-content">
+        {% inline_tag_list categories.epoch tags 'epoch' gallery=gallery %}
     </div>
+    <div id="genres" class="white-box normal-text tab-content">
+        {% inline_tag_list categories.genre tags 'genre' gallery=gallery %}
+    </div>
+    <div id="kinds" class="white-box normal-text tab-content">
+        {% inline_tag_list categories.kind tags 'kind' gallery=gallery %}
+    </div>
+    {% if theme_is_set %}
+        <div id="themes" class="white-box normal-text tab-content">
+            {% inline_tag_list categories.theme tags 'theme' gallery=gallery %}
+        </div>
+    {% endif %}
+</div>
 
-    <div class="clearboth"></div>
 
 
-       {% if theme_is_set %}
-        <div class="see-also">
-            {% if last_tag.gazeta_link or last_tag.wiki_link %}
-            <h2 class='mono'>{% trans "See also" %}:</h2>
-            <ul>
-        {% if last_tag.culturepl_link %}
-        <li><a href="{{ last_tag.gazeta_link }}">
-               {% trans "in Culture.pl" %}
-        </a></li>
-        {% endif %}
-        {% if last_tag.gazeta_link %}
-        <li><a href="{{ last_tag.gazeta_link }}">
-               {% trans "in Lektury.Gazeta.pl" %}
-        </a></li>
-        {% endif %}
-        {% if last_tag.wiki_link %}
-        <li><a href="{{ last_tag.wiki_link }}">
-                       {% trans "in Wikipedia" %}
-        </a></li>
+
+    {% if theme_is_set %}
+        {% work_list object_list %}
+    {% else %}
+    <div id="books-list">
+        {% if object_list %}
+            {% work_list best %}
+            <h2>{% trans "All matching works" %}</h2>
+            {% plain_list object_list by_author=True gallery=gallery %}
+        {% else %}
+            {% trans "Sorry! Search cirteria did not match any resources." %}
+            {% include "info/join_us.html" %}
         {% endif %}
-            </ul>
-            {% endif %}
-        </div>
-    {% endif %}
+    </div>
 
 
-    </div>
-    </div>
 
 
-    <div class="right-column">
-        {% if theme_is_set %}
-            {% work_list object_list %}
-        {% else %}
+{% if categories.theme %}
+    <h2>{% trans "Motifs and themes" %}</h2>
+    {% plain_list categories.theme choice=tags gallery=gallery %}
+{% endif %}
 
-        {% choose_cite tag_ids=tag_ids as cite_promo_pk %}
-        {% choose_fragment tag_ids=tag_ids unless=cite_promo_pk as fragment_promo_pk %}
-        {{ cite_promo_pk.if }}
-            {% ssi_include 'social_cite' pk=cite_promo_pk %}
-        {{ cite_promo_pk.endif }}
-        {{ fragment_promo_pk.if }}
-            {% ssi_include 'catalogue_fragment_promo' pk=fragment_promo_pk %}
-        {{ fragment_promo_pk.endif }}
-
-        <div class="see-also">
-            {% if last_tag.gazeta_link or last_tag.wiki_link %}
-            <h2 class='mono'>{% trans "See also" %}:</h2>
-            <ul>
-        {% if last_tag.gazeta_link %}
-        <li><a href="{{ last_tag.gazeta_link }}">
-            {% trans "in Lektury.Gazeta.pl" %}
-        </a></li>
-        {% endif %}
-        {% if last_tag.wiki_link %}
-        <li><a href="{{ last_tag.wiki_link }}">
-           {% trans "in Wikipedia" %}
-        </a></li>
+
+
+{% endif %}
+
+
+
+    {% for tag in tags %}
+    {% if tag.category != 'set' %}
+    <h2>{% trans tag.category as c %}{{ c|capfirst }}: {{ tag }}</h2>
+        <div class="white-box">
+        {% if tag.has_description %}
+            {{ tag.description|safe }}
+        {% else %}
+            <em>{% trans "No description." %}</em>
         {% endif %}
-       {% if last_tag.culturepl_link %}
-       <li><a href="{{ last_tag.culturepl_link }}">
-           {% trans "in Culture.pl" %}
-       </a></li>
-       {% endif %}
-            </ul>
-            {% endif %}
         </div>
 
-        <div class="download">
-            {% comment %}
-            <h2 class='mono'>{% trans "Download" %}:</h2>
-            <ul>
-                <li><a href="">wszystko</a></li>
-                <li><a href="">część</a></li>
-            </ul>
-            {% endcomment %}
-        </div>
+        {% if tag.gazeta_link %}
+        <div class="white-box"><a href="{{ tag.gazeta_link }}">
+            {{ tag }} {% trans "in Lektury.Gazeta.pl" %}
+        </a></div>
         {% endif %}
+        {% if tag.wiki_link %}
+        <div class="white-box">
+        <a href="{{ tag.wiki_link }}">
+            {{ tag }} {% trans "in Wikipedia" %}
+        </a></div>
+        {% endif %}
+        {% if tag.culturepl_link %}
+        <div class="white-box">
+        <a href="{{ tag.culturepl_link }}">
+            {{ tag }} {% trans "in Culture.pl" %}
+        </a></div>
+        {% endif %}
+    {% endif %}
+    {% endfor %}
 
-    </div>
 
-    <div class="clearboth"></div>
 
 
 
-    {% if not theme_is_set %}
-    <div id="books-list">
-        {% if object_list %}
-            {% work_list object_list %}
-        {% else %}
-            {% trans "Sorry! Search cirteria did not match any resources." %}
-            {% include "info/join_us.html" %}
-        {% endif %}
-    </div>
-    {% endif %}
-    {% endwith %}
 {% endblock %}
index 6e81cae..fd914e3 100644 (file)
@@ -4,6 +4,7 @@
 #
 from random import randint, random
 from urlparse import urlparse
+from django.contrib.contenttypes.models import ContentType
 
 from django.conf import settings
 from django import template
@@ -242,10 +243,26 @@ def catalogue_url(parser, token):
     return CatalogueURLNode(tags_to_add, tags_to_remove)
 
 
+@register.tag
+def catalogue_url_gallery(parser, token):
+    bits = token.split_contents()
+
+    tags_to_add = []
+    tags_to_remove = []
+    for bit in bits[1:]:
+        if bit[0] == '-':
+            tags_to_remove.append(bit[1:])
+        else:
+            tags_to_add.append(bit)
+
+    return CatalogueURLNode(tags_to_add, tags_to_remove, gallery=True)
+
+
 class CatalogueURLNode(Node):
-    def __init__(self, tags_to_add, tags_to_remove):
+    def __init__(self, tags_to_add, tags_to_remove, gallery=False):
         self.tags_to_add = [Variable(tag) for tag in tags_to_add]
         self.tags_to_remove = [Variable(tag) for tag in tags_to_remove]
+        self.gallery = gallery
 
     def render(self, context):
         tags_to_add = []
@@ -273,23 +290,40 @@ class CatalogueURLNode(Node):
                 pass
 
         if len(tag_slugs) > 0:
-            return reverse('tagged_object_list', kwargs={'tags': '/'.join(tag_slugs)})
+            if self.gallery:
+                return reverse('tagged_object_list_gallery', kwargs={'tags': '/'.join(tag_slugs)})
+            else:
+                return reverse('tagged_object_list', kwargs={'tags': '/'.join(tag_slugs)})
         else:
-            return reverse('main_page')
+            return reverse('book_list')
 
 
 @register.inclusion_tag('catalogue/tag_list.html')
-def tag_list(tags, choices=None):
+def tag_list(tags, choices=None, category=None, gallery=False):
+    print(tags, choices, category)
     if choices is None:
         choices = []
-    if len(tags) == 1 and tags[0].category not in [t.category for t in choices]:
+
+    if category is None and tags:
+        category = tags[0].category
+
+    category_choices = [tag for tag in choices if tag.category == category]
+
+    if len(tags) == 1 and category not in [t.category for t in choices]:
         one_tag = tags[0]
+
+    if category is not None:
+        other = Tag.objects.filter(category=category).exclude(pk__in=[t.pk for t in tags]).exclude(pk__in=[t.pk for t in category_choices])
+        # Filter out empty tags.
+        ct = ContentType.objects.get_for_model(Picture if gallery else Book)
+        other = other.filter(items__content_type=ct).distinct()
+
     return locals()
 
 
 @register.inclusion_tag('catalogue/inline_tag_list.html')
-def inline_tag_list(tags, choices=None):
-    return tag_list(tags, choices)
+def inline_tag_list(tags, choices=None, category=None, gallery=False):
+    return tag_list(tags, choices, category, gallery)
 
 
 @register.inclusion_tag('catalogue/collection_list.html')
@@ -311,6 +345,25 @@ def work_list(context, object_list):
     return locals()
 
 
+
+@register.inclusion_tag('catalogue/plain_list.html', takes_context=True)
+def plain_list(context, object_list, with_initials=True, by_author=False, choice=None, book=None, gallery=False, paged=True):
+    names = [(None, [])]
+    last_initial = None
+    for obj in object_list:
+        if with_initials:
+            if by_author:
+                initial = obj.sort_key_author
+            else:
+                initial = obj.get_initial().upper()
+            if initial != last_initial:
+                last_initial = initial
+                names.append((obj.author_str() if by_author else initial, []))
+        names[-1][1].append(obj)
+    return locals()
+
+
+
 # TODO: These are no longer just books.
 @register.inclusion_tag('catalogue/related_books.html', takes_context=True)
 def related_books(context, instance, limit=6, random=1, taken=0):
@@ -347,17 +400,6 @@ def related_books(context, instance, limit=6, random=1, taken=0):
     }
 
 
-@register.inclusion_tag('catalogue/menu.html')
-def catalogue_menu():
-    return {'categories': [
-                ('author', _('Authors'), 'autorzy'),
-                ('genre', _('Genres'), 'gatunki'),
-                ('kind', _('Kinds'), 'rodzaje'),
-                ('epoch', _('Epochs'), 'epoki'),
-                ('theme', _('Themes'), 'motywy'),
-        ]}
-
-
 @register.simple_tag
 def download_audio(book, daisy=True):
     links = []
@@ -373,7 +415,7 @@ def download_audio(book, daisy=True):
         for dsy in book.get_media('daisy'):
             links.append("<a href='%s'>%s</a>" %
                 (dsy.file.url, BookMedia.formats['daisy'].name))
-    return "".join(links)
+    return "".join(links)
 
 
 @register.inclusion_tag("catalogue/snippets/custom_pdf_link_li.html")
index b7c59a0..35a08e1 100644 (file)
@@ -32,7 +32,16 @@ urlpatterns += patterns('',
 urlpatterns += patterns('catalogue.views',
     url(r'^$', 'catalogue', name='catalogue'),
 
-    url(r'^lektury/$', 'book_list', name='book_list'),
+    url(r'^autor/$', 'tag_catalogue', {'category': 'author'}, name='author_catalogue'),
+    url(r'^epoka/$', 'tag_catalogue', {'category': 'epoch'}, name='epoch_catalogue'),
+    url(r'^gatunek/$', 'tag_catalogue', {'category': 'genre'}, name='genre_catalogue'),
+    url(r'^rodzaj/$', 'tag_catalogue', {'category': 'kind'}, name='kind_catalogue'),
+    url(r'^motyw/$', 'tag_catalogue', {'category': 'theme'}, name='theme_catalogue'),
+
+    url(r'^galeria/$', 'tagged_object_list', {'gallery': True}, name='gallery'),
+    url(r'^kolekcje/$', 'collections', name='catalogue_collections'),
+
+    url(r'^lektury/$', 'tagged_object_list', name='book_list'),
     url(r'^lektury/(?P<slug>[a-zA-Z0-9-]+)/$', 'collection', name='collection'),
     url(r'^audiobooki/$', 'audiobook_list', name='audiobook_list'),
     url(r'^daisy/$', 'daisy_list', name='daisy_list'),
@@ -75,7 +84,10 @@ urlpatterns += patterns('catalogue.views',
     url(r'^b/(?P<pk>\d+)/wide\.(?P<lang>.+)\.html', 'book_wide', name='catalogue_book_wide'),
     url(r'^f/(?P<pk>\d+)/promo\.(?P<lang>.+)\.html', 'fragment_promo', name='catalogue_fragment_promo'),
     url(r'^f/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', 'fragment_short', name='catalogue_fragment_short'),
+    url(r'^t/(?P<pk>\d+)/box\.(?P<lang>.+)\.html', 'tag_box', name='catalogue_tag_box'),
+    url(r'^c/(?P<pk>.+)/box\.(?P<lang>.+)\.html', 'collection_box', name='catalogue_collection_box'),
 
     # This should be the last pattern.
+    url(r'^galeria/(?P<tags>[a-zA-Z0-9-/]*)/$', 'tagged_object_list', {'gallery': True}, name='tagged_object_list_gallery'),
     url(r'^(?P<tags>[a-zA-Z0-9-/]*)/$', 'tagged_object_list', name='tagged_object_list'),
 )
index bcc5a0b..71cd890 100644 (file)
@@ -342,17 +342,5 @@ class AppSettings(object):
         return value
 
 
-def trim_query_log(trim_to=25):
-    """
-connection.queries includes all SQL statements -- INSERTs, UPDATES, SELECTs, etc. Each time your app hits the database, the query will be recorded.
-This can sometimes occupy lots of memory, so trim it here a bit.
-    """
-    if settings.DEBUG:
-        from django.db import connection
-        connection.queries = trim_to > 0 \
-            and connection.queries[-trim_to:] \
-            or []
-
-
 def delete_from_cache_by_language(cache, key_template):
     cache.delete_many([key_template % lc for lc, ln in settings.LANGUAGES])
index a25a08f..5a8277f 100644 (file)
@@ -4,11 +4,12 @@
 #
 from collections import OrderedDict
 import re
+import random
 
 from django.conf import settings
 from django.template import RequestContext
 from django.template.loader import render_to_string
-from django.shortcuts import render_to_response, get_object_or_404, render
+from django.shortcuts import render_to_response, get_object_or_404, render, redirect
 from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponsePermanentRedirect, JsonResponse
 from django.core.urlresolvers import reverse
 from django.db.models import Q
@@ -24,67 +25,21 @@ from picture.models import Picture, PictureArea
 from picture.views import picture_list_thumb
 from ssify import ssi_included, ssi_expect, SsiVariable as V
 from suggest.forms import PublishingSuggestForm
+from catalogue import constants
 from catalogue import forms
 from catalogue.helpers import get_top_level_related_tags
 from catalogue import models
-from catalogue.utils import split_tags, MultiQuerySet, SortedMultiQuerySet
+from catalogue.utils import split_tags
 from catalogue.templatetags.catalogue_tags import tag_list, collection_list
 
 staff_required = user_passes_test(lambda user: user.is_staff)
 
 
 def catalogue(request, as_json=False):
-    common_categories = ('author',)
-    split_categories = ('epoch', 'genre', 'kind')
-
-    categories = split_tags(
-        get_top_level_related_tags(categories=common_categories),
-        models.Tag.objects.usage_for_model(
-            models.Fragment, counts=True).filter(category='theme'),
-        models.Tag.objects.usage_for_model(
-            Picture, counts=True).filter(category__in=common_categories),
-        models.Tag.objects.usage_for_model(
-            PictureArea, counts=True).filter(
-            category='theme')
-    )
-    book_categories = split_tags(
-        get_top_level_related_tags(categories=split_categories)
-        )
-    picture_categories = split_tags(
-        models.Tag.objects.usage_for_model(
-            Picture, counts=True).filter(
-            category__in=split_categories),
-        )
-
+    books = models.Book.objects.filter(parent=None)
+    pictures = Picture.objects.all()
     collections = models.Collection.objects.all()
-
-    def render_tag_list(tags):
-        return render_to_string('catalogue/tag_list.html', tag_list(tags))
-
-    def render_split(with_books, with_pictures):
-        ctx = {}
-        if with_books:
-            ctx['books'] = render_tag_list(with_books)
-        if with_pictures:
-            ctx['pictures'] = render_tag_list(with_pictures)
-        return render_to_string('catalogue/tag_list_split.html', ctx)
-
-    output = {}
-    output['theme'] = render_tag_list(categories.get('theme', []))
-    for category in common_categories:
-        output[category] = render_tag_list(categories.get(category, []))
-    for category in split_categories:
-        output[category] = render_split(
-            book_categories.get(category, []),
-            picture_categories.get(category, []))
-
-    output['collections'] = render_to_string(
-        'catalogue/collection_list.html', collection_list(collections))
-    if as_json:
-        return JsonResponse(output)
-    else:
-        return render_to_response('catalogue/catalogue.html', locals(),
-            context_instance=RequestContext(request))
+    return render(request, 'catalogue/catalogue.html', locals())
 
 
 @ssi_included
@@ -113,10 +68,20 @@ def book_list(request, filter=None, get_filter=None,
 
 
 def audiobook_list(request):
-    return book_list(request, Q(media__type='mp3') | Q(media__type='ogg'),
-                     template_name='catalogue/audiobook_list.html',
-                     list_template_name='catalogue/snippets/audiobook_list.html',
-                     )
+    books = models.Book.objects.filter(Q(media__type='mp3') | Q(media__type='ogg')).distinct()
+    books = list(books)
+    if len(books) > 3:
+        best = random.sample(books, 3)
+    else:
+        best = books
+
+    daisy = models.Book.objects.filter(media__type='daisy').distinct()
+
+    return render(request, 'catalogue/audiobook_list.html', {
+        'books': books,
+        'best': best,
+        'daisy': daisy,
+        })
 
 
 def daisy_list(request):
@@ -127,17 +92,8 @@ def daisy_list(request):
 
 def collection(request, slug):
     coll = get_object_or_404(models.Collection, slug=slug)
-    if coll.kind == 'book':
-        view = book_list
-        tmpl = "catalogue/collection.html"
-    elif coll.kind == 'picture':
-        view = picture_list_thumb
-        tmpl = "picture/collection.html"
-    else:
-        raise ValueError('How do I show this kind of collection? %s' % coll.kind)
-    return view(request, get_filter=coll.get_query,
-                     template_name=tmpl,
-                     context={'collection': coll})
+    return render(request, 'catalogue/collection.html',
+        {'collection': coll})
 
 
 def differentiate_tags(request, tags, ambiguous_slugs):
@@ -155,7 +111,8 @@ def differentiate_tags(request, tags, ambiguous_slugs):
 
 
 # TODO: Rewrite this hellish piece of code which tries to do everything
-def tagged_object_list(request, tags=''):
+def tagged_object_list(request, tags='', gallery=False):
+    raw_tags = tags
     # preliminary tests and conditions
     try:
         tags = models.Tag.get_tag_list(tags)
@@ -189,58 +146,87 @@ def tagged_object_list(request, tags=''):
     objects = None
 
     if theme_is_set:
+        # Only fragments (or pirctureareas) here.
         shelf_tags = [tag for tag in tags if tag.category == 'set']
         fragment_tags = [tag for tag in tags if tag.category != 'set']
-        fragments = models.Fragment.tagged.with_all(fragment_tags)
-        areas = PictureArea.tagged.with_all(fragment_tags)
+        if gallery:
+            fragments = PictureArea.tagged.with_all(fragment_tags)
+        else:
+            fragments = models.Fragment.tagged.with_all(fragment_tags)
 
         if shelf_tags:
-            books = models.Book.tagged.with_all(shelf_tags).order_by()
-            fragments = fragments.filter(Q(book__in=books) | Q(book__ancestor__in=books))
-            areas = PictureArea.objects.none()
+            if gallery:
+                # TODO: Pictures on shelves not supported yet.
+                raise Http404
+            else:
+                books = models.Book.tagged.with_all(shelf_tags).order_by()
+                fragments = fragments.filter(Q(book__in=books) | Q(book__ancestor__in=books))
 
         categories = split_tags(
             models.Tag.objects.usage_for_queryset(fragments, counts=True
                 ).exclude(pk__in=tags_pks),
-            models.Tag.objects.usage_for_queryset(areas, counts=True
-                ).exclude(pk__in=tags_pks)
             )
 
-        # we want the Pictures to go first
-        objects = MultiQuerySet(areas, fragments)
+        objects = fragments
     else:
-        all_books = models.Book.tagged.with_all(tags)
-        if shelf_is_set:
-            books = all_books.order_by('sort_key_author', 'title')
-            pictures = Picture.objects.none()
-            related_book_tags = models.Tag.objects.usage_for_queryset(
-                books, counts=True).exclude(
-                category='set').exclude(pk__in=tags_pks)
+        if gallery:
+            if shelf_is_set:
+                # TODO: Pictures on shelves not supported yet.
+                raise Http404
+            else:
+                if tags:
+                    objects = Picture.tagged.with_all(tags).order_by(
+                        'sort_key_author', 'title')
+                else:
+                    objects = Picture.objects.all().order_by(
+                        'sort_key_author', 'title')
+            areas = PictureArea.objects.filter(picture__in=objects)
+            categories = split_tags(
+                models.Tag.objects.usage_for_queryset(
+                    objects, counts=True).exclude(pk__in=tags_pks),
+                models.Tag.objects.usage_for_queryset(
+                    areas, counts=True).filter(
+                    category__in=('theme', 'thing')).exclude(
+                    pk__in=tags_pks),
+            )
         else:
-            books = models.Book.tagged_top_level(tags).order_by(
-                'sort_key_author', 'title')
-            pictures = Picture.tagged.with_all(tags).order_by(
-                'sort_key_author', 'title')
+            if tags:
+                all_books = models.Book.tagged.with_all(tags)
+            else:
+                all_books = models.Book.objects.filter(parent=None)
+            if shelf_is_set:
+                objects = all_books.order_by('sort_key_author', 'title')
+                related_book_tags = models.Tag.objects.usage_for_queryset(
+                    objects, counts=True).exclude(
+                    category='set').exclude(pk__in=tags_pks)
+            else:
+                if tags:
+                    objects = models.Book.tagged_top_level(tags).order_by(
+                        'sort_key_author', 'title')
+                else:
+                    objects = all_books.order_by('sort_key_author', 'title')
             related_book_tags = get_top_level_related_tags(tags)
 
-        fragments = models.Fragment.objects.filter(book__in=all_books)
-        areas = PictureArea.objects.filter(picture__in=pictures)
+            fragments = models.Fragment.objects.filter(book__in=all_books)
 
-        categories = split_tags(
-            related_book_tags,
-            models.Tag.objects.usage_for_queryset(
-                pictures, counts=True).exclude(pk__in=tags_pks),
-            models.Tag.objects.usage_for_queryset(
-                fragments, counts=True).filter(
-                category='theme').exclude(pk__in=tags_pks),
-            models.Tag.objects.usage_for_queryset(
-                areas, counts=True).filter(
-                category__in=('theme', 'thing')).exclude(
-                pk__in=tags_pks),
-        )
+            categories = split_tags(
+                related_book_tags,
+                models.Tag.objects.usage_for_queryset(
+                    fragments, counts=True).filter(
+                    category='theme').exclude(pk__in=tags_pks),
+            )
 
-        objects = SortedMultiQuerySet(pictures, books,
-            order_by=('sort_key_author', 'title'))
+    objects = list(objects)
+    if len(objects) > 3:
+        best = random.sample(objects, 3)
+    else:
+        best = objects
+
+    if not gallery and not objects and len(tags) == 1:
+        tag = tags[0]
+        if (tag.category in ('theme', 'thing') and PictureArea.tagged.with_any([tag]).exists() or
+            Picture.tagged.with_any([tag]).exists()):
+                return redirect('tagged_object_list_gallery', raw_tags, permanent=False)
 
     return render_to_response('catalogue/tagged_object_list.html',
         {
@@ -252,6 +238,8 @@ def tagged_object_list(request, tags=''):
             'tags': tags,
             'tag_ids': tags_pks,
             'theme_is_set': theme_is_set,
+            'best': best,
+            'gallery': gallery,
         },
         context_instance=RequestContext(request))
 
@@ -272,16 +260,13 @@ def book_detail(request, slug):
     except models.Book.DoesNotExist:
         return pdcounter_views.book_stub_detail(request, slug)
 
+    tags = book.tags.exclude(category__in=('set', 'theme'))
     book_children = book.children.all().order_by('parent_number', 'sort_key')
     return render_to_response('catalogue/book_detail.html', locals(),
         context_instance=RequestContext(request))
 
 
-def player(request, slug):
-    book = get_object_or_404(models.Book, slug=slug)
-    if not book.has_media('mp3'):
-        raise Http404
-
+def get_audiobooks(book):
     ogg_files = {}
     for m in book.media.filter(type='ogg').order_by().iterator():
         ogg_files[m.name] = m
@@ -309,6 +294,15 @@ def player(request, slug):
         audiobooks.append(media)
 
     projects = sorted(projects)
+    return audiobooks, projects, have_oggs
+
+
+def player(request, slug):
+    book = get_object_or_404(models.Book, slug=slug)
+    if not book.has_media('mp3'):
+        raise Http404
+
+    audiobooks, projects, have_oggs = get_audiobooks(book)
 
     extra_info = book.extra_info
 
@@ -636,6 +630,7 @@ def book_mini(request, pk, with_link=True):
 def book_short(request, pk):
     book = get_object_or_404(models.Book, pk=pk)
     stage_note, stage_note_url = book.stage_note()
+    audiobooks, projects, have_oggs = get_audiobooks(book)
 
     return render(request, 'catalogue/book_short.html', {
         'book': book,
@@ -646,6 +641,8 @@ def book_short(request, pk):
         'show_lang': book.language_code() != settings.LANGUAGE_CODE,
         'stage_note': stage_note,
         'stage_note_url': stage_note_url,
+        'audiobooks': audiobooks,
+        'have_oggs': have_oggs,
     })
 
 
@@ -659,6 +656,7 @@ def book_wide(request, pk):
     book = get_object_or_404(models.Book, pk=pk)
     stage_note, stage_note_url = book.stage_note()
     extra_info = book.extra_info
+    audiobooks, projects, have_oggs = get_audiobooks(book)
 
     return render(request, 'catalogue/book_wide.html', {
         'book': book,
@@ -672,7 +670,8 @@ def book_wide(request, pk):
         'main_link': reverse('book_text', args=[book.slug]) if book.html_file else None,
         'extra_info': extra_info,
         'hide_about': extra_info.get('about', '').startswith('http://wiki.wolnepodreczniki.pl'),
-        'themes': book.related_themes(),
+        'audiobooks': audiobooks,
+        'have_oggs': have_oggs,
     })
 
 
@@ -689,3 +688,55 @@ def fragment_promo(request, pk):
     return render(request, 'catalogue/fragment_promo.html', {
         'fragment': fragment
     })
+
+
+@ssi_included
+def tag_box(request, pk):
+    tag = get_object_or_404(models.Tag, pk=pk)
+    assert tag.category != 'set'
+
+    return render(request, 'catalogue/tag_box.html', {
+        'tag': tag,
+    })
+
+
+@ssi_included
+def collection_box(request, pk):
+    obj = get_object_or_404(models.Collection, pk=pk)
+
+    return render(request, 'catalogue/collection_box.html', {
+        'obj': obj,
+    })
+
+
+def tag_catalogue(request, category):
+    if category == 'theme':
+        tags = models.Tag.objects.usage_for_model(
+            models.Fragment, counts=True).filter(category='theme')
+    else:
+        tags = list(get_top_level_related_tags((), categories=(category,)))
+
+    if len(tags) > 3:
+        best = random.sample(tags, 3)
+    else:
+        best = tags
+
+    return render(request, 'catalogue/tag_catalogue.html', {
+        'tags': tags,
+        'best': best,
+        'title': constants.CATEGORIES_NAME_PLURAL[category],
+    })
+
+
+def collections(request):
+    objects = models.Collection.objects.all()
+
+    if len(objects) > 3:
+        best = random.sample(objects, 3)
+    else:
+        best = objects
+
+    return render(request, 'catalogue/collections.html', {
+        'objects': objects,
+        'best': best,
+    })
index 5aabe3c..bffb639 100644 (file)
@@ -17,6 +17,7 @@ from StringIO import StringIO
 import jsonfield
 import itertools
 import logging
+import re
 
 from PIL import Image
 
@@ -123,10 +124,31 @@ class Picture(models.Model):
     def __unicode__(self):
         return self.title
 
+    def author_str(self):
+        return ", ".join(str(t) for t in self.tags.filter(category='author'))
+
     @permalink
     def get_absolute_url(self):
         return ('picture.views.picture_detail', [self.slug])
 
+    def get_initial(self):
+        try:
+            return re.search(r'\w', self.title, re.U).group(0)
+        except AttributeError:
+            return ''
+
+    def get_next(self):
+        try:
+            return type(self).objects.filter(sort_key__gt=self.sort_key)[0]
+        except IndexError:
+            return None
+
+    def get_previous(self):
+        try:
+            return type(self).objects.filter(sort_key__lt=self.sort_key).order_by('-sort_key')[0]
+        except IndexError:
+            return None
+
     @classmethod
     def from_xml_file(cls, xml_file, image_file=None, image_store=None, overwrite=False):
         """
index 1bd70a1..35fba77 100644 (file)
@@ -10,7 +10,7 @@
         <div class="book-box-head">
             <div class="author">
                 {% for tag in tags.author %}
-                    <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %},
+                    <a href="{{ tag.get_absolute_gallery_url }}">{{ tag }}</a>{% if not forloop.last %},
                 {% endif %}{% endfor %}
             </div>
             <div class="title">
     {% endblock %}
      {# what about licensing icons here #}
   </div>
-     
+
         <div class="tags">
             {% spaceless %}
 
             <span class="category">
             <span class="mono"> {% trans "Epoch" %}:</span>&nbsp;<span class="book-box-tag">
                {% for tag in tags.epoch %}
-                       <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>
+                       <a href="{{ tag.get_absolute_gallery_url }}">{{ tag }}</a>
                        {% if not forloop.last %}<span>, </span>{% endif %}
                 {% endfor %}
             </span></span>
@@ -47,7 +47,7 @@
             <span class="category">
             <span class="mono"> {% trans "Kind" %}:</span>&nbsp;<span class="book-box-tag">
                {% for tag in tags.kind %}
-                       <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>
+                       <a href="{{ tag.get_absolute_gallery_url }}">{{ tag }}</a>
                        {% if not forloop.last %}<span>, </span>{% endif %}
                 {% endfor %}
             </span></span>
@@ -55,7 +55,7 @@
             <span class="category">
             <span class="mono"> {% trans "Genre" %}:</span>&nbsp;<span class="book-box-tag">
                {% for tag in tags.genre %}
-                       <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>
+                       <a href="{{ tag.get_absolute_gallery_url }}">{{ tag }}</a>
                        {% if not forloop.last %}<span>, </span>{% endif %}
                 {% endfor %}
             </span></span>
index e169dbe..937ef68 100644 (file)
@@ -3,6 +3,7 @@
 {% load static from staticfiles %}
 {% load catalogue_tags %}
 {% load thumbnail %}
+{% load ssi_include from ssify %}
 
 
 {% block title %}{{ picture.pretty_title }}{% endblock %}
 {% block menu %}
 <li><a style="width: 50%;display: inline-block;" class="square button plus inactive" href="#">+<!--&#x2795;--><!-- heavy plus sign --></a><a style="width: 50%;display: inline-block;" class="square button minus inactive" href="#">-<!-- &#x2796;--><!-- heavy minus sign --></a></li>
 
+{% spaceless %}
+<li>
+    {% with picture.get_previous as prev %}
+        <a style="width: 50%;display: inline-block;" {% if prev %}href="{% url 'picture_viewer' prev.slug %}"{% endif %}>{% if prev %}&lt;{%endif %}</a>
+    {% endwith %}
+    {% with picture.get_next as next %}
+        <a style="width: 50%;display: inline-block;" {% if next %}href="{% url 'picture_viewer' next.slug %}"{% endif %}>{% if next %}&gt;{% endif %}</a>
+    {% endwith %}
+</li>
+{% endspaceless %}
+
 
 <li><a href="{{ picture.get_absolute_url }}" id="menu-book" data-box="book-short">
     <img src="{% thumbnail picture.image_file '80x200' as thumb %}{{ thumb.url }}{% empty %}{{ picture.image_file.url }}{% endthumbnail %}"
@@ -54,7 +66,7 @@
 {% block main %}
        <div id="picture-view">
          {% thumbnail picture.image_file "700x500" as pic %}
-         <div class="picture-wrap {% if picture.image_file|is_portrait %}portrait{% endif %}" 
+         <div class="picture-wrap {% if picture.image_file|is_portrait %}portrait{% endif %}"
               data-original-width="{{picture.width}}" data-original-height="{{picture.height}}"
            data-original-url="{{ picture.image_file.url }}"
               data-width="{{pic.width}}" data-height="{{pic.height}}" style="background-image: url('{{pic.url}}');  width: {{pic.width}}px; height: {{pic.height}}px;">
@@ -82,7 +94,7 @@
 </div>
 
 <div class="box Picture-item" id="book-short">
-    {{ picture.short_html }}
+    {% ssi_include 'picture_short' pk=picture.pk %}
 </div>
 
 {% endblock %}
index 9f47c7b..462e8b0 100644 (file)
       {% endif %}
     </ul>
   </div>
-
-  {% comment %}
-  <div class="other-download">
-    <h2 class="mono">{% trans "Download" %}</h2>
-    <ul class="plain">
-      <li>
-       {% if related.media.mp3 or related.media.ogg or related.media.daisy %}
-        {% trans "Download all audiobooks for this book" %}:
-       {% download_audio book %}.
-       {% endif %}
-      </li>
-      {% custom_pdf_link_li book %}
-    </ul>
-  </div>
-  {% endcomment %}
 </div>
 {% endblock %}
index 8dbad9d..8302379 100644 (file)
@@ -32,12 +32,15 @@ def book_searched(context, result):
     # We don't need hits which lead to sections but do not have
     # snippets.
     hits = filter(lambda (idx, h):
-                  result.snippets[idx] is not None
-                  or 'fragment' in h, enumerate(result.hits))
+                  'fragment' in h or
+                  result.snippets[idx] is not None,
+                  enumerate(result.hits))
         #    print "[tmpl: from %d hits selected %d]" % (len(result.hits), len(hits))
 
     for (idx, hit) in hits:
         # currently we generate one snipper per hit though.
+        if len(result.snippets) <= idx:
+            break
         if result.snippets[idx] is None:
             continue
         snip = result.snippets[idx]
index ae5ce20..094a7a7 100644 (file)
@@ -3,10 +3,8 @@ from __future__ import absolute_import
 import os
 import sys
 
-ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 sys.path = [
-    os.path.join(ROOT, 'apps'),
-    os.path.join(ROOT, 'lib'),
     os.path.join(ROOT, 'lib/librarian'),
 ] + sys.path
 
index b691964..2543732 100644 (file)
Binary files a/src/wolnelektury/locale/pl/LC_MESSAGES/django.mo and b/src/wolnelektury/locale/pl/LC_MESSAGES/django.mo differ
index 6a6ad34..dd6f34f 100644 (file)
@@ -7,35 +7,18 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WolneLektury\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-12-16 09:20+0100\n"
-"PO-Revision-Date: 2013-04-09 10:43+0100\n"
+"POT-Creation-Date: 2015-12-31 16:45+0100\n"
+"PO-Revision-Date: 2015-12-31 16:45+0100\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
 "Language: pl\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "X-Translated-Using: django-rosetta 0.5.6\n"
-"X-Poedit-Language: Polish\n"
 "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
-"|| n%100>=20) ? 1 : 2)\n"
-
-#: views.py:34 views.py:35 templates/superbase.html:85
-msgid "Sign in"
-msgstr "Zaloguj się"
-
-#: views.py:41 views.py:62
-#, python-format
-msgid "Already logged in as user %(user)s"
-msgstr "Zalogowano jako %(user)s"
-
-#: views.py:53 views.py:54 views.py:82 templates/superbase.html:89
-msgid "Register"
-msgstr "Załóż konto"
-
-#: views.py:77
-msgid "You have to be logged in to continue"
-msgstr "Zaloguj się, aby kontynuować"
+"|| n%100>=20) ? 1 : 2);\n"
+"Language-Team: \n"
+"X-Generator: Poedit 1.8.4\n"
 
 #: templates/404.html:5
 msgid "Page does not exist"
@@ -83,175 +66,6 @@ msgstr ""
 "Serwis Wolnelektury.pl jest obecnie niedostępny z powodu prac "
 "konserwacyjnych."
 
-#: templates/main_page.html:6 templates/main_page.html.py:7
-msgid "Wolne Lektury internet library"
-msgstr "Biblioteka internetowa Wolne Lektury"
-
-#: templates/main_page.html:23
-msgid "What's new?"
-msgstr "Co nowego?"
-
-#: templates/main_page.html:31
-msgid "Recent publications"
-msgstr "Ostatnie publikacje"
-
-#: templates/main_page.html:41
-msgid "News"
-msgstr "Aktualności"
-
-#: templates/main_page.html:50
-msgid "Utilities"
-msgstr "Narzędzia"
-
-#: templates/main_page.html:53
-msgid "Report a bug or suggestion"
-msgstr "Zgłoś błąd lub sugestię"
-
-#: templates/main_page.html:56
-msgid "Download the catalogue in PDF format."
-msgstr "Pobierz katalog w formacie PDF."
-
-#: templates/main_page.html:58
-msgid "Widget"
-msgstr "Widget"
-
-#: templates/main_page.html:59
-msgid "Missing a book?"
-msgstr "Nie znalazłeś/-aś utworu?"
-
-#: templates/main_page.html:60 templates/publish_plan.html:4
-#: templates/publish_plan.html.py:8
-msgid "Publishing plan"
-msgstr "Plan publikacji"
-
-#: templates/main_page.html:71
-msgid "Information"
-msgstr "Informacje"
-
-#: templates/main_page.html:73
-msgid "Privacy policy"
-msgstr "Polityka prywatności"
-
-#: templates/main_page.html:98
-msgid "Image used:"
-msgstr "Użyto obrazu:"
-
-#: templates/superbase.html:18
-msgid "Wolne Lektury"
-msgstr "Wolne Lektury"
-
-#: templates/superbase.html:55
-#, python-format
-msgid ""
-"\n"
-"                    <a href='%(b)s'>%(c)s</a> free reading you have <a "
-"href='%(r)s'>right to</a>\n"
-"                    "
-msgid_plural ""
-"\n"
-"                    <a href='%(b)s'>%(c)s</a> free readings you have <a "
-"href='%(r)s'>right to</a>\n"
-"                    "
-msgstr[0] ""
-"\n"
-"                    <a href='%(b)s'>%(c)s</a> darmowy utwór do której <a "
-"href='%(r)s'>masz prawo</a>\n"
-"                    "
-msgstr[1] ""
-"\n"
-"                    <a href='%(b)s'>%(c)s</a> darmowe utwory do których <a "
-"href='%(r)s'>masz prawo</a>\n"
-"                    "
-msgstr[2] ""
-"\n"
-"                    <a href='%(b)s'>%(c)s</a> darmowych utworów do których "
-"<a href='%(r)s'>masz prawo</a>\n"
-"                    "
-
-#: templates/superbase.html:66
-msgid "Welcome"
-msgstr "Witaj"
-
-#: templates/superbase.html:72 templates/user.html:12
-msgid "Password"
-msgstr "Hasło"
-
-#: templates/superbase.html:73 templates/user.html:13
-msgid "E-mail"
-msgstr "E-mail"
-
-#: templates/superbase.html:74 templates/user.html:14
-msgid "Social accounts"
-msgstr "Konta społecznościowe"
-
-#: templates/superbase.html:77
-msgid "My shelf"
-msgstr "Moja półka"
-
-#: templates/superbase.html:79
-msgid "Administration"
-msgstr "Administracja"
-
-#: templates/superbase.html:81
-msgid "Logout"
-msgstr "Wyloguj"
-
-#: templates/superbase.html:111
-msgid "Search"
-msgstr "Szukaj"
-
-#: templates/superbase.html:131
-msgid "Language versions"
-msgstr "Wersje językowe"
-
-#: templates/superbase.html:165
-msgid ""
-"\n"
-"\t\t\t\tWolne Lektury is a project lead by <a href=\"http://nowoczesnapolska."
-"org.pl/\">Modern Poland Foundation</a>.\n"
-"\t\t\t\tDigital reproductions are made by <a href=\"http://www.bn.org.pl/"
-"\">The National Library</a>, <a href=\"http://www.bs.katowice.pl/"
-"\">Biblioteka Śląska</a> and <a href=\"http://www.bibliotekaelblaska.pl/"
-"\">Biblioteka Elbląska</a>, based on TNL, BŚ and BE resources.\n"
-"\t\t\t\tHosting: <a href=\"http://www.icm.edu.pl/\">ICM</a>.\n"
-"\t\t\t\t"
-msgstr ""
-"\n"
-"Wolne Lektury to projekt prowadzony przez <a href=\"http://nowoczesnapolska."
-"org.pl/\">fundację Nowoczesna Polska</a>. \n"
-"Reprodukcje cyfrowe wykonane przez <a href=\"http://www.bn.org.pl/"
-"\">Bibliotekę Narodową</a>, <a href=\"http://www.bs.katowice.pl/"
-"\">Bibliotekę Śląską</a> i <a href=\"http://www.bibliotekaelblaska.pl/"
-"\">Bibliotekę Elbląską</a> z egzemplarzy pochodzących ze zbiorów BN, BŚ i "
-"BE.\n"
-"Hosting: <a href=\"http://www.icm.edu.pl/\">ICM</a>."
-
-#: templates/superbase.html:172
-msgid ""
-"\n"
-"\t\t\t\tModern Poland Foundation, 00-514 Warsaw, ul. Marszałkowska 84/92 "
-"lok. 125, tel/fax: (22) 621-30-17\n"
-"                e-mail: <a href=\"mailto:fundacja@nowoczesnapolska.org.pl"
-"\">fundacja@nowoczesnapolska.org.pl</a>\n"
-"\t\t\t\t"
-msgstr ""
-"\n"
-"Fundacja Nowoczesna Polska, 00-514 Warszawa, ul. Marszałkowska 84/92 lok. "
-"125, tel/fax: (22) 621-30-17, e-mail: <a href=\"mailto:"
-"fundacja@nowoczesnapolska.org.pl\">fundacja@nowoczesnapolska.org.pl</a>"
-
-#: templates/superbase.html:189
-msgid "Close"
-msgstr "Zamknij"
-
-#: templates/superbase.html:191
-msgid "Loading"
-msgstr "Ładowanie"
-
-#: templates/user.html:5 templates/user.html.py:9
-msgid "User"
-msgstr "Użytkownik"
-
 #: templates/admin/base_site.html:4 templates/admin/base_site.html.py:7
 msgid "Site administration"
 msgstr "Administracja stroną"
@@ -273,15 +87,15 @@ msgstr "uproszczone"
 msgid "Import book"
 msgstr "Importuj książkę"
 
-#: templates/auth/login.html:10
+#: templates/auth/login.html:12
 msgid "Forgot Password?"
 msgstr "Nie pamiętasz hasła?"
 
-#: templates/auth/login.html:15 templates/auth/register.html:7
+#: templates/auth/login.html:17 templates/auth/register.html:7
 msgid "Sign in using:"
 msgstr "Zaloguj się używając:"
 
-#: templates/auth/login_register.html:9
+#: templates/auth/login_register.html:10
 msgid "or register"
 msgstr "albo załóż konto"
 
@@ -332,6 +146,63 @@ msgstr ""
 msgid "More..."
 msgstr "Więcej..."
 
+#: templates/main_page.html:7 templates/main_page.html.py:8
+msgid "Wolne Lektury internet library"
+msgstr "Biblioteka internetowa Wolne Lektury"
+
+#: templates/main_page.html:34
+msgid "Theme"
+msgstr "Motyw"
+
+#: templates/main_page.html:85
+msgid "Recent publications"
+msgstr "Ostatnie publikacje"
+
+#: templates/main_page.html:89
+msgid "More recent publications"
+msgstr "Więcej ostatnich publikacji"
+
+#: templates/main_page.html:95
+msgid "News"
+msgstr "Aktualności"
+
+#: templates/main_page.html:101
+msgid "Utilities"
+msgstr "Narzędzia"
+
+#: templates/main_page.html:104
+msgid "Report a bug or suggestion"
+msgstr "Zgłoś błąd lub sugestię"
+
+#: templates/main_page.html:106
+msgid "Download the catalogue in PDF format."
+msgstr "Pobierz katalog w formacie PDF."
+
+#: templates/main_page.html:107
+msgid "Footnotes"
+msgstr "Przypisy"
+
+#: templates/main_page.html:108
+msgid "Missing a book?"
+msgstr "Nie znalazłeś/-aś utworu?"
+
+#: templates/main_page.html:109 templates/publish_plan.html:4
+#: templates/publish_plan.html.py:8
+msgid "Publishing plan"
+msgstr "Plan publikacji"
+
+#: templates/main_page.html:120
+msgid "Information"
+msgstr "Informacje"
+
+#: templates/main_page.html:122
+msgid "Privacy policy"
+msgstr "Polityka prywatności"
+
+#: templates/main_page.html:142
+msgid "Image used:"
+msgstr "Użyto obrazu:"
+
 #: templates/openid/login.html:6 templates/openid/login.html.py:10
 msgid "OpenID Sign In"
 msgstr "Logowanie przez OpenID"
@@ -364,32 +235,32 @@ msgstr ""
 "Potwierdź dostęp do Wolnych Lektur jako użytkownik <strong>%(user)s</strong>."
 
 #: templates/socialaccount/connections.html:5
-#: templates/socialaccount/connections.html:8
+#: templates/socialaccount/connections.html:10
 msgid "Account Connections"
 msgstr "Powiązania konta"
 
-#: templates/socialaccount/connections.html:12
+#: templates/socialaccount/connections.html:13
 msgid ""
 "You can sign in to your account using any of the following third party "
 "accounts:"
 msgstr ""
 "Możesz się zalogować na swoje konto używając następujących kont zewnętrznych:"
 
-#: templates/socialaccount/connections.html:36
+#: templates/socialaccount/connections.html:37
 msgid "Remove"
 msgstr "Usuń"
 
-#: templates/socialaccount/connections.html:44
+#: templates/socialaccount/connections.html:45
 msgid ""
 "You currently have no social network accounts connected to this account."
 msgstr "Aktualnie do Twojego konta nie są podłączone żadne konta zewnętrzne."
 
-#: templates/socialaccount/connections.html:47
+#: templates/socialaccount/connections.html:48
 msgid "Add a 3rd Party Account"
 msgstr "Dodaj konto zewnętrzne"
 
 #: templates/socialaccount/login_cancelled.html:5
-#: templates/socialaccount/login_cancelled.html:9
+#: templates/socialaccount/login_cancelled.html:10
 msgid "Login Cancelled"
 msgstr "Anulowano logowanie"
 
@@ -403,6 +274,158 @@ msgstr ""
 "Logowanie przy użyciu zewnętrznego konta zostało anulowane. Jeśli był to "
 "błąd, przejdź do <a href=\"%(login_url)s\">strony logowania</a>."
 
+#: templates/superbase.html:21
+msgid "Wolne Lektury"
+msgstr "Wolne Lektury"
+
+#: templates/superbase.html:51
+#, python-format
+msgid ""
+"\n"
+"                    <a href='%(b)s'>%(c)s</a> free reading you have <a "
+"href='%(r)s'>right to</a>\n"
+"                    "
+msgid_plural ""
+"\n"
+"                    <a href='%(b)s'>%(c)s</a> free readings you have <a "
+"href='%(r)s'>right to</a>\n"
+"                    "
+msgstr[0] ""
+"\n"
+"                    <a href='%(b)s'>%(c)s</a> darmowy utwór do której <a "
+"href='%(r)s'>masz prawo</a>\n"
+"                    "
+msgstr[1] ""
+"\n"
+"                    <a href='%(b)s'>%(c)s</a> darmowe utwory do których <a "
+"href='%(r)s'>masz prawo</a>\n"
+"                    "
+msgstr[2] ""
+"\n"
+"                    <a href='%(b)s'>%(c)s</a> darmowych utworów do których "
+"<a href='%(r)s'>masz prawo</a>\n"
+"                    "
+
+#: templates/superbase.html:61
+msgid "Language"
+msgstr "Język"
+
+#: templates/superbase.html:85
+msgid "My shelf"
+msgstr "Moja półka"
+
+#: templates/superbase.html:88
+msgid "Administration"
+msgstr "Administracja"
+
+#: templates/superbase.html:90
+msgid "Logout"
+msgstr "Wyloguj"
+
+#: templates/superbase.html:93 views.py:67 views.py:68
+msgid "Sign in"
+msgstr "Zaloguj się"
+
+#: templates/superbase.html:93 views.py:86 views.py:87 views.py:115
+msgid "Register"
+msgstr "Załóż konto"
+
+#: templates/superbase.html:100
+msgid "Literature"
+msgstr "Literatura"
+
+#: templates/superbase.html:101
+msgid "Themes"
+msgstr "Motywy"
+
+#: templates/superbase.html:102
+msgid "Audiobooks"
+msgstr "Audiobooki"
+
+#: templates/superbase.html:103
+msgid "Gallery"
+msgstr "Galeria"
+
+#: templates/superbase.html:114
+msgid "Search"
+msgstr "Szukaj"
+
+#: templates/superbase.html:142
+msgid "Close"
+msgstr "Zamknij"
+
+#: templates/superbase.html:144
+msgid "Loading"
+msgstr "Ładowanie"
+
+#: templates/user.html:5 templates/user.html.py:11
+msgid "User"
+msgstr "Użytkownik"
+
+#: templates/user.html:13
+msgid "Password"
+msgstr "Hasło"
+
+#: templates/user.html:14
+msgid "E-mail"
+msgstr "E-mail"
+
+#: templates/user.html:15
+msgid "Social accounts"
+msgstr "Konta społecznościowe"
+
+#: views.py:74 views.py:95
+#, python-format
+msgid "Already logged in as user %(user)s"
+msgstr "Zalogowano jako %(user)s"
+
+#: views.py:110
+msgid "You have to be logged in to continue"
+msgstr "Zaloguj się, aby kontynuować"
+
+#~ msgid "What's new?"
+#~ msgstr "Co nowego?"
+
+#~ msgid "Widget"
+#~ msgstr "Widget"
+
+#~ msgid "Welcome"
+#~ msgstr "Witaj"
+
+#~ msgid ""
+#~ "\n"
+#~ "\t\t\t\tWolne Lektury is a project lead by <a href=\"http://"
+#~ "nowoczesnapolska.org.pl/\">Modern Poland Foundation</a>.\n"
+#~ "\t\t\t\tDigital reproductions are made by <a href=\"http://www.bn.org.pl/"
+#~ "\">The National Library</a>, <a href=\"http://www.bs.katowice.pl/"
+#~ "\">Biblioteka Śląska</a> and <a href=\"http://www.bibliotekaelblaska.pl/"
+#~ "\">Biblioteka Elbląska</a>, based on TNL, BŚ and BE resources.\n"
+#~ "\t\t\t\tHosting: <a href=\"http://www.icm.edu.pl/\">ICM</a>.\n"
+#~ "\t\t\t\t"
+#~ msgstr ""
+#~ "\n"
+#~ "Wolne Lektury to projekt prowadzony przez <a href=\"http://"
+#~ "nowoczesnapolska.org.pl/\">fundację Nowoczesna Polska</a>. \n"
+#~ "Reprodukcje cyfrowe wykonane przez <a href=\"http://www.bn.org.pl/"
+#~ "\">Bibliotekę Narodową</a>, <a href=\"http://www.bs.katowice.pl/"
+#~ "\">Bibliotekę Śląską</a> i <a href=\"http://www.bibliotekaelblaska.pl/"
+#~ "\">Bibliotekę Elbląską</a> z egzemplarzy pochodzących ze zbiorów BN, BŚ i "
+#~ "BE.\n"
+#~ "Hosting: <a href=\"http://www.icm.edu.pl/\">ICM</a>."
+
+#~ msgid ""
+#~ "\n"
+#~ "\t\t\t\tModern Poland Foundation, 00-514 Warsaw, ul. Marszałkowska 84/92 "
+#~ "lok. 125, tel/fax: (22) 621-30-17\n"
+#~ "                e-mail: <a href=\"mailto:fundacja@nowoczesnapolska.org.pl"
+#~ "\">fundacja@nowoczesnapolska.org.pl</a>\n"
+#~ "\t\t\t\t"
+#~ msgstr ""
+#~ "\n"
+#~ "Fundacja Nowoczesna Polska, 00-514 Warszawa, ul. Marszałkowska 84/92 lok. "
+#~ "125, tel/fax: (22) 621-30-17, e-mail: <a href=\"mailto:"
+#~ "fundacja@nowoczesnapolska.org.pl\">fundacja@nowoczesnapolska.org.pl</a>"
+
 #~ msgid "Listing of all audiobooks"
 #~ msgstr "Spis wszystkich audiobooków"
 
@@ -424,9 +447,6 @@ msgstr ""
 #~ msgid "See also"
 #~ msgstr "Zobacz też"
 
-#~ msgid "Theme"
-#~ msgstr "Motyw"
-
 #~ msgid "in work "
 #~ msgstr "w utworze"
 
@@ -515,9 +535,6 @@ msgstr ""
 #~ msgid "Table of contents"
 #~ msgstr "Spis treści"
 
-#~ msgid "Themes"
-#~ msgstr "Motywy"
-
 #~ msgid "Edit. note"
 #~ msgstr "Nota red."
 
@@ -631,9 +648,6 @@ msgstr ""
 #~ msgid "All books"
 #~ msgstr "Wszystkie utwory"
 
-#~ msgid "Audiobooks"
-#~ msgstr "Audiobooki"
-
 #~ msgid "DAISY"
 #~ msgstr "DAISY"
 
@@ -685,8 +699,8 @@ msgstr ""
 #~ msgid ""
 #~ "Audiobooks were prepared as a part of the %(cs)s project funded by %(fb)s."
 #~ msgstr ""
-#~ "Audiobooki przygotowane w ramach projektu %(cs)s finansowanego przez %(fb)"
-#~ "s."
+#~ "Audiobooki przygotowane w ramach projektu %(cs)s finansowanego przez "
+#~ "%(fb)s."
 
 #~ msgid "Audiobooks were prepared as a part of the %(cs)s project."
 #~ msgstr "Audiobooki przygotowane w ramach projektu %(cs)s."
index 8830ebe..fd8a426 100644 (file)
@@ -1,3 +1,6 @@
+import os
+from .paths import VAR_DIR
+
 # limit number of filtering tags
 MAX_TAG_LIST = 6
 
@@ -15,3 +18,5 @@ CATALOGUE_CUSTOMPDF_RATE_LIMIT = '1/m'
 LIBRARIAN_PDF_MOREFLOATS = None
 
 LATEST_BLOG_POSTS = "http://nowoczesnapolska.org.pl/feed/?cat=-135"
+
+CATALOGUE_COUNTERS_FILE = os.path.join(VAR_DIR, 'catalogue_counters.p')
index 027879a..625b4c7 100644 (file)
@@ -16,11 +16,13 @@ STATIC_URL = '/static/'
 # CSS and JavaScript file groups
 
 PIPELINE = {
+    'PIPELINE_ENABLED': False,
     'STYLESHEETS': {
     'main': {
         # styles both for mobile and for big screen
         'source_filenames': [
             'css/jquery.countdown.css',
+            'jplayer/jplayer.blue.monday.css',
 
             'sponsors/css/sponsors.css',
 
@@ -77,6 +79,7 @@ PIPELINE = {
             'js/contrib/jquery.cycle.min.js',
             'js/contrib/jquery.jqmodal.js',
             'js/contrib/jquery.form.js',
+            'js/contrib/jquery.paging.min.js',
             'js/contrib/jquery.countdown.js', 'js/contrib/jquery.countdown-pl.js',
             'js/contrib/jquery.countdown-de.js', 'js/contrib/jquery.countdown-uk.js',
             'js/contrib/jquery.countdown-es.js', 'js/contrib/jquery.countdown-lt.js',
@@ -84,6 +87,10 @@ PIPELINE = {
 
             'js/contrib/jquery-ui-1.8.16.custom.min.js',
 
+            'jplayer/jquery.jplayer.min.js',
+            'jplayer/jplayer.playlist.min.js',
+            'player/player.js',
+
             'js/locale.js',
             'js/dialogs.js',
             'js/base.js',
index f2a8e26..5283468 100644 (file)
@@ -98,7 +98,7 @@
                                 menu_loaded = true;
                             });
                         }
-                                       } 
+                                       }
                                });
                        });
                    /* this kinda breaks the whole page. */
                                while (p.length) {
                                        if (p == $current)
                                                return;
-                                       if (p.hasClass('hidden-box-trigger') 
+                                       if (p.hasClass('hidden-box-trigger')
                                            || p.hasClass('simple-toggler')
                         || p.hasClass('mini-search'))
                                                return;
                                $current = null;
                        });
                })();
-               
+
 
 $('#show-menu').click(function(event) {
     event.preventDefault();
-    $('#menu').toggle('slow');
+    //$('#menu').toggle('slow');
+    $('body').toggleClass('menu-on');
 });
+
+
 $('#book-list-nav h2').click(function(event) {
     event.preventDefault();
     $('#book-list-nav-index').toggle();
@@ -152,16 +155,76 @@ $('#themes-list-toggle').click(function(event) {
       $('body').on('click', '.simple-toggler' , function(ev) {
        ev.preventDefault();
        var scope = $(this).closest('.simple-toggler-scope');
-       scope.find('.simple-hidden-box').each(function(){ 
+       scope.find('.simple-hidden-box').each(function(){
          var $this = $(this);
          if ($this.is(':hidden')) {
            $this.show();
-         } else { 
+         } else {
            $this.hide();
          }
          });
       });
 
+
+    $('.tabbed-filter').each(function() {
+        var tf = this;
+        $('.tab').click(function() {
+            if ($(this).hasClass('active')) {
+                $(this).removeClass('active');
+                $('#' + $(this).attr('data-id')).hide();
+            }
+            else {
+                var $active = $('.active', tf);
+                $active.removeClass('active');
+                $('#' + $active.attr('data-id')).hide();
+                $(this).addClass('active');
+                $('#' + $(this).attr('data-id')).show();
+            }
+        });
+    });
+
+
+    $('.plain-list-paged').each(function() {
+        // should change on resize?
+        var $plc = $(this);
+        var $pl = $('.plain-list', this);
+
+        var $items = $('p', $pl);
+
+        if ($items.length > 40) {
+            $items.hide();
+            var prev = [0, 0];
+
+            $('.pager', $plc).paging($items.length, {
+                format: '[< ncnnn >]', // define how the navigation should look like and in which order onFormat() get's called
+                perpage: 40,
+                lapping: 0, // don't overlap pages for the moment
+                page: 1, // start at page, can also be "null" or negative
+                onSelect: function (page) {
+                    var data = this.slice;
+                    $items.slice(prev[0], prev[1]).hide();
+                    $items.slice(data[0], data[1]).show();
+                    prev = data;
+                },
+                onFormat: function (type) {
+                    switch (type) {
+                        case 'block': // n and c
+                            return ' <a href="#"' + (this.value == this.page ? ' class="current"' : '') + '>' + this.value + '</a> ';
+                        case 'next': // >
+                            return ' <a href="#">&gt;</a> ';
+                        case 'prev': // <
+                            return ' <a href="#">&lt;</a> ';
+                        case 'first': // [
+                            return '<a href="#">«</a> ';
+                        case 'last': // ]
+                            return ' <a href="#">»</a>';
+                    }
+                }
+            });
+        }
+    });
+
+
     });
 })(jQuery);
 
diff --git a/src/wolnelektury/static/js/contrib/jquery.paging.min.js b/src/wolnelektury/static/js/contrib/jquery.paging.min.js
new file mode 100644 (file)
index 0000000..da169cb
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+jQuery paging plugin v1.3.0 23/06/2014
+http://www.xarg.org/2011/09/jquery-pagination-revised/
+
+Copyright (c) 2011, Robert Eisele (robert@xarg.org)
+Dual licensed under the MIT or GPL Version 2 licenses.
+*/
+(function(n,v,r){n.fn.paging=function(z,A){var t=this,b={setOptions:function(a){b.a=n.extend(b.a||{lapping:0,perpage:10,page:1,refresh:{interval:10,url:null},format:"",lock:!1,circular:!1,onClick:null,onFormat:function(){},onSelect:function(){return!0},onRefresh:function(){}},a||{});b.a.lapping|=0;b.a.perpage|=0;null!==b.a.page&&(b.a.page|=0);1>b.a.perpage&&(b.a.perpage=10);b.interval&&v.clearInterval(b.interval);b.a.refresh.url&&(b.interval=v.setInterval(function(){n.ajax({url:b.a.refresh.url,success:function(a){if("string"===
+typeof a)try{a=n.parseJSON(a)}catch(m){return}b.a.onRefresh(a)}})},1E3*b.a.refresh.interval));b.format=function(a){for(var b=0,f=0,h=1,g={g:[],i:0,h:0,b:5,current:3,l:0,m:0},c,p=/[*<>pq\[\]().-]|[nc]+!?/g,n={"[":"first","]":"last","<":"prev",">":"next",q:"left",p:"right","-":"fill",".":"leap"},e={};c=p.exec(a);)c=""+c,r===n[c]?"("===c?f=++b:")"===c?f=0:h&&("*"===c?(g.i=1,g.h=0):(g.i=0,g.h="!"===c.charAt(c.length-1),g.b=c.length-g.h,(g.current=1+c.indexOf("c"))||(g.current=1+g.b>>1)),g.g.push({f:"block",
+j:0,c:0}),h=0):(g.g.push({f:n[c],j:f,c:r===e[c]?e[c]=1:++e[c]}),"q"===c?++g.m:"p"===c&&++g.l);return g}(b.a.format);return b},setNumber:function(a){b.s=r===a||0>a?-1:a;return b},setPage:function(a){function w(a,b,c){c=""+a.onFormat.call(b,c);p=b.value?p+c.replace(/<a/i,'<a data-page="'+b.value+'"'):p+c}if(b.a.lock)return b.a.onSelect(0,t),b;if(r===a){if(a=b.a.page,null===a)return b}else if(b.a.page==a)return b;b.a.page=a|=0;var m=b.s,f=b.a,h,g,c,p,x=1,e=b.format,d,k,l,q,y=e.g.length,u=y;f.perpage<=
+f.lapping&&(f.lapping=f.perpage-1);q=m<=f.lapping?0:f.lapping|0;0>m?(c=m=-1,h=Math.max(1,a-e.current+1-q),g=h+e.b):(c=1+Math.ceil((m-f.perpage)/(f.perpage-q)),a=Math.max(1,Math.min(0>a?1+c+a:a,c)),e.i?(h=1,g=1+c,e.current=a,e.b=c):(h=Math.max(1,Math.min(a-e.current,c-e.b)+1),g=e.h?h+e.b:Math.min(h+e.b,1+c)));for(;u--;){k=0;l=e.g[u];switch(l.f){case "left":k=l.c<h;break;case "right":k=g<=c-e.l+l.c;break;case "first":k=e.current<a;break;case "last":k=e.b<e.current+c-a;break;case "prev":k=1<a;break;
+case "next":k=a<c}x|=k<<l.j}d={number:m,lapping:q,pages:c,perpage:f.perpage,page:a,slice:[(k=a*(f.perpage-q)+q)-f.perpage,Math.min(k,m)]};for(p="";++u<y;){l=e.g[u];k=x>>l.j&1;switch(l.f){case "block":for(;h<g;++h)d.value=h,d.pos=1+e.b-g+h,d.active=h<=c||0>m,d.first=1===h,d.last=h===c&&0<m,w(f,d,l.f);continue;case "left":d.value=l.c;d.active=l.c<h;break;case "right":d.value=c-e.l+l.c;d.active=g<=d.value;break;case "first":d.value=1;d.active=k&&1<a;break;case "prev":(d.active=f.circular)?d.value=1===
+a?c:a-1:(d.value=Math.max(1,a-1),d.active=k&&1<a);break;case "last":(d.active=0>m)?d.value=1+a:(d.value=c,d.active=k&&a<c);break;case "next":(d.active=f.circular)?d.value=1+a%c:(d.active=0>m)?d.value=1+a:(d.value=Math.min(1+a,c),d.active=k&&a<c);break;case "leap":case "fill":d.pos=l.c;d.active=k;w(f,d,l.f);continue}d.pos=l.c;d.last=d.first=r;w(f,d,l.f)}t.length&&(n("a",t.html(p)).click(f.onClick||function(a){a.preventDefault();a=this;do if("a"===a.nodeName.toLowerCase())break;while(a=a.parentNode);
+b.setPage(n(a).data("page"));b.o&&(v.location=a.href)}),b.o=f.onSelect.call({number:m,lapping:q,pages:c,slice:d.slice},a,t));return b}};return b.setNumber(z).setOptions(A).setPage()}})(jQuery,this);
index 1a55573..26fcfed 100644 (file)
@@ -65,6 +65,8 @@
     position: fixed;
     top: 0;
     left: 0;
+    overflow-x: hidden;
+    overflow-y: auto;
     text-align: center;
     line-height: 1.1em;
     background: #191919;
index 1f1021a..2225c0f 100755 (executable)
@@ -75,7 +75,7 @@ ul.plain {
 .theme-list-link {
     @include mono;
     @include size(font-size, 11px);
-    
+
     &:after {
         @include size(padding-left, 11px);
         content: url("/static/img/arrow-teal.png");
@@ -108,3 +108,55 @@ ul.plain {
 .simple-hidden-initially {
     display: none;
 }
+
+
+.plain-list-container {
+    margin: 2em 0;
+    .plain-list {
+        column-count: 2;
+        -moz-column-count: 2;
+        -webkit-column-count: 2;
+
+        @media screen and (min-width: 768px) {
+            column-count: 4;
+            -moz-column-count: 4;
+            -webkit-column-count: 4;
+        }
+        @media screen and (min-width: 1024px) {
+            column-count: 5;
+            -moz-column-count: 5;
+            -webkit-column-count: 5;
+        }
+
+        p {
+            margin-top: 0;
+
+            &.header {
+                -webkit-column-break-after: avoid;
+                break-after: avoid;
+            }
+        }
+    }
+
+    .pager {
+        font-size: 18px;
+        margin-top: .5em;
+        text-align: center;
+
+        .current {
+            font-weight: bold;
+            color: black;
+        }
+    }
+}
+
+
+.tag-box {
+    display: block;
+
+    @media screen and (min-width: 768px) {
+        display: inline-block;
+        width: 48%;
+        margin-right: 1%;
+    }
+}
index d318fda..1674a29 100755 (executable)
     list-style: none;
 
     .Book-item {
-        @include min-screen($S_BOOK_SHORT_FULL) {
+        /*@include min-screen($S_BOOK_SHORT_FULL) {
             display: inline-block;
         }
-        vertical-align: top;
+        vertical-align: top;*/
     }
 }
 
         color: #0D7E85;
     }
 
-    @include min-screen($S_BOOK_SHORT_FULL) {
-        @include size(width, $W_BOOK_SHORT_FULL);
-    }
-
     .book-box-inner {
         position: relative;
         @include inner-box;
         @include size(min-height, 197.5px);
     }
+
+    .jp-type-playlist {
+        margin-top: 24px;
+
+        @media screen and (min-width: 1024px) {
+            position: absolute;
+            margin-top: 0;
+            right: 20px;
+            top: 60px;
+        }
+    }
+
 }
 
 
             }
         }
     }
+
+    .jp-type-playlist {
+        margin-top: 24px;
+
+        @media screen and (min-width: 1024px) {
+            float: right;
+        }
+    }
+
 }
 
 @media screen and (min-width: 50em) {
 
 .book-box-body {
     @include size(margin-bottom, 10px);
-    @include min-screen($S_BOOK_SHORT_FULL) {
-        margin-bottom: 0;
-        @include size(height, 170px);
-    }
     position: relative;
 
     .book-box-head,
 
     li {
         @include mono;
-        margin-top: 1em;
-
-        @include min-screen($S_BOOK_SHORT_FULL) {
-            display: inline-block;
-            margin-top: 0;
-        }
+        margin-top: 0;
     }
 
     .book-box-read {
-        @include min-screen($S_BOOK_SHORT_FULL) {
-            @include size(width, 126.5px);
-        }
-
         a {
             @include mono;
         }
     .book-box-download {
         position: relative;
 
-        @include min-screen($S_BOOK_SHORT_FULL) {
-            @include size(width, 93.5px);
-        }
-
         a {
-            position: relative;
-            z-index: 101;
-
             @mixin downarrow {
                 color: #0D7E85;
 
 
             &.downarrow {
                 @include downarrow;
-                &.hoverclick {
-                    color: black;
-                    &:before {
-                        display: none;
-                    }
-
-                    @include min-screen($S_BOOK_SHORT_FULL) {
-                        @include downarrow;
-                    }
-                }
             }
         }
 
         .book-box-formats {
-            @include size(padding-left, 19px);
-
-            @include min-screen($S_BOOK_SHORT_FULL) {
-                display: none;
-                position: absolute;
-
-                @include size(width, 180px);
-                @include size(padding-top, 38px);
-                @include size(padding-bottom, 9px);
-                @include size(padding-left, 19px);
-                @include size(padding-right, 19px);
-
-                @include white-box;
-
-                z-index: 100;
-
-                @include size(top, -16px);
-                @include size(left, -19px);
-            }
-
-            span {
-                display: block;
-                @include size(margin-top, 16px);
+            display: inline-block;
+            max-width: 220px;
+            vertical-align: top;
+            padding-top: 6px;
 
                 a {
-                    &:before {
-                        content: url("/static/img/download.png");
-                        @include size(font-size, 25px);
-                        @include size(margin-right, 3.71px);
-                        vertical-align: middle;
-                        font-weight: normal;
-                    }
+                    display: inline-block;
+                    @include size(padding, .2em 1em);
                 }
-
-                @include min-screen($S_BOOK_SHORT_FULL) {
-                    @include size(margin-top, 0);
-
-                    &:first-child {
-                        @include size(margin-top, 16px);
-                    }
-                    a:before {
-                        display:none;
-                    }
-                }
-            }
         }
-
-        &:hover .book-box-formats,
-        &.hover .book-box-formats {
-            display: block;
-        }
-    }
-
-    .book-box-audiobook {
-        @include min-screen($S_BOOK_SHORT_FULL) {
-            @include size(width, 77px);
-        }
-
-        a:before {
-            content: url("/static/img/listen.png");
-            @include size(font-size, 25px);
-            @include size(margin-right, 3.71px);
-            vertical-align: middle;
-            font-weight: normal;
-        }
-
     }
 }
 
index 2902862..a2d33ab 100755 (executable)
@@ -80,9 +80,9 @@
         display: block;
     }
 
-    span.help-text {
+    span.helptext {
         display: block;
-        font-size: 0.8em;
+        font-size: 0.9em;
         color: #999;
     }
 
         width: 29em;
     }
     #custom-pdf-window {
-        width: 24em;   
+        width: 24em;
     }
 }
 
index 63bd867..7360a0d 100755 (executable)
@@ -1,49 +1,19 @@
 $header_bg: #191919;
-
-
-#header-wrapper {
-    position: relative;
-
-    /* Upper-half both sides dark background */
-    &:before {
-        content: " ";
-        display: block;
-        z-index: -1;
-        position: absolute;
-        top: 0;
-        @include size(bottom, 45px);
-        left: 0;
-        width: 100%;
-        background-color: $header_bg;
-    }
-
-    /* Left-side dark background */
-    &:after {
-        content: " ";
-        display: block;
-        z-index: -1;
-        position: absolute;
-        top: 0;
-        bottom: 0;
-        left: 0;
-        width: 50%;
-        background-color: $header_bg;
-    }
-}
+$small_logo: .9;
 
 
 header#main {
     @include size(line-height, 20px); /* Make links easier to click when wrapped. */
     background-color: $header_bg;
     color: #bbb;
+    position: relative;
 
-    text-align:center;
+    Xtext-align:center;
+
+    @media screen and (min-width: 1024px) {
+        width: 975px;
+        margin:auto;
 
-    @media screen and (min-width: 62.5em) {
-        position: relative;
-        @include size(height, 94px);
-        @include size(width, 975px);
-        margin: auto;
     }
 
     a {
@@ -52,37 +22,126 @@ header#main {
 
     #logo {
         display: block;
+        margin: auto;
+
+        @include size(width, 173px);
         @include size(height, 94px);
 
-        @media screen and (min-width: 24em) {
-            @include size(width, 173px);
-            float: left;
+        img {
+            @include size(width, $small_logo * 173px);
+            @include size(height, $small_logo * 94px);
+            margin-top: (1 - $small_logo) * 94px / 2;
+            margin-left: (1 - $small_logo) * 173px / 2;
+
+            @media screen and (min-width: 768px) {
+                @include size(width, 173px);
+                @include size(height, 94px);
+                margin-top: 0;
+                margin-left: 0;
+            }
+        }
+
+        @media screen and (min-width: 1024px) {
+            margin-left: 0;
         }
     }
 
     #tagline {
-        margin-top: 0;
-        @include size(margin-left, 5px);
-        @include size(margin-right, 5px);
-        padding-top: 0;
-        @include size(font-size, 11px);
+        display: none;
+        position: absolute;
+        @include size(top, 3px);
+        @include size(left, 255px);
+        @include size(font-size, 13px);
 
-        @media screen and (min-width: 24em) {
-            @include size(padding-top, 6px);
-            @include size(font-size, 13px);
-            @include size(margin-left, 180px);
-            text-align: right;
+        @media screen and (min-width: 1024px) {
+            display: block;
         }
+    }
 
-        @media screen and (min-width: 62.5em) {
-            position: absolute;
-            @include size(top, 10px);
-            @include size(left, 255px);
-            @include size(margin-left, 0px);
+    #lang-menu {
+        display: block;
+        position: absolute;
+        top: 0;
+        right: 0;
+
+        @include mono;
+
+        #lang-button {
+            display:block;
+
+            @include size(font-size, 10px);
+            @include size(line-height, 17px);
+            @include size(padding-left, 25px);
+            @include size(padding-right, 20px);
+            @include size(padding-top, 16px);
+            @include size(padding-bottom, 16px);
+
+            .label {
+                &:after {
+                    @include size(padding-left, 10px);
+                    content: url("/static/img/arrow-gray.png");
+                    vertical-align: top;
+                }
+            }
+
+            .lang-flag {
+                @include size(font-size, 13px);
+                @include size(line-height, 15px);
+            }
         }
+
+
+        #lang-menu-items {
+            z-index: 9999;
+
+            button {
+                @include mono;
+                display: none;
+                background: #f7f7f7;
+                color: #6f6f6f;
+                cursor: pointer;
+                width: 100%;
+                margin: 0;
+                @include size(padding, 10px 0);
+
+                @media screen and (min-width: 62.5em) {
+                    @include size(padding, 5px 0);
+                }
+
+                border-width: 0;
+                @include size(border-bottom, 1px solid #ddd);
+
+                @include size(font-size, 13px);
+
+                &.active {
+                    color: #000;
+                }
+            }
+        }
+
+        &:hover, &.hover {
+            #lang-menu-items {
+                position: absolute;
+                padding: 0;
+                right: 0;
+                width: 100%;
+                button {
+                    display: block;
+                }
+            }
+        }
+
+    }
+
+
+    #main-menu-toggle {
+        position: absolute;
+        left: 0;
+        top: 0;
     }
 
-    #user-info {
+
+    X#user-info {
         margin-top: 0;
         @include size(margin-left, 5px);
         @include size(margin-right, 5px);
@@ -139,7 +198,7 @@ header#main {
         background: #444444;
         color: white;
 
-        @media screen and (min-width: 62.5em) {
+        @media screen and (min-width: 1024px) {
             position: absolute;
             @include size(top, 49px);
             @include size(left, 240px);
@@ -213,3 +272,43 @@ header#main {
         }
     }
 }
+
+
+
+
+
+@media screen and (min-width: 1024px) {
+    #whole-header {
+        height: 94px + 49px;
+    }
+
+    #header-wrapper {
+        position: relative;
+
+        /* Upper-half both sides dark background */
+        &:before {
+            content: " ";
+            display: block;
+            z-index: -1;
+            position: absolute;
+            top: 0;
+            @include size(bottom, 45px);
+            left: 0;
+            width: 100%;
+            background-color: $header_bg;
+        }
+
+        /* Left-side dark background */
+        &:after {
+            content: " ";
+            display: block;
+            z-index: -1;
+            position: absolute;
+            top: 0;
+            bottom: 0;
+            left: 0;
+            width: 50%;
+            background-color: $header_bg;
+        }
+    }
+}
index ddce4fc..8323f05 100755 (executable)
@@ -88,7 +88,7 @@
         }
     }
 
-    /* a long cite displays smaller */ 
+    /* a long cite displays smaller */
     .cite-small .cite-body {
         @include size(font-size, 16px);
         @media screen and (min-width: 30em) {
 }
 
 
-#promo-box {
-    @include size(margin-top, 16px);
+#main-library {
+    .main-library-row {
+        position: relative;
 
-    @media screen and (min-width: 33em) {
-        float: right;
-        @include size(margin-top, -51px);
-        @include size(width, 320px);
-    }
-
-    h1 {
-        @include size(padding, 20px 5px 0 10px);
-        @include size(height, 31px);
-        margin: 0;
-        background: #191919;
-        color: white;
-        @include mono;
-        @include size(font-size, 13px);
-        font-weight: normal;
+        .covers {
+            white-space: nowrap;
+            width: 90%;
+            overflow-x: hidden;
+            padding-bottom: 2px;
 
-        @media screen and (min-width: 33em) {
-            @include size(padding-left, 25px);
-            @include size(padding-right, 25px);
         }
-    }
-
-    #promo-box-body {
-        @include size(padding, 20px 5px);
-        @include size(border-bottom, 2px solid #efefef);
-        background: #efefef;
-
-        @media screen and (min-width: 33em) {
-            @include size(padding-left, 28px);
-            @include size(padding-right, 28px);
-        }
-
-        @media screen and (min-width: 62.5em) {
-            @include size(height, 300px);
-        }
-
-        a {
-            display: block;
-            color: #6c6c6c;
-        }
-        p {
-            margin-top: 0;
-            @include size(font-size, 12px);
-            line-height: 1.55em;
-            color: #6c6c6c;
-        }    
-        h2, h3 {
-            color: #0d777e;
-            @include size(font-size, 11px);
-            @include size(height, 27.5px);
-            margin: 0;
-            @include mono;
-            font-weight: normal;
-
-            &:after {
-                content: " >";
-            }
+        .note {
+            position: absolute;
+            right: 0;
+            top: 1px;
+            width: 139px;
+            height: 289px - 22px;
         }
     }
 }
         }
     }
 }
+
+.more {
+    display: block;
+    margin-top: .5em;
+}
+
+
+section {
+    margin-top: 2em;
+}
+
+
+.tag-box-section {
+    @media screen and (min-width: 768px) {
+        display: inline-block;
+        width: 48%;
+        margin-right: 2%;
+        vertical-align: top;
+
+        .tag-box {
+            display: block;
+            width: 100%;
+        }
+    }
+}
+
+#main-theme {
+    .white-box {
+        position: relative;
+
+        .cite {
+            display: none;
+
+            @media screen and (min-width: 768px) {
+                display: block;
+                position: absolute;
+                right: 1em;
+                top: 7em;
+                background: #F7F7F7;
+                width: 200px;
+                padding-left: 20px;
+            }
+
+            @media screen and (min-width: 1024px) {
+                width: 340px;
+                padding-left: 80px;
+            }
+        }
+    }
+}
index 846e4c8..c2f708a 100755 (executable)
-#nav-line {
-    background-color: #e2e2e2;
-    position: relative;
+/* ok */
 
-    @media screen and (min-width: 62.5em) {
-        @include size(width, 975px);
-        margin: auto;
-    }
+$menu_width: 200px;
 
-    #show-menu {
-        display: block;
-        float: left;
-        @include size(line-height, 13px);
-        @include size(padding, 18px 13px);
-        color: #0c7076;
-        @include size(font-size, 11px);
-        @include mono;
 
-        .long {
-            display: none;
-
-            &:after {
-                @include size(padding-left, 10px);
-                content: url("/static/img/arrow-gray.png");
-                vertical-align: top;
-            }
-        }
+/* This is duplication of code for reader menu button. */
+%menu-toggle {
+    position: relative;
+    padding: 0;
+    &:before {
+        content: "";
+        position: absolute;
+        top: 8px;
+        height: 5px;
+        border-top: 15px double #ddd;
+        border-bottom: 5px solid #ddd;
+    }
+}
 
-        @media screen and (min-width: 20em) {
-            .long { display: inline; }
-            .short { display: none; }
-        }
 
-        @media screen and (min-width: 53em) {
-            display: none;
-        }
+#show-menu {
+    @extend %menu-toggle;
+    display: block;
+    background: #191919;
+    color: #ddd;
+    text-align: center;
+    z-index: 100;
+    @include size(width, 44px);
+    @include size(height, 44px);
+    padding: 0;
+    position: absolute;
+    left: 10px;
+    top: 25px;
+
+    &:before {
+        left: 8px;
+        right: 8px;
     }
 
-    ul#menu {
-        list-style: none;
-        padding: 0;
-        margin: 0;
-
+    @media screen and (min-width: 1024px) {
         display: none;
-        position: absolute;
-        @include size(top, 49px);
-        left: 0;
-        @include size(right, 10px);
-        z-index: 400;
-
-        @media screen and (min-width: 24em) {
-            right: auto;
-        }
-
-        @media screen and (min-width: 53em) {
-            display: block !important;
-            position: static;
-            @include size(margin-left, 6px);
-        }
-
-        li.menu {
-            background-color: #e2e2e2;
+    }
+}
 
-            @media screen and (min-width: 53em) {
-                float: left;
-            }
+body.menu-on {
+    margin-left: $menu_width;
+    margin-right: -$menu_width;
 
-            a.menu {
-                display: block;
-                @include size(line-height, 13px);
-                @include size(padding, 18px 12px 15px);
-                @include size(border-bottom, 3px solid #e2e2e2);
-                color: #0c7076;
-                @include size(font-size, 11px);
-                @include mono;
-            }
+    @media screen and (min-width: 1024px) {
+        margin-left: 0;
+        margin-right: 0;
+    }
 
-            a.hidden-box-trigger:hover {
-                border-bottom-color: white;
-            }
-        }
+    #menu {
+        display: block;
     }
+}
 
-    #lang-menu {
+#menu {
+    display: none;
+    position: fixed;
+    left: 0;
+    top: 0;
+    width: $menu_width;
+    background: #141414;
+    height: 100%;
+    overflow-y: auto;
+    z-index: 90;
+
+    @media screen and (min-width: 1024px) {
         display: block;
-        float: right;
+        width: 975px;
+        height: 0;
+        overflow: visible;
+        margin: auto;
+        position: absolute;
+        top: 0;
+    }
 
-        background: #f7f7f7;
-        @include mono;
+    ul {
+        list-style: none;
+        padding: 0;
 
-        @media screen and (min-width: 15em) {
-            position: relative;
+        li {
+            padding: .5em 1em;
+
+            @media screen and (min-width: 1024px) {
+                padding: 0;
+            }
         }
+    }
+}
 
-        #lang-button {
-            @include size(padding-left, 25px);
-            @include size(padding-right, 20px);
 
-            display:block;
-            @include size(line-height, 17px);
-            @include size(padding-top, 16px);
-            @include size(padding-bottom, 16px);
 
-            @include size(font-size, 10px);
-            color: #717171;
 
-            .label {
-                display: none;
+@media screen and (min-width: 1024px) {
+    #user-info {
+        @include mono;
+        position: absolute;
+        right: 150px;
+        top: 4px;
+        @include size(font-size, 10px);
+        list-style: none;
 
-                @media screen and (min-width: 62.5em) {
-                    display: inline;
-                }
+        li {
+            display: inline;
 
-                &:after {
-                    @include size(padding-left, 10px);
-                    content: url("/static/img/arrow-gray.png");
-                    vertical-align: top;
-                }
+            &:after {
+                content: " | ";
             }
-
-            .lang-flag {
-                @include size(font-size, 13px);
-                @include size(line-height, 15px);
+            &:last-child:after {
+                content: "";
             }
         }
+    }
 
-        #lang-menu-items {
-            z-index: 9999;
+    #main-menu {
+        list-style: none;
+        padding: 0;
+        margin: 0;
 
-            button {
-                @include mono;
-                display: none;
-                background: #f7f7f7;
-                color: #6f6f6f;
-                cursor: pointer;
-                width: 100%;
-                margin: 0;
-                @include size(padding, 10px 0);
-
-                @media screen and (min-width: 62.5em) {
-                    @include size(padding, 5px 0);
-                }
+        background-color: #e2e2e2;
+        position: absolute;
+        top: 94px;
+        @include size(width, 975px);
 
-                border-width: 0;
-                @include size(border-bottom, 1px solid #ddd);
+        li {
+            display: inline-block;
+            @include size(width, 20%);
 
-                @include size(font-size, 13px);
+            a {
+                text-align: center;
+                display: block;
+                @include size(line-height, 13px);
+                @include size(padding, 18px 0 15px);
+                @include size(border-bottom, 3px solid #e2e2e2);
+                color: #0c7076;
+                @include size(font-size, 11px);
+                @include mono;
 
                 &.active {
-                    color: #000;
-                }
-            }
-        }
-
-        &:hover, &.hover {
-            #lang-menu-items {
-                position: absolute;
-                padding: 0;
-                left: 0;
-                right: 0;
-
-                @media screen and (min-width: 15em) {
-                    left: auto;
-                    @include size(width, 180px);
-                    @include size(top, 49px);
-                }
-                @media screen and (min-width: 62.5em) {
-                    width: 100%;
-                }
-
-                button {
-                    display: block;
+                    border-bottom-color: white;
                 }
             }
         }
index 69d34a3..0377741 100644 (file)
@@ -17,7 +17,7 @@
             margin-left: 0;
         }
 
-        
+
         @media screen and (min-width: 62.5em) {
             .book-box-head, .tags, .book-box-tools {
                 float: right;
     }
 }
 
-
-.work-list {
-    .Picture-item {
-        @include min-screen($S_BOOK_SHORT_FULL) {
-            display: inline-block;
-        }
-        vertical-align: top;
-    }
-}
index d120a3f..1e1801c 100755 (executable)
@@ -1,8 +1,89 @@
-.page-desc {
-    @include size(margin-left, 15px);
+.tabbed-filter {
+    position: relative;
+    border-bottom: 1px solid #ddd;
+    padding-bottom: 4em;
+
+    @media screen and (min-width: 375px) {
+        padding-bottom: 2em;
+    }
+
+    @media screen and (min-width: 1024px) {
+        padding-bottom: 0;
+    }
+
+
+    .tabs {
+        position: absolute;
+        right: 0;
+        bottom: 0;
+        float: right;
+        text-align: right;
+
+        .tab {
+            cursor: pointer;
+            display: inline-block;
+            margin-bottom: -1px;
+            box-shadow: none;
+
+            &.active {
+                border-bottom-color: white;
+            }
+        }
+    }
 }
+.tabbed-filter-contents {
+    margin-bottom: 2em;
+    .tab-content {
+        display: none;
+        border-top: none;
+
+        ul {
+            list-style: none;
+            margin-left: 0;
+            padding-left: 10px;
+
+            li {
+                display: inline-block;
+                margin-right: 1em;
+                border-radius: 1em;
+                padding: .5em;
+
+                &.header {
+                    width: 6em;
+                }
+
+                &.active {
+                    background: #0D7E85;
+                    color: #ddd;
+
+                    a {
+                        display: inline-block;
+                        width: 1.5em;
+                        text-align: center;
+                        margin-left: .5em;
+                        border-radius: 1em;
+                        background: white;
+                    }
+                }
+
+                &.other {
+                    a {
+                        color: #ddd;
+                    }
+                }
+            }
+        }
+    }
+}
+
+
 
 #tagged-object-list {
+
+
+
+
+
     @media screen and (min-width: 62.5em) {
         .left-column, .right-column {
             @include size(width, 480px);
index f20fba8..9872140 100644 (file)
@@ -1,29 +1,13 @@
 .social-shelf-tags {
     list-style: none;
     padding: 0;
-    margin: 10px 0;
 
-    @include min-screen($S_BOOK_SHORT_FULL) {
-        position: absolute;
-        top: 134px;
-        left: 152px;
-        padding: 10px 10px 5px 10px;
-        margin: 10px 0;
-        width: 310px;
-        overflow: hidden;
+    position: absolute;
+    top: 10px;
+    right: 50px;
         text-overflow: ellipsis;
         white-space: nowrap;
 
-        &:hover {
-            overflow: visible;
-            text-overflow: ellipsis;
-            white-space: normal;
-            z-index: 1000;
-            background: #fff;
-            box-shadow: 0 0 2px #ddd;
-        }
-    }
-
     li {
         display: inline-block;
         margin-right: .5em;
index 6bcdf12..ebd6286 100755 (executable)
@@ -1,7 +1,9 @@
 {% extends "site_base.html" %}
 
 {% block body %}
+<div class="white-box normal-text">
 {% block content %} {% endblock %}
+</div>
 {% endblock %}
 
 {% block extrabody %}
index f1450cb..44f05a8 100755 (executable)
         {% ssi_include 'social_cite_main' pk=cite_pk %}
     {{ cite_pk.endif }}
 
+    <section id="main-library">
+        <h1>W naszej cyfrowej bibliotece znajdziesz</h1>
+        <div class="main-library-row">
+            <div class="covers">
+            {% for b in best %}
+                {% ssi_include 'catalogue_book_mini' pk=b.pk %}
+            {% endfor %}
+            </div>
+            <div class="note white-box normal-text" style="font-size: 18px">
+            i wiele innych książek, wierszy, obrazów, audiobooków…
+            </div>
+        </div>
+    </section>
 
-
-    <section id="promo-box">
-        <h1>{% trans "What's new?" %}</h1>
-        <div id="promo-box-body">
-            {% ssi_include 'chunk' key='promo' %}
+    <section id="main-theme">
+        <h1>Motywy i tematy</h1>
+        <div class="white-box normal-text">
+        <h2>{% trans "Theme" %}: {{ theme }}</h2>
+        <p>Utwory, w których występuje ten motyw:</p>
+        {% for book in theme_books %}
+            {% ssi_include 'catalogue_book_mini' pk=book.pk %}
+        {% endfor %}
+        {% if theme_fragment %}
+            {% ssi_include 'catalogue_fragment_promo' pk=theme_fragment.pk %}
+        {% endif %}
         </div>
+        <a class="more" href="{% url 'theme_catalogue' %}">Zobacz katalog motywów</a>
+    </section>
+
+    <section class="tag-box-section">
+        <h1>Autorzy</h1>
+      <a class="tag-box" href="{{ author.get_absolute_url }}">
+      {% ssi_include "catalogue_tag_box" pk=author.pk %}
+      </a>
+        <a class="more" href="{% url 'author_catalogue' %}">Zobacz katalog autorów</a>
+    </section>
+
+    <section class="tag-box-section">
+        <h1>Gatunki</h1>
+      <a class="tag-box" href="{{ genre.get_absolute_url }}">
+      {% ssi_include "catalogue_tag_box" pk=genre.pk %}
+      </a>
+        <a class="more" href="{% url 'genre_catalogue' %}">Zobacz katalog gatunków</a>
+    </section>
+
+    <section class="tag-box-section">
+        <h1>Rodzaje</h1>
+      <a class="tag-box" href="{{ kind.get_absolute_url }}">
+      {% ssi_include "catalogue_tag_box" pk=kind.pk %}
+      </a>
+        <a class="more" href="{% url 'kind_catalogue' %}">Zobacz katalog rodzajów</a>
     </section>
 
+    <section class="tag-box-section">
+        <h1>Epoki</h1>
+      <a class="tag-box" href="{{ epoch.get_absolute_url }}">
+      {% ssi_include "catalogue_tag_box" pk=epoch.pk %}
+      </a>
+        <a class="more" href="{% url 'epoch_catalogue' %}">Zobacz katalog epok</a>
+    </section>
 
-    <section id="main-last">
-        <h1><a href="{% url 'recent_list' %}">{% trans "Recent publications" %}</a></h1>
+    <section>
+        <h1>Kolekcje</h1>
+        {% ssi_include 'catalogue_collection_box' pk=collection.pk %}
+        <a class="more" href="{% url 'catalogue_collections' %}">Zobacz katalog kolekcji</a>
+    </section>
+
+    <section>
+        <h1>{% trans "Recent publications" %}</h1>
             {% for book in last_published %}
                 {% ssi_include 'catalogue_book_mini' pk=book.pk %}
             {% endfor %}
+        <a class="more" href="{% url 'recent_list' %}">{% trans "More recent publications" %}</a>
     </section>
 
     <div class="clearboth"></div>
             <li><a href="{% url 'oaipmh' %}">OAI-PMH</a></li>
             <li><a href="{% url 'lesmianator' %}" lang="pl">Leśmianator</a></li>
             <li><a href="http://polski.wolnelektury.pl" lang="pl">Materiały do nauki j. polskiego</a></li>
-            
+
         </ul>
     </section>
 
index 3df16a8..0c7316e 100644 (file)
@@ -5,9 +5,10 @@
 {% block head_title %}{% trans "Account Connections" %}{% endblock %}
 
 {% block body %}
+<div class="normal-text white-box">
+
 <h1>{% trans "Account Connections" %}</h1>
 
-<div class="normal-text white-box">
 {% if form.accounts %}
 <p>{% blocktrans %}You can sign in to your account using any of the following third party accounts:{% endblocktrans %}</p>
 
index 7e29b65..bee5564 100644 (file)
@@ -5,10 +5,10 @@
 {% block head_title %}{% trans "Login Cancelled" %}{% endblock %}
 
 {% block body %}
-    
+<div class="normal-text white-box">
+
 <h1>{% trans "Login Cancelled" %}</h1>
 
-<div class="normal-text white-box">
 {% url 'socialaccount_login' as login_url %}
 {{ login_url }}
 
index 08d60a3..d36f222 100644 (file)
             {{ current_offer.endif }}
         {% endif %}
 
+        <div id="whole-header">
         <div id="header-wrapper">
         <header id="main">
+
             <a href="/" id="logo">
                 <img src="{% static 'img/logo-neon.png' %}" alt="Wolne Lektury" />
             </a>
 
-            <p id="user-info">
-                {% user_username as user_username %}
-                {% user_is_staff as user_is_staff %}
-                {{ user_username.if }}{% trans "Welcome" %}, <span class="hidden-box-wrapper">
-                        <a href="{% url 'user_settings' %}" class="hidden-box-trigger">
-                            <strong>{{ user_username }}</strong>
-                        </a>
-                        <span id="user-menu" class="hidden-box">
-                            <a href="{% url 'account_set_password' %}">{% trans "Password" %}</a><br/>
-                            <a href="{% url 'account_email' %}">{% trans "E-mail" %}</a><br/>
-                            <a href="{% url 'socialaccount_connections' %}">{% trans "Social accounts" %}</a><br/>
-                        </span>
-                    </span> | <a href="{% url 'social_my_shelf' %}" id="user-shelves-link">{% trans "My shelf" %}</a>
-                {{ user_username.endif }}
-                {{ user_is_staff.if }} | <a href="/admin/">{% trans "Administration" %}</a>
-                {{ user_is_staff.endif }}
-                {{ user_username.if }} | <a href="{% url 'logout' %}?next={% block logout %}{{ request.get_full_path }}{% endblock %}">{% trans "Logout" %}</a>
-                {{ user_username.else }}
-                    <a href="{% url 'login' %}?next={{ request.path }}" id="login" class="ajaxable">{% trans "Sign in" %}</a> / <a href="{% url 'register' %}?next={{ request.path }}" id="register" class="ajaxable">{% trans "Register" %}</a>
-                {{ user_username.endif }}
-            </p>
-
             <p id="tagline">
                     {% url 'book_list' as b %}
                     {% url 'infopage' 'prawa' as r %}
                     {% endblocktrans %}
             </p>
 
-            <form id="search-area" action="{% url 'search' %}">
-                <div id="search-field">
-                    <label for="search">{{search_form.q.label}}</label>
-                        {{search_form.q}}
-                </div><button type='submit'>{% trans "Search" %}</button>
-            </form>
-
-        </header>
-        </div>
-
-
-        <nav id="nav-line">
-            {% catalogue_menu %}
-
             <div id="lang-menu" class="hoverget">
                 <span id='lang-button' class='hoverclick'>
                     <span class="lang-flag">⚐</span>
-                    <span class="label"> {% trans "Language versions" %}</span>
+                    <span class="label"> {% trans "Language" %}</span>
                 </span>
                 <div id="lang-menu-items">
                 {% for lang in LANGUAGES %}
                 </div>
             </div>
 
-            <div class="clearboth"></div>
-        </nav>
+            <a id="show-menu"></a>
+            <nav id="menu">
+
+            <ul id="user-info">
+                {% user_username as user_username %}
+                {% user_is_staff as user_is_staff %}
+                {{ user_username.if }}<li>
+                        <a href="{% url 'user_settings' %}">
+                            <strong>{{ user_username }}</strong>
+                        </a>
+                    </li>
+                <li><a href="{% url 'social_my_shelf' %}" id="user-shelves-link">{% trans "My shelf" %}</a>
+                </li>
+                {{ user_username.endif }}
+                {{ user_is_staff.if }}<li><a href="/admin/">{% trans "Administration" %}</a></li>
+                {{ user_is_staff.endif }}
+                {{ user_username.if }}<li><a href="{% url 'logout' %}?next={% block logout %}{{ request.get_full_path }}{% endblock %}">{% trans "Logout" %}</a></li>
+                {{ user_username.else }}
+                    <li>
+                    <a href="{% url 'login' %}?next={{ request.path }}" id="login">{% trans "Sign in" %}</a> / <a href="{% url 'register' %}?next={{ request.path }}" id="register">{% trans "Register" %}</a>
+                    </li>
+                {{ user_username.endif }}
+            </ul>
+
+
+            <ul id="main-menu">
+                <li><a href="{% url 'book_list' %}">{% trans "Literature" %}</a></li>
+                <li><a href="{% url 'theme_catalogue' %}">{% trans "Themes" %}</a></li>
+                <li><a href="{% url 'audiobook_list' %}">{% trans "Audiobooks" %}</a></li>
+                <li><a href="{% url 'gallery' %}">{% trans "Gallery" %}</a></li>
+                <li><a href="{% url 'catalogue' %}">Wszystkie utwory</a></li>
+            </ul>
+
+
+            </nav>
+
+            <form id="search-area" action="{% url 'search' %}">
+                <div id="search-field">
+                    <label for="search">{{search_form.q.label}}</label>
+                        {{search_form.q}}
+                </div><button type='submit'>{% trans "Search" %}</button>
+            </form>
+
+        </header>
+        </div>
+        </div>
+
 
 
         <div id="main-content">
index 0ffdd62..fa2f660 100644 (file)
@@ -6,9 +6,10 @@
 
 {% block body %}
 
+<div class="normal-text white-box">
+
 <h1>{% trans "User" %}</h1>
 
-<div class='normal-text'>
 <p><a href="{% url 'account_set_password' %}">{% trans "Password" %}</a></p>
 <p><a href="{% url 'account_email' %}">{% trans "E-mail" %}</a></p>
 <p><a href="{% url 'socialaccount_connections' %}">{% trans "Social accounts" %}</a></p>
index 5137173..0ff2d67 100644 (file)
@@ -18,16 +18,46 @@ from django.views.decorators.cache import never_cache
 
 from ajaxable.utils import AjaxableFormView
 from ajaxable.utils import placeholdized
-from catalogue.models import Book
+from catalogue.models import Book, Collection, Tag, Fragment
 from ssify import ssi_included
 
 
 def main_page(request):
-    last_published = Book.objects.exclude(cover_thumb='').filter(parent=None).order_by('-created_at')[:4]
+    ctx = {
+        'last_published': Book.objects.exclude(cover_thumb='').filter(parent=None).order_by('-created_at')[:6],
+    }
 
-    return render(request, "main_page.html", {
-        'last_published': last_published,
-    })
+    for category in ('author', 'epoch', 'genre', 'kind'):
+        try:
+            ctx[category] = Tag.objects.filter(category=category).order_by('?')[:1][0]
+        except IndexError:
+            pass
+
+    # FIXME: find this theme and books properly.
+    ctx['theme_books'] = []
+    if Fragment.objects.count():
+        while True:
+            ctx['theme'] = Tag.objects.filter(category='theme').order_by('?')[:1][0]
+            tf = Fragment.tagged.with_any([ctx['theme']]).order_by('?')[:100]
+            if not tf:
+                continue
+            ctx['theme_fragment'] = tf[0]
+            for f in tf:
+                if not f.book in ctx['theme_books']:
+                    ctx['theme_books'].append(f.book)
+                if len(ctx['theme_books']) == 3:
+                    break
+            break
+
+    # Choose a collection for main.
+    try:
+        ctx['collection'] = Collection.objects.order_by('?')[:1][0]
+    except IndexError:
+        pass
+
+    ctx['best'] = Book.objects.order_by('?')[:5]
+
+    return render(request, "main_page.html", ctx)
 
 
 class LoginFormView(AjaxableFormView):