from django import template
from django.template import Node, Variable, Template, Context
+from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django.utils.translation import ugettext as _
def tag_list(tags, choices=None):
if choices is None:
choices = []
- if len(tags) == 1:
+ if len(tags) == 1 and tags[0].category not in [t.category for t in choices]:
one_tag = tags[0]
return locals()
+
@register.inclusion_tag('catalogue/inline_tag_list.html')
def inline_tag_list(tags, choices=None):
- if choices is None:
- choices = []
- if len(tags) == 1:
- one_tag = tags[0]
- return locals()
+ return tag_list(tags, choices)
@register.inclusion_tag('catalogue/book_info.html')
@register.inclusion_tag('catalogue/related_books.html')
-def related_books(book, limit=6):
- related = list(Book.objects.filter(
- common_slug=book.common_slug).exclude(pk=book.pk)[:limit])
- limit -= len(related)
- if limit:
- related += Book.tagged.related_to(book,
- Book.objects.exclude(common_slug=book.common_slug),
- ignore_by_tag=book.book_tag())[:limit]
+def related_books(book, limit=6, random=1):
+ cache_key = "catalogue.related_books.%d.%d" % (book.id, limit - random)
+ related = cache.get(cache_key)
+ if related is None:
+ print 'not in cache'
+ related = list(Book.objects.filter(
+ common_slug=book.common_slug).exclude(pk=book.pk)[:limit])
+ limit -= len(related)
+ if limit > random:
+ related += Book.tagged.related_to(book,
+ Book.objects.exclude(common_slug=book.common_slug),
+ ignore_by_tag=book.book_tag())[:limit-random]
+ cache.set(cache_key, related, 1800)
+ if random:
+ related += list(Book.objects.exclude(
+ pk__in=[b.pk for b in related] + [book.pk]
+ ).order_by('?')[:random])
return {
'books': related,
}
class SearchForm(forms.Form):
- q = JQueryAutoCompleteSearchField() # {'minChars': 2, 'selectFirst': True, 'cacheLength': 50, 'matchContains': "word"})
+ q = JQueryAutoCompleteSearchField(label=_('Search')) # {'minChars': 2, 'selectFirst': True, 'cacheLength': 50, 'matchContains': "word"})
def __init__(self, source, *args, **kwargs):
kwargs['auto_id'] = False
self.fields['q'].widget.attrs['autocomplete'] = 'off'
self.fields['q'].widget.attrs['data-source'] = source
if not 'q' in self.data:
- self.fields['q'].widget.attrs['title'] = _('title, author, theme/topic, epoch, kind, genre, phrase')
+ self.fields['q'].widget.attrs['placeholder'] = _('title, author, theme/topic, epoch, kind, genre, phrase')
class ObjectSetsForm(forms.Form):
- tags = forms.CharField(label=_('Tags (comma-separated)'), required=False)
+ tags = forms.CharField(label=_('Tags (comma-separated)'), required=False,
+ widget=forms.Textarea())
def __init__(self, obj, user, *args, **kwargs):
self._obj = obj
<input type="submit" value="{% trans "Remove from my shelf" %}"/>
</form>
-<form action="{{ request.get_full_path }}" method="post" accept-charset="utf-8" class="cuteform">
+<form action="{{ request.get_full_path }}" method="post" accept-charset="utf-8"
+ class="cuteform{% if placeholdize %} hidelabels{% endif %}">
<ol>
<div id="id___all__"></div>
{{ form.as_ul }}
-{% if tags %}
+{% if tags.exists %}
<ul class='social-shelf-tags'>
{% for tag in tags %}
<li><a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a></li>
msgstr ""
"Project-Id-Version: WolneLektury\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-01-27 15:26+0100\n"
-"PO-Revision-Date: 2012-01-27 16:30+0100\n"
+"POT-Creation-Date: 2012-01-30 12:37+0100\n"
+"PO-Revision-Date: 2012-01-30 12:39+0100\n"
"Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: pl\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:30
#: views.py:31
+#: views.py:32
#: templates/base.html:56
msgid "Sign in"
msgstr "Zaloguj się"
-#: views.py:46
#: views.py:47
-#: views.py:72
+#: views.py:48
+#: views.py:73
#: templates/base.html:60
msgid "Register"
msgstr "Załóż konto"
-#: views.py:67
+#: views.py:68
msgid "You have to be logged in to continue"
msgstr "Zaloguj się, aby kontynuować"
" "
msgstr[0] ""
"\n"
-" <a href='%(b)s'>%(c)s</a> darmowa lektura do której <a href='%(r)s'>masz prawo</a>\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 lektury do których <a href='%(r)s'>masz prawo</a>\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 lektur do których <a href='%(r)s'>masz prawo</a>\n"
+" <a href='%(b)s'>%(c)s</a> darmowych utworów do których <a href='%(r)s'>masz prawo</a>\n"
" "
#: templates/base.html:47
msgid "Logout"
msgstr "Wyloguj"
-#: templates/base.html:81
+#: templates/base.html:82
#: templates/catalogue/search_multiple_hits.html:5
#: templates/catalogue/search_no_hits.html:5
#: templates/catalogue/search_no_hits.html:10
msgid "Search"
msgstr "Szukaj"
-#: templates/base.html:104
+#: templates/base.html:105
msgid "Language versions"
msgstr "Wersje językowe"
-#: templates/base.html:134
+#: templates/base.html:135
msgid ""
"\n"
"\t\t\t\tWolne Lektury is a project lead by <a href=\"http://nowoczesnapolska.org.pl/\">Modern Poland Foundation</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/base.html:141
+#: templates/base.html:142
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"
"\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/base.html:157
+#: templates/base.html:158
msgid "Close"
msgstr "Zamknij"
-#: templates/base.html:159
+#: templates/base.html:160
msgid "Loading"
msgstr "Ładowanie"
msgstr "Zgłoś błąd lub sugestię"
#: templates/main_page.html:45
-msgid "Mobile app"
-msgstr "Aplikacja mobilna"
-
-#: templates/main_page.html:46
msgid "Widget"
msgstr "Widget"
-#: templates/main_page.html:47
+#: templates/main_page.html:46
msgid "Missing a book?"
msgstr "Nie znalazłeś/-aś utworu?"
-#: templates/main_page.html:48
+#: templates/main_page.html:47
#: templates/publish_plan.html:4
#: templates/publish_plan.html.py:8
msgid "Publishing plan"
msgstr "Plan publikacji"
-#: templates/main_page.html:74
+#: templates/main_page.html:73
msgid "Image used:"
msgstr "Użyto obrazu:"
"Audiobooki nagrywają znani aktorzy, wśród nich Danuta Stenka i Jan Peszek."
#: templates/catalogue/book_detail.html:18
-#: templates/catalogue/tagged_object_list.html:80
+#: templates/catalogue/tagged_object_list.html:72
+#: templates/catalogue/tagged_object_list.html:102
msgid "See also"
msgstr "Zobacz też"
#: templates/catalogue/book_fragments.html:5
-#: templates/catalogue/book_fragments.html:10
+#: templates/catalogue/book_fragments.html:11
msgid "Theme"
msgstr "Motyw"
#: templates/catalogue/book_fragments.html:5
-#: templates/catalogue/book_fragments.html:10
+#: templates/catalogue/book_fragments.html:13
msgid "in work "
msgstr "w utworze"
-#: templates/catalogue/book_fragments.html:23
-msgid "See description"
-msgstr "Zobacz opis"
-
-#: templates/catalogue/book_fragments.html:23
-msgid "of the book "
-msgstr "utworu"
-
#: templates/catalogue/book_info.html:6
msgid "This work is licensed under:"
msgstr "Utwór jest udostępniony na licencji:"
msgid "Put on the shelf!"
msgstr "Wrzuć na półkę"
-#: templates/catalogue/book_short.html:49
+#: templates/catalogue/book_short.html:51
#: templates/catalogue/picture_detail.html:54
#: templates/picture/picture_short.html:22
msgid "Epoch"
msgstr "Epoka"
-#: templates/catalogue/book_short.html:56
+#: templates/catalogue/book_short.html:58
#: templates/catalogue/picture_detail.html:60
#: templates/picture/picture_short.html:29
msgid "Kind"
msgstr "Rodzaj"
-#: templates/catalogue/book_short.html:63
+#: templates/catalogue/book_short.html:65
msgid "Genre"
msgstr "Gatunek"
-#: templates/catalogue/book_short.html:77
+#: templates/catalogue/book_short.html:80
msgid "Read online"
msgstr "Czytaj online"
-#: templates/catalogue/book_short.html:81
+#: templates/catalogue/book_short.html:84
#: templates/catalogue/book_wide.html:53
#: templates/lessons/ajax_document_detail.html:3
msgid "Download"
msgstr "Pobierz"
-#: templates/catalogue/book_short.html:99
+#: templates/catalogue/book_short.html:102
msgid "Listen"
msgstr "Słuchaj"
#: templates/catalogue/book_wide.html:63
msgid "Download a custom PDF"
-msgstr "Pobierz własny plik PDF"
+msgstr "Stwórz własny plik PDF"
#: templates/catalogue/catalogue.html:6
#: templates/catalogue/catalogue.html:11
msgid "Save all shelves"
msgstr "Zapisz półki"
-#: templates/catalogue/fragment_short.html:11
+#: templates/catalogue/fragment_short.html:12
msgid "Expand fragment"
msgstr "Rozwiń fragment"
-#: templates/catalogue/fragment_short.html:21
+#: templates/catalogue/fragment_short.html:22
msgid "Hide fragment"
msgstr "Zwiń fragment"
msgid "Did you mean"
msgstr "Czy chodziło Ci o"
-#: templates/catalogue/search_multiple_hits.html:19
+#: templates/catalogue/search_multiple_hits.html:18
msgid "Results by authors"
msgstr "Znalezieni autorzy"
-#: templates/catalogue/search_multiple_hits.html:36
+#: templates/catalogue/search_multiple_hits.html:35
msgid "Results by title"
msgstr "Znalezione w tytułach"
-#: templates/catalogue/search_multiple_hits.html:53
+#: templates/catalogue/search_multiple_hits.html:52
msgid "Results in text"
msgstr "Znalezione w treści"
-#: templates/catalogue/search_multiple_hits.html:70
+#: templates/catalogue/search_multiple_hits.html:69
msgid "Other results"
msgstr "Inne wyniki"
#: templates/catalogue/search_no_hits.html:19
-#: templates/catalogue/tagged_object_list.html:122
+#: templates/catalogue/tagged_object_list.html:144
msgid "Sorry! Search cirteria did not match any resources."
msgstr "Przepraszamy! Brak wyników spełniających kryteria podane w zapytaniu."
msgid "Sorry! Search query must have at least two characters."
msgstr "Przepraszamy! Zapytanie musi zawierać co najmniej dwa znaki."
-#: templates/catalogue/tagged_object_list.html:84
+#: templates/catalogue/tagged_object_list.html:76
+#: templates/catalogue/tagged_object_list.html:106
msgid "in Lektury.Gazeta.pl"
msgstr "w serwisie Lektury.Gazeta.pl"
-#: templates/catalogue/tagged_object_list.html:89
+#: templates/catalogue/tagged_object_list.html:81
+#: templates/catalogue/tagged_object_list.html:111
msgid "in Wikipedia"
msgstr "w Wikipedii"
msgid "Login"
msgstr "Zaloguj się"
+#~ msgid "Mobile app"
+#~ msgstr "Aplikacja mobilna"
+
+#~ msgid "See description"
+#~ msgstr "Zobacz opis"
+
+#~ msgid "of the book "
+#~ msgstr "utworu"
+
#~ msgid ""
#~ "Internet Explorer cannot display this site properly. Click here to read "
#~ "more..."
'js/pdcounter.js',
'js/search.js',
-
- 'js/jquery.labelify.js',
),
'output_filename': 'js/base?.min.js',
},
}
-.see-also {
- margin-left: 8em;
- float: left;
- width: 14.3em;
-}
-.download {
- margin-left: 2em;
- float: left;
-}
-
-.see-also, .download {
- margin-top: 2em;
- margin-bottom: 2em;
-}
-.see-also h2, .download h2 {
- font-size: 1.1em;
-}
-.see-also ul, .download ul {
- list-style: none;
- padding: 0;
- margin: 0;
- font-size: 1.1em;
-}
-
.pagination {
display: block;
font-size: 1.2em;
#description {
margin-bottom: 2em;
+ cursor: pointer;
}
#description dl {
margin-top: 0;
display: inline;
margin: 0;
}
+#description p {
+ margin-top: 0;
+}
#description .meta {
list-style: none;
padding: 0;
display: inline;
margin-right: 1em;
}
+
+
+.see-also {
+ margin-left: 8em;
+ float: left;
+ width: 14.3em;
+}
+.download {
+ margin-left: 2em;
+ float: left;
+}
+
+.see-also, .download {
+ margin-top: 2em;
+ margin-bottom: 2em;
+}
+.see-also h2, .download h2 {
+ font-size: 1.1em;
+}
+.see-also ul, .download ul {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ font-size: 1.1em;
+}
+
+.left-column .see-also {
+ margin-left: 0;
+}
}
.Fragment-item {
margin-bottom: 2em;
+ /* white-box */
+ border: 1px solid #ddd;
+ background: #fff;
+ -moz-box-shadow: 2px 2px 2px #ddd;
+ -webkit-box-shadow: 2px 2px 2px #ddd;
+ box-shadow: 2px 2px 2px #ddd;
}
}
.hidelabels label {
+ display: block;
width: 1px;
height: 1px;
overflow:hidden;
width: 63.1em;
padding-left: .5em;
padding-right: 0;
- padding-top: 0.6em;
+ padding-top: 0.5em;
padding-bottom: 0;
}
background-color: #fff;
color: #000;
}
-#search.blur {
+
+#search:-webkit-input-placeholder
+{
+ font-family: Georgia;
+ font-style: italic;
+ color: #888;
+}
+
+#search:-moz-placeholder
+{
font-family: Georgia;
font-style: italic;
color: #888;
background: #f7f7f7;
}
+#lang-menu-items {
+ z-index: 9999;
+}
+
#lang-menu-items button {
display: none;
background: #f7f7f7;
+++ /dev/null
-/**
- * jQuery.labelify - Display in-textbox hints
- * Stuart Langridge, http://www.kryogenix.org/
- * Released into the public domain
- * Date: 25th June 2008
- * @author Stuart Langridge
- * @version 1.3
- *
- *
- * Basic calling syntax: $("input").labelify();
- * Defaults to taking the in-field label from the field's title attribute
- *
- * You can also pass an options object with the following keys:
- * text
- * "title" to get the in-field label from the field's title attribute
- * (this is the default)
- * "label" to get the in-field label from the inner text of the field's label
- * (note that the label must be attached to the field with for="fieldid")
- * a function which takes one parameter, the input field, and returns
- * whatever text it likes
- *
- * labelledClass
- * a class that will be applied to the input field when it contains the
- * label and removed when it contains user input. Defaults to blank.
- *
- */
-jQuery.fn.labelify = function(settings) {
- settings = jQuery.extend({
- text: "title",
- labelledClass: ""
- }, settings);
- var lookups = {
- title: function(input) {
- return $(input).attr("title");
- },
- label: function(input) {
- return $("label[for=" + input.id +"]").text();
- }
- };
- var lookup;
- var jQuery_labellified_elements = $(this);
- return $(this).each(function() {
- if (typeof settings.text === "string") {
- lookup = lookups[settings.text]; // what if not there?
- } else {
- lookup = settings.text; // what if not a fn?
- };
- // bail if lookup isn't a function or if it returns undefined
- if (typeof lookup !== "function") { return; }
- var lookupval = lookup(this);
- if (!lookupval) { return; }
-
- // need to strip newlines because the browser strips them
- // if you set textbox.value to a string containing them
- $(this).data("label",lookup(this).replace(/\n/g,''));
- $(this).focus(function() {
- if (this.value === $(this).data("label")) {
- this.value = this.defaultValue;
- $(this).removeClass(settings.labelledClass);
- }
- }).blur(function(){
- if (this.value === this.defaultValue) {
- this.value = $(this).data("label");
- $(this).addClass(settings.labelledClass);
- }
- });
-
- var removeValuesOnExit = function() {
- jQuery_labellified_elements.each(function(){
- if (this.value === $(this).data("label")) {
- this.value = this.defaultValue;
- $(this).removeClass(settings.labelledClass);
- }
- })
- };
-
- $(this).parents("form").submit(removeValuesOnExit);
- $(window).unload(removeValuesOnExit);
-
- if (this.value !== this.defaultValue) {
- // user already started typing; don't overwrite their work!
- return;
- }
- // actually set the value
- this.value = $(this).data("label");
- $(this).addClass(settings.labelledClass);
-
- });
-};
\ No newline at end of file
});
- $(function() {
- $("#search").search().labelify({labelledClass: "blur"});
-
$(".search-result .see-more-snippets").click(function() {
$(this).closest('.search-result').find('.snippets').removeClass('ui-helper-hidden');
});
- <form id="search-area" action="/fullsearch/">
+ <form id="search-area" action="/fullsearch/" class="hidelabels">
<div id="search-field" class="grid-line">
+ <label for="search">{{search_form.q.label}}</label>
{{search_form.q}}
<!-- <input title="np. Leśmian" name="q" autocomplete="off" data-source="/fullsearch/hint/">-->
</div><div id="search-button">
<h2 class="main-last"><span class="mono">{% trans "See also" %}:</span></h2>
-{% cache 1800 book-detail-related book.slug %}
- {% related_books book %}
-{% endcache %}
+{% related_books book %}
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
-{% load catalogue_tags pagination_tags %}
+{% load work_list from catalogue_tags %}
{% block titleextra %}{% trans "Theme" %} {{ theme }} {% trans "in work " %} {{ book }}{% endblock %}
{% block bodyid %}tagged-object-list{% endblock %}
{% block body %}
- <h1>{% trans "Theme" %} {{ theme }} {% trans "in work " %} {{ book }} </h1>
-
- {% autopaginate fragments 10 %}
- <div id="books-list">
- <ol>
- {% for fragment in fragments %}
- <li>{{ fragment.short_html }}</li>
- {% endfor %}
- </ol>
- {% paginate %}
+ <div class="left-column">
+ <h1>{% trans "Theme" %}
+ <a href="{{ theme.get_absolute_url }}">{{ theme }}</a>
+ <br/>{% trans "in work " %}
+ <a href="{{ book.get_absolute_url }}">{{ book }}</a></h1>
</div>
- <div id="tags-list">
- <div id="categories-list">
- {% trans "See description" %} <a href="{{ book.get_absolute_url }}">{% trans "of the book "%} {{ book }}</a>
- </div>
- <div id="themes-list">
- </div>
- <div class="clearboth"></div>
+
+ <div class="right-column">
+ {% work_list fragments %}
</div>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
{% load i18n %}
+{% load book_title_html from catalogue_tags %}
<div class="cite {% if fragment.short_text %}fragment-with-short{% endif %}">
{% if fragment.short_text %}
<a href="#" class="toggle mono">↑ {% trans "Hide fragment" %} ↑</a>
{% endif %}
</div>
-<p class="mono source">{{ fragment.book.pretty_title }}</p>
+<p class="mono source">{% book_title_html fragment.book %}</p>
</div>
-
-
-
-
-
-{% comment %}
-{% load catalogue_tags %}
-<div class="fragment">
- {% if fragment.short_text %}
- <div class='fragment-short-text'>
- {{ fragment.short_text|safe }}
- <a href="#">↓ {% trans "Expand fragment" %} ↓</a>
- </div>
- {% endif %}
- <div class="fragment-text" {% if fragment.short_text %}style="display:none;"{% endif %}>
- {{ fragment.text|safe }}
- {% if fragment.short_text %}
- <a href="#">↑ {% trans "Hide fragment" %} ↑</a>
- {% endif %}
- </div>
- <div class="fragment-metadata">
- <p>{% book_title_html fragment.book %}
- <a href="{{ fragment.get_absolute_url }}">({% trans "See in a book" %})</a></p>
- </div>
- <div class="clearboth"></div>
-</div>
-{% endcomment %}
{% with tags|last as last_tag %}
{% if last_tag.has_description %}
<div id="description" class="normal-text">
- <div id='description-long' style="diplay:none">{{ last_tag.description|safe }}</div>
+ <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>
{% endif %}
</div>
{% endif %}
+
+ {% 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.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 %}
+ </ul>
+ {% endif %}
+ </div>
+ {% endif %}
+
+
</div>
</div>