From 5411431fe8c247572635a206cc977816dded415c Mon Sep 17 00:00:00 2001
From: Radek Czajka
Date: Fri, 16 Sep 2011 16:11:00 +0200
Subject: [PATCH] footnotes dictionary fixes
---
.../locale/pl/LC_MESSAGES/django.mo | Bin 594 -> 876 bytes
.../locale/pl/LC_MESSAGES/django.po | 30 ++++++++++++++----
apps/dictionary/models.py | 3 +-
.../templates/dictionary/note_list.html | 12 ++++++-
apps/dictionary/urls.py | 2 +-
apps/dictionary/views.py | 6 ++--
wolnelektury/static/css/master.css | 4 +++
7 files changed, 45 insertions(+), 12 deletions(-)
diff --git a/apps/dictionary/locale/pl/LC_MESSAGES/django.mo b/apps/dictionary/locale/pl/LC_MESSAGES/django.mo
index 1104f8ba70732fbb29a51cfea8bd879bb6d9d920..9e999eb97a7b1ea33440bcbfee073e01a05d01f7 100644
GIT binary patch
delta 472
zcmZ{eu}VWR6o%7!EtLvI7f~ECD5&72E-DTV4!U%xli+r3QwR;oB}uvDQn=4>5y3~$
z*(VU!PUmUX<3p=;1HsK390!djpW6+wImU%36P`H8|y$mUje
z+t9vJRw~QT3}x@%(69aU#L+(2#!|toWtyB$j?7<2m82I+EK1g913T0%PDPonu3$DD
z?e=)rawQY(%G-lz|EP6XzHC7ETIKhsnu_bJ@>pETM6et-MMK0?=Pu&
ki%EwwotZqLf+KxGI^jb%ZD{7Rhn!0xJHdf7cEB0=0r-D;lmGw#
delta 211
zcmaFEc8R6_o)F7a1|VPtVi_Pd0b*7l_5orLNC0AfAWj5gkeWguKE%ktPzt0$;ucH{
z44gpP14sjf8GsZRfYgG4Q>8*$W>Im8LQZN)Noo;8VonZ2Kv8~HYI2FLXNsh5SZYym
zW`3TPLV%;Qx1+nOLYQk%u&2M@WGhB<79%So!^x$LDiFq8#+u2}Ob4X`GEne9
Tax#G?CNcoomBl65nW+o_|4u6F
diff --git a/apps/dictionary/locale/pl/LC_MESSAGES/django.po b/apps/dictionary/locale/pl/LC_MESSAGES/django.po
index 8184c9a75..4600948cc 100644
--- a/apps/dictionary/locale/pl/LC_MESSAGES/django.po
+++ b/apps/dictionary/locale/pl/LC_MESSAGES/django.po
@@ -5,24 +5,40 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
+"Project-Id-Version: WolneLektury-dictionary\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-09-16 12:21+0200\n"
-"PO-Revision-Date: 2011-09-16 12:21+0100\n"
+"POT-Creation-Date: 2011-09-16 16:08+0200\n"
+"PO-Revision-Date: 2011-09-16 16:10+0100\n"
"Last-Translator: Radek Czajka \n"
"Language-Team: LANGUAGE \n"
-"Language: \n"
+"Language: pl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
-#: templates/dictionary/note_list.html:11
+#: templates/dictionary/note_list.html:8
+msgid "Footnotes on WolneLektury.pl"
+msgstr "Przypisy w WolneLektury.pl"
+
+#: templates/dictionary/note_list.html:12
+msgid "Footnotes"
+msgstr "Przypisy"
+
+#: templates/dictionary/note_list.html:17
msgid "By first letter"
msgstr "Pierwsza litera"
-#: templates/dictionary/note_list.html:13
-#: templates/dictionary/note_list.html:15
+#: templates/dictionary/note_list.html:19
+#: templates/dictionary/note_list.html:21
msgid "all"
msgstr "wszystkie"
+#: templates/dictionary/note_list.html:36
+#, python-format
+msgid "%(c)s footnote found"
+msgid_plural "%(c)s footnotes found"
+msgstr[0] "Znaleziono %(c)s przypis."
+msgstr[1] "Znaleziono %(c)s przypisy."
+msgstr[2] "Znaleziono %(c)s przypisów."
+
diff --git a/apps/dictionary/models.py b/apps/dictionary/models.py
index f2a9ddf28..b22e4be42 100644
--- a/apps/dictionary/models.py
+++ b/apps/dictionary/models.py
@@ -25,7 +25,8 @@ def notes_from_book(sender, **kwargs):
if sender.html_file:
for anchor, text_str, html_str in html.extract_annotations(sender.html_file.path):
Note.objects.create(book=sender, anchor=anchor,
- html=html_str, sort_key=sortify(text_str)[:128])
+ html=html_str,
+ sort_key=sortify(text_str).strip()[:128])
# always re-extract notes after making a HTML in a Book
Book.html_built.connect(notes_from_book)
diff --git a/apps/dictionary/templates/dictionary/note_list.html b/apps/dictionary/templates/dictionary/note_list.html
index 6ae3664ea..e0b10f3c2 100755
--- a/apps/dictionary/templates/dictionary/note_list.html
+++ b/apps/dictionary/templates/dictionary/note_list.html
@@ -2,8 +2,14 @@
{% load i18n pagination_tags %}
{% load catalogue_tags %}
+
+{% block bodyid %}footnotes{% endblock %}
+
+{% block title %}{% trans "Footnotes on WolneLektury.pl" %}{% endblock %}
+
+
{% block body %}
- Przypisy
+ {% trans "Footnotes" %}
{% search_form %}
@@ -26,6 +32,10 @@
+
+{% blocktrans count object_list.count as c %}{{c}} footnote found{% plural %}{{c}} footnotes found{% endblocktrans %}
+
+
{% if object_list %}
{% autopaginate object_list 100 %}
diff --git a/apps/dictionary/urls.py b/apps/dictionary/urls.py
index 84a30d7e0..435e0bd6b 100755
--- a/apps/dictionary/urls.py
+++ b/apps/dictionary/urls.py
@@ -7,6 +7,6 @@ from django.conf.urls.defaults import *
urlpatterns = patterns('dictionary.views',
url(r'^$', 'letter_notes', name='dictionary_notes'),
- url(r'(?P[a-z])/$', 'letter_notes', name='dictionary_notes'),
+ url(r'(?P[a-z]|0-9)/$', 'letter_notes', name='dictionary_notes'),
)
diff --git a/apps/dictionary/views.py b/apps/dictionary/views.py
index 9f0022475..e12006366 100755
--- a/apps/dictionary/views.py
+++ b/apps/dictionary/views.py
@@ -8,9 +8,11 @@ from dictionary.models import Note
def letter_notes(request, letter=None):
form = SearchForm()
- letters = [chr(a) for a in range(ord('a'), ord('z')+1)]
+ letters = ["0-9"] + [chr(a) for a in range(ord('a'), ord('z')+1)]
objects = Note.objects.all()
- if letter:
+ if letter == "0-9":
+ objects = objects.filter(sort_key__regex=r"^[0-9]")
+ elif letter:
objects = objects.filter(sort_key__startswith=letter)
return object_list(request, queryset=objects, extra_context=locals())
diff --git a/wolnelektury/static/css/master.css b/wolnelektury/static/css/master.css
index 89040a5b7..4100e2b7c 100644
--- a/wolnelektury/static/css/master.css
+++ b/wolnelektury/static/css/master.css
@@ -1180,3 +1180,7 @@ div.shown-tags p, div.all-tags p {
.dictionary-note-source {
margin-top: -1em;
}
+
+#footnotes .pagination {
+ margin-top: 1em;
+}
--
2.20.1