fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5158c6e
)
Support for source names, developmentStage.
author
Radek Czajka
<radekczajka@nowoczesnapolska.org.pl>
Mon, 30 Jun 2014 08:50:14 +0000
(10:50 +0200)
committer
Radek Czajka
<radekczajka@nowoczesnapolska.org.pl>
Mon, 30 Jun 2014 08:50:14 +0000
(10:50 +0200)
apps/catalogue/constants.py
patch
|
blob
|
history
apps/catalogue/locale/pl/LC_MESSAGES/django.mo
patch
|
blob
|
history
apps/catalogue/locale/pl/LC_MESSAGES/django.po
patch
|
blob
|
history
apps/catalogue/models/book.py
patch
|
blob
|
history
apps/catalogue/templates/catalogue/book_short.html
patch
|
blob
|
history
apps/catalogue/templates/catalogue/book_wide.html
patch
|
blob
|
history
apps/catalogue/templatetags/catalogue_tags.py
patch
|
blob
|
history
lib/librarian
patch
|
blob
|
history
diff --git
a/apps/catalogue/constants.py
b/apps/catalogue/constants.py
index
36f4f5d
..
56fe939
100644
(file)
--- a/
apps/catalogue/constants.py
+++ b/
apps/catalogue/constants.py
@@
-36,3
+36,9
@@
LANGUAGES_3TO2 = {
'rus': 'ru',
'ukr': 'uk',
}
'rus': 'ru',
'ukr': 'uk',
}
+
+SOURCE_NAMES = {
+ u'pl.wikisource.org': _(u'Wikisource'),
+ u'de.wikisource.org': _(u'Wikisource'),
+ u'www.polona.pl': u'CBN Polona',
+}
diff --git
a/apps/catalogue/locale/pl/LC_MESSAGES/django.mo
b/apps/catalogue/locale/pl/LC_MESSAGES/django.mo
index
66ae688
..
5605ea8
100644
(file)
Binary files a/apps/catalogue/locale/pl/LC_MESSAGES/django.mo and b/apps/catalogue/locale/pl/LC_MESSAGES/django.mo differ
diff --git
a/apps/catalogue/locale/pl/LC_MESSAGES/django.po
b/apps/catalogue/locale/pl/LC_MESSAGES/django.po
index
5eb1779
..
ecd213e
100644
(file)
--- a/
apps/catalogue/locale/pl/LC_MESSAGES/django.po
+++ b/
apps/catalogue/locale/pl/LC_MESSAGES/django.po
@@
-1,16
+1,16
@@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
msgid ""
msgstr ""
#
msgid ""
msgstr ""
-"Project-Id-Version:
PACKAGE VERSION
\n"
+"Project-Id-Version:
WolneLektury
\n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-0
2-05 11:21+01
00\n"
-"PO-Revision-Date: 2014-0
2-05 11:21
+0100\n"
+"POT-Creation-Date: 2014-0
6-30 10:37+02
00\n"
+"PO-Revision-Date: 2014-0
6-30 10:34
+0100\n"
"Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
"Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language-Team: Fundacja Nowoczesna Polska <fundacja@nowoczesnapolska.org."
+"pl>\n"
+"Language: pl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@
-22,6
+22,10
@@
msgid "Creative Commons Attribution-ShareAlike 3.0 Unported"
msgstr ""
"Creative Commons Uznanie autorstwa – Na tych samych warunkach 3.0 Unported"
msgstr ""
"Creative Commons Uznanie autorstwa – Na tych samych warunkach 3.0 Unported"
+#: constants.py:41 constants.py:42
+msgid "Wikisource"
+msgstr "Wikiźródła"
+
#: forms.py:27
msgid "Please supply an XML."
msgstr "Proszę podać XML."
#: forms.py:27
msgid "Please supply an XML."
msgstr "Proszę podać XML."
@@
-74,7
+78,7
@@
msgstr "Duży"
msgid "Queue is full. Please try again later."
msgstr "Kolejka jest pełna. Proszę spróbować ponownie później."
msgid "Queue is full. Please try again later."
msgstr "Kolejka jest pełna. Proszę spróbować ponownie później."
-#: views.py:5
97
+#: views.py:5
88
#, python-format
msgid ""
"An error occurred: %(exception)s\n"
#, python-format
msgid ""
"An error occurred: %(exception)s\n"
@@
-85,91
+89,95
@@
msgstr ""
"\n"
"%(tb)s"
"\n"
"%(tb)s"
-#: views.py:5
98
+#: views.py:5
89
msgid "Book imported successfully"
msgstr "Książka zaimportowana"
msgid "Book imported successfully"
msgstr "Książka zaimportowana"
-#: views.py:
600
+#: views.py:
591
#, python-format
msgid "Error importing file: %r"
msgstr "Błąd podczas importowania pliku: %r"
#, python-format
msgid "Error importing file: %r"
msgstr "Błąd podczas importowania pliku: %r"
-#: views.py:6
32
+#: views.py:6
23
msgid "Download custom PDF"
msgstr "Stwórz własny PDF"
msgid "Download custom PDF"
msgstr "Stwórz własny PDF"
-#: views.py:6
33 templates/catalogue/book_short.html:97
-#: templates/catalogue/book_wide.html:6
3
+#: views.py:6
24 templates/catalogue/book_short.html:103
+#: templates/catalogue/book_wide.html:6
4
msgid "Download"
msgstr "Pobierz"
msgid "Download"
msgstr "Pobierz"
-#: models/book.py:
28
models/collection.py:11
+#: models/book.py:
30
models/collection.py:11
msgid "title"
msgstr "tytuł"
msgid "title"
msgstr "tytuł"
-#: models/book.py:
29
models/tag.py:34
+#: models/book.py:
31
models/tag.py:34
msgid "sort key"
msgstr "klucz sortowania"
msgid "sort key"
msgstr "klucz sortowania"
-#: models/book.py:3
0
+#: models/book.py:3
2
#, fuzzy
msgid "sort key by author"
msgstr "Znalezieni autorzy"
#, fuzzy
msgid "sort key by author"
msgstr "Znalezieni autorzy"
-#: models/book.py:3
1 models/book.py:33
models/collection.py:12
+#: models/book.py:3
3 models/book.py:35
models/collection.py:12
#: models/collection.py:15 models/tag.py:33
msgid "slug"
msgstr "slug"
#: models/collection.py:15 models/tag.py:33
msgid "slug"
msgstr "slug"
-#: models/book.py:3
4
+#: models/book.py:3
6
msgid "language code"
msgstr "Kod języka"
msgid "language code"
msgstr "Kod języka"
-#: models/book.py:3
6 models/book.py:164
models/collection.py:13
+#: models/book.py:3
8 models/book.py:170
models/collection.py:13
#: models/tag.py:37 models/tag.py:94
msgid "description"
msgstr "opis"
#: models/tag.py:37 models/tag.py:94
msgid "description"
msgstr "opis"
-#: models/book.py:3
7 models/book.py:38 models/bookmedia.py:29
models/tag.py:46
+#: models/book.py:3
9 models/book.py:40 models/bookmedia.py:31
models/tag.py:46
#: models/tag.py:47
msgid "creation date"
msgstr "data utworzenia"
#: models/tag.py:47
msgid "creation date"
msgstr "data utworzenia"
-#: models/book.py:
39
+#: models/book.py:
41
msgid "parent number"
msgstr "numer rodzica"
msgid "parent number"
msgstr "numer rodzica"
-#: models/book.py:4
0 models/bookmedia.py:30
+#: models/book.py:4
2 models/bookmedia.py:32
msgid "extra information"
msgstr "dodatkowe informacje"
msgid "extra information"
msgstr "dodatkowe informacje"
-#: models/book.py:4
5
+#: models/book.py:4
7
msgid "cover"
msgstr "okładka"
msgid "cover"
msgstr "okładka"
-#: models/book.py:
48
+#: models/book.py:
52
msgid "cover thumbnail"
msgstr "podgląd okładki"
msgid "cover thumbnail"
msgstr "podgląd okładki"
-#: models/book.py:7
0
models/collection.py:18 models/tag.py:22
+#: models/book.py:7
6
models/collection.py:18 models/tag.py:22
msgid "book"
msgstr "książka"
msgid "book"
msgstr "książka"
-#: models/book.py:7
1
+#: models/book.py:7
7
msgid "books"
msgstr "książki"
msgid "books"
msgstr "książki"
-#: models/book.py:26
2
+#: models/book.py:26
8
#, python-format
msgid "Book \"%s\" does not exist."
msgstr "Utwór \"%s\" nie istnieje."
#, python-format
msgid "Book \"%s\" does not exist."
msgstr "Utwór \"%s\" nie istnieje."
-#: models/book.py:2
76
+#: models/book.py:2
82
#, python-format
msgid "Book %s already exists"
msgstr "Książka %s już istnieje"
#, python-format
msgid "Book %s already exists"
msgstr "Książka %s już istnieje"
-#: models/book.py:625 models/bookmedia.py:23
+#: models/book.py:618
+msgid "This work needs modernisation"
+msgstr "Ten utwór wymaga uwspółcześnienia"
+
+#: models/book.py:637 models/bookmedia.py:23
#, python-format
msgid "%s file"
msgstr "plik %s"
#, python-format
msgid "%s file"
msgstr "plik %s"
@@
-186,7
+194,7
@@
msgstr "nazwa"
msgid "file"
msgstr "plik"
msgid "file"
msgstr "plik"
-#: models/bookmedia.py:
39 models/bookmedia.py:40
+#: models/bookmedia.py:
41 models/bookmedia.py:42
msgid "book media"
msgstr "media książki"
msgid "book media"
msgstr "media książki"
@@
-371,31
+379,31
@@
msgstr "Gatunek"
msgid "Language"
msgstr "Język"
msgid "Language"
msgstr "Język"
-#: templates/catalogue/book_short.html:9
3
+#: templates/catalogue/book_short.html:9
9
msgid "Read online"
msgstr "Czytaj online"
msgid "Read online"
msgstr "Czytaj online"
-#: templates/catalogue/book_short.html:10
0
+#: templates/catalogue/book_short.html:10
6
msgid "to print"
msgstr "do druku"
msgid "to print"
msgstr "do druku"
-#: templates/catalogue/book_short.html:10
3
+#: templates/catalogue/book_short.html:10
9
msgid "for an e-book reader"
msgstr "na czytnik e-booków"
msgid "for an e-book reader"
msgstr "na czytnik e-booków"
-#: templates/catalogue/book_short.html:1
06
+#: templates/catalogue/book_short.html:1
12
msgid "for Kindle"
msgstr "na Kindle"
msgid "for Kindle"
msgstr "na Kindle"
-#: templates/catalogue/book_short.html:1
09
+#: templates/catalogue/book_short.html:1
15
msgid "FictionBook"
msgstr "FictionBook"
msgid "FictionBook"
msgstr "FictionBook"
-#: templates/catalogue/book_short.html:11
2
+#: templates/catalogue/book_short.html:11
8
msgid "for advanced usage"
msgstr "do zadań specjalnych"
msgid "for advanced usage"
msgstr "do zadań specjalnych"
-#: templates/catalogue/book_short.html:1
18
+#: templates/catalogue/book_short.html:1
24
msgid "Listen"
msgstr "Słuchaj"
msgid "Listen"
msgstr "Słuchaj"
@@
-465,31
+473,35
@@
msgstr "Źródło"
msgid "of the book"
msgstr "utworu"
msgid "of the book"
msgstr "utworu"
-#: templates/catalogue/book_wide.html:49
+#: templates/catalogue/book_wide.html:48
+msgid "in"
+msgstr "w serwisie"
+
+#: templates/catalogue/book_wide.html:50
msgid "Source XML file"
msgstr "Źródłowy plik XML"
msgid "Source XML file"
msgstr "Źródłowy plik XML"
-#: templates/catalogue/book_wide.html:5
1
+#: templates/catalogue/book_wide.html:5
2
msgid "Book on"
msgstr "Utwór na"
msgid "Book on"
msgstr "Utwór na"
-#: templates/catalogue/book_wide.html:5
1
+#: templates/catalogue/book_wide.html:5
2
msgid "Editor's Platform"
msgstr "Platformie Redakcyjnej"
msgid "Editor's Platform"
msgstr "Platformie Redakcyjnej"
-#: templates/catalogue/book_wide.html:5
4
+#: templates/catalogue/book_wide.html:5
5
msgid "Book description on Lektury.Gazeta.pl"
msgstr "Opis lektury w Lektury.Gazeta.pl"
msgid "Book description on Lektury.Gazeta.pl"
msgstr "Opis lektury w Lektury.Gazeta.pl"
-#: templates/catalogue/book_wide.html:5
7
+#: templates/catalogue/book_wide.html:5
8
msgid "Book description on Wikipedia"
msgstr "Opis lektury w Wikipedii"
msgid "Book description on Wikipedia"
msgstr "Opis lektury w Wikipedii"
-#: templates/catalogue/book_wide.html:
59
+#: templates/catalogue/book_wide.html:
60
msgid "Mix this book"
msgstr "Miksuj treść utworu"
msgid "Mix this book"
msgstr "Miksuj treść utworu"
-#: templates/catalogue/book_wide.html:6
7
+#: templates/catalogue/book_wide.html:6
8
msgid "Download all audiobooks for this book"
msgstr "Pobierz wszystkie audiobooki tego utworu"
msgid "Download all audiobooks for this book"
msgstr "Pobierz wszystkie audiobooki tego utworu"
diff --git
a/apps/catalogue/models/book.py
b/apps/catalogue/models/book.py
index
414d1ef
..
27240fb
100644
(file)
--- a/
apps/catalogue/models/book.py
+++ b/
apps/catalogue/models/book.py
@@
-8,6
+8,7
@@
from django.core.cache import get_cache
from django.db import models
from django.db.models import permalink
import django.dispatch
from django.db import models
from django.db.models import permalink
import django.dispatch
+from django.core.urlresolvers import reverse
from django.utils.datastructures import SortedDict
from django.utils.translation import ugettext_lazy as _
import jsonfield
from django.utils.datastructures import SortedDict
from django.utils.translation import ugettext_lazy as _
import jsonfield
@@
-612,6
+613,14
@@
class Book(models.Model):
audiences = sorted(set([self._audiences_pl.get(a, (99, a)) for a in audiences]))
return [a[1] for a in audiences]
audiences = sorted(set([self._audiences_pl.get(a, (99, a)) for a in audiences]))
return [a[1] for a in audiences]
+ def stage_note(self):
+ stage = self.extra_info.get('stage')
+ if stage and stage < '0.4':
+ return (_('This work needs modernisation'),
+ reverse('infopage', args=['wymagajace-uwspolczesnienia']))
+ else:
+ return None, None
+
def choose_fragment(self):
tag = self.book_tag()
fragments = Fragment.tagged.with_any([tag])
def choose_fragment(self):
tag = self.book_tag()
fragments = Fragment.tagged.with_any([tag])
diff --git
a/apps/catalogue/templates/catalogue/book_short.html
b/apps/catalogue/templates/catalogue/book_short.html
index
3a0d37a
..
9c90bdd
100644
(file)
--- a/
apps/catalogue/templates/catalogue/book_short.html
+++ b/
apps/catalogue/templates/catalogue/book_short.html
@@
-82,6
+82,12
@@
</span></span>
{% endif %}
</span></span>
{% endif %}
+ {% if stage_note %}
+ <br><span class="category">
+ <a{% if stage_note_url %} href="{{ stage_note_url }}"{% endif %}>{{ stage_note }}</a>
+ </span>
+ {% endif %}
+
{% endspaceless %}
</div>
</div>
{% endspaceless %}
</div>
</div>
diff --git
a/apps/catalogue/templates/catalogue/book_wide.html
b/apps/catalogue/templates/catalogue/book_wide.html
index
13df555
..
5ce66a3
100644
(file)
--- a/
apps/catalogue/templates/catalogue/book_wide.html
+++ b/
apps/catalogue/templates/catalogue/book_wide.html
@@
-1,6
+1,6
@@
{% extends "catalogue/book_short.html" %}
{% load i18n %}
{% extends "catalogue/book_short.html" %}
{% load i18n %}
-{% load download_audio tag_list custom_pdf_link_li license_icon from catalogue_tags %}
+{% load download_audio tag_list custom_pdf_link_li license_icon
source_name
from catalogue_tags %}
{% load cite_promo from social_tags %}
{% load cite_promo from social_tags %}
@@
-44,7
+44,8
@@
<h2 class="mono">{% trans "See" %}</h2>
<ul class="plain">
{% if extra_info.source_url %}
<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" %}</li>
+ <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 %}
{% endif %}
<li><a href="{{ book.xml_file.url }}">{% trans "Source XML file" %}</a></li>
{% if extra_info.about and not hide_about %}
diff --git
a/apps/catalogue/templatetags/catalogue_tags.py
b/apps/catalogue/templatetags/catalogue_tags.py
index
bbd9f07
..
5555711
100644
(file)
--- a/
apps/catalogue/templatetags/catalogue_tags.py
+++ b/
apps/catalogue/templatetags/catalogue_tags.py
@@
-5,6
+5,7
@@
import datetime
import feedparser
from random import randint
import datetime
import feedparser
from random import randint
+from urlparse import urlparse
from django.conf import settings
from django import template
from django.conf import settings
from django import template
@@
-16,7
+17,7
@@
from django.utils.translation import ugettext as _
from catalogue.utils import related_tag_name as _related_tag_name
from catalogue.models import Book, BookMedia, Fragment, Tag
from catalogue.utils import related_tag_name as _related_tag_name
from catalogue.models import Book, BookMedia, Fragment, Tag
-from catalogue.constants import LICENSES
+from catalogue.constants import LICENSES
, SOURCE_NAMES
register = template.Library()
register = template.Library()
@@
-326,6
+327,7
@@
def book_wide(context, book):
book_themes = book.related_themes()
extra_info = book.extra_info
hide_about = extra_info.get('about', '').startswith('http://wiki.wolnepodreczniki.pl')
book_themes = book.related_themes()
extra_info = book.extra_info
hide_about = extra_info.get('about', '').startswith('http://wiki.wolnepodreczniki.pl')
+ stage_note, stage_note_url = book.stage_note()
return {
'book': book,
return {
'book': book,
@@
-336,17
+338,23
@@
def book_wide(context, book):
'themes': book_themes,
'request': context.get('request'),
'show_lang': book.language_code() != settings.LANGUAGE_CODE,
'themes': book_themes,
'request': context.get('request'),
'show_lang': book.language_code() != settings.LANGUAGE_CODE,
+ 'stage_note': stage_note,
+ 'stage_note_url': stage_note_url,
}
@register.inclusion_tag('catalogue/book_short.html', takes_context=True)
def book_short(context, book):
}
@register.inclusion_tag('catalogue/book_short.html', takes_context=True)
def book_short(context, book):
+ stage_note, stage_note_url = book.stage_note()
+
return {
'book': book,
'main_link': book.get_absolute_url(),
'related': book.related_info(),
'request': context.get('request'),
'show_lang': book.language_code() != settings.LANGUAGE_CODE,
return {
'book': book,
'main_link': book.get_absolute_url(),
'related': book.related_info(),
'request': context.get('request'),
'show_lang': book.language_code() != settings.LANGUAGE_CODE,
+ 'stage_note': stage_note,
+ 'stage_note_url': stage_note_url,
}
}
@@
-473,3
+481,8
@@
def related_tag_name(tag, lang=None):
def class_name(obj):
return obj.__class__.__name__
def class_name(obj):
return obj.__class__.__name__
+
+@register.simple_tag
+def source_name(url):
+ netloc = urlparse(url).netloc
+ return SOURCE_NAMES.get(netloc, netloc)
diff --git
a/lib/librarian
b/lib/librarian
index
13b88a3
..
2a4236f
160000
(submodule)
--- a/
lib/librarian
+++ b/
lib/librarian
@@
-1
+1
@@
-Subproject commit
13b88a3bfdd4fa3cf5c92368aa5cb60fa832eda6
+Subproject commit
2a4236f2ddbe95d07ba7fcbe750451340c38c2b9