fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
83559fb
)
Changed sets to shelfs.
author
Marek Stępniowski
<marek@stepniowski.com>
Fri, 5 Sep 2008 08:54:06 +0000
(10:54 +0200)
committer
Marek Stępniowski
<marek@stepniowski.com>
Fri, 5 Sep 2008 08:54:06 +0000
(10:54 +0200)
catalogue/forms.py
patch
|
blob
|
history
catalogue/urls.py
patch
|
blob
|
history
catalogue/views.py
patch
|
blob
|
history
templates/base.html
patch
|
blob
|
history
templates/catalogue/book_sets.html
patch
|
blob
|
history
templates/catalogue/book_short.html
patch
|
blob
|
history
templates/catalogue/main_page.html
patch
|
blob
|
history
templates/catalogue/tagged_object_list.html
patch
|
blob
|
history
diff --git
a/catalogue/forms.py
b/catalogue/forms.py
index
1c6ca83
..
583c9ae
100644
(file)
--- a/
catalogue/forms.py
+++ b/
catalogue/forms.py
@@
-29,7
+29,7
@@
class BookSetsForm(forms.Form):
def __init__(self, book, user, *args, **kwargs):
super(BookSetsForm, self).__init__(*args, **kwargs)
self.fields['set_ids'] = forms.MultipleChoiceField(
def __init__(self, book, user, *args, **kwargs):
super(BookSetsForm, self).__init__(*args, **kwargs)
self.fields['set_ids'] = forms.MultipleChoiceField(
- label=u'
Zestawy
',
+ label=u'
Półki
',
required=False,
choices=[(tag.id, tag.name) for tag in Tag.objects.filter(category='set', user=user)],
initial=[tag.id for tag in book.tags.filter(category='set', user=user)],
required=False,
choices=[(tag.id, tag.name) for tag in Tag.objects.filter(category='set', user=user)],
initial=[tag.id for tag in book.tags.filter(category='set', user=user)],
diff --git
a/catalogue/urls.py
b/catalogue/urls.py
index
2fc2939
..
c253ba1
100644
(file)
--- a/
catalogue/urls.py
+++ b/
catalogue/urls.py
@@
-5,8
+5,8
@@
from django.conf.urls.defaults import *
urlpatterns = patterns('catalogue.views',
url(r'^$', 'main_page', name='main_page'),
url(r'^lektury/', 'book_list'),
urlpatterns = patterns('catalogue.views',
url(r'^$', 'main_page', name='main_page'),
url(r'^lektury/', 'book_list'),
- url(r'^lektura/(?P<slug>[a-zA-Z0-9-]+)/
zestawy
/', 'book_sets'),
- url(r'^
zestawy/nowy
/$', 'new_set'),
+ url(r'^lektura/(?P<slug>[a-zA-Z0-9-]+)/
polki
/', 'book_sets'),
+ url(r'^
polki/nowa
/$', 'new_set'),
url(r'^lektura/(?P<slug>[a-zA-Z0-9-]+)/$', 'book_detail'),
url(r'^tags/$', 'tags_starting_with', name='hint'),
url(r'^szukaj/$', 'search', name='search'),
url(r'^lektura/(?P<slug>[a-zA-Z0-9-]+)/$', 'book_detail'),
url(r'^tags/$', 'tags_starting_with', name='hint'),
url(r'^szukaj/$', 'search', name='search'),
diff --git
a/catalogue/views.py
b/catalogue/views.py
index
8feb63c
..
de41e15
100644
(file)
--- a/
catalogue/views.py
+++ b/
catalogue/views.py
@@
-165,19
+165,21
@@
def login(request):
return HttpResponse(LazyEncoder(ensure_ascii=False).encode(response_data))
return HttpResponse(LazyEncoder(ensure_ascii=False).encode(response_data))
-@login_required
def book_sets(request, slug):
book = get_object_or_404(models.Book, slug=slug)
user_sets = models.Tag.objects.filter(category='set', user=request.user)
book_sets = book.tags.filter(category='set', user=request.user)
def book_sets(request, slug):
book = get_object_or_404(models.Book, slug=slug)
user_sets = models.Tag.objects.filter(category='set', user=request.user)
book_sets = book.tags.filter(category='set', user=request.user)
+ if not request.user.is_authenticated():
+ return HttpResponse('<p>Aby zarządzać swoimi półkami, musisz się zalogować.</p>')
+
if request.method == 'POST':
form = forms.BookSetsForm(book, request.user, request.POST)
if form.is_valid():
book.tags = ([models.Tag.objects.get(pk=id) for id in form.cleaned_data['set_ids']] +
list(book.tags.filter(~Q(category='set') | ~Q(user=request.user))))
if request.is_ajax():
if request.method == 'POST':
form = forms.BookSetsForm(book, request.user, request.POST)
if form.is_valid():
book.tags = ([models.Tag.objects.get(pk=id) for id in form.cleaned_data['set_ids']] +
list(book.tags.filter(~Q(category='set') | ~Q(user=request.user))))
if request.is_ajax():
- return HttpResponse('<p>
Zestawy
zostały zapisane</p>')
+ return HttpResponse('<p>
Półki
zostały zapisane</p>')
else:
return HttpResponseRedirect('/')
else:
else:
return HttpResponseRedirect('/')
else:
diff --git
a/templates/base.html
b/templates/base.html
index
8accaee
..
aa0f01c
100644
(file)
--- a/
templates/base.html
+++ b/
templates/base.html
@@
-23,7
+23,7
@@
{% if user.is_authenticated %}
<p>
Zalogowany jako <strong>{{ user.username }}</strong>
{% if user.is_authenticated %}
<p>
Zalogowany jako <strong>{{ user.username }}</strong>
- | <a href="#" id="user-sets-link">
Zestawy
</a>
+ | <a href="#" id="user-sets-link">
Moje półki
</a>
{% if user.is_staff %}
| <a href="/admin/">Administracja</a>
{% endif %}
{% if user.is_staff %}
| <a href="/admin/">Administracja</a>
{% endif %}
diff --git
a/templates/catalogue/book_sets.html
b/templates/catalogue/book_sets.html
index
1ae34c3
..
c739418
100644
(file)
--- a/
templates/catalogue/book_sets.html
+++ b/
templates/catalogue/book_sets.html
@@
-1,17
+1,17
@@
-<h2>
Zestawy
zawierające utwór {{ book.title }}</h2>
+<h2>
Półki
zawierające utwór {{ book.title }}</h2>
{% if not user.tag_set.count %}
{% if not user.tag_set.count %}
- <p>Nie posiadasz żadnych
zestawów. Jeśli chcesz, możesz utworzyć nowy zestaw
poniżej.</p>
+ <p>Nie posiadasz żadnych
półek. Jeśli chcesz, możesz utworzyć nową półkę
poniżej.</p>
{% else %}
<form action="{% url catalogue.views.book_sets book.slug %}" method="POST" accept-charset="utf-8" class="cuteform">
<ol>
<li>{{ form.set_ids }}</li>
{% else %}
<form action="{% url catalogue.views.book_sets book.slug %}" method="POST" accept-charset="utf-8" class="cuteform">
<ol>
<li>{{ form.set_ids }}</li>
- <li><input type="submit" value="Zapisz
zestawy
"/></li>
+ <li><input type="submit" value="Zapisz
półki
"/></li>
</ol>
</form>
{% endif %}
<hr />
<form action="{% url catalogue.views.new_set %}" method="POST" accept-charset="utf-8" class="cuteform">
<ol>
</ol>
</form>
{% endif %}
<hr />
<form action="{% url catalogue.views.new_set %}" method="POST" accept-charset="utf-8" class="cuteform">
<ol>
- <li>{{ new_set_form.name }} <input type="submit" value="
Nowy zestaw
"/></li>
+ <li>{{ new_set_form.name }} <input type="submit" value="
Utwórz nową półkę
"/></li>
</ol>
</form>
\ No newline at end of file
</ol>
</form>
\ No newline at end of file
diff --git
a/templates/catalogue/book_short.html
b/templates/catalogue/book_short.html
index
eca279e
..
019a7b8
100644
(file)
--- a/
templates/catalogue/book_short.html
+++ b/
templates/catalogue/book_short.html
@@
-1,7
+1,7
@@
<div class="book">
{# {% if request.user.is_authenticated %} #}
<div class="change-sets">
<div class="book">
{# {% if request.user.is_authenticated %} #}
<div class="change-sets">
- <a href="{% url catalogue.views.book_sets book.slug %}" class="jqm-trigger">
Zestawy
</a>
+ <a href="{% url catalogue.views.book_sets book.slug %}" class="jqm-trigger">
Półki
</a>
</div>
{# {% endif %} #}
<div class="book-thumbnail"></div>
</div>
{# {% endif %} #}
<div class="book-thumbnail"></div>
diff --git
a/templates/catalogue/main_page.html
b/templates/catalogue/main_page.html
index
221595f
..
0c58ada
100644
(file)
--- a/
templates/catalogue/main_page.html
+++ b/
templates/catalogue/main_page.html
@@
-24,7
+24,7
@@
<div id="tags-list">
<div id="categories-list">
{% if categories.set %}
<div id="tags-list">
<div id="categories-list">
{% if categories.set %}
- <h2>
Zestawy
</h2>
+ <h2>
Półki
</h2>
<ul>
{% for set in categories.set %}
<li><a href="{% catalogue_url set %}">{{ set }} ({{ set.count }})</a></li>
<ul>
{% for set in categories.set %}
<li><a href="{% catalogue_url set %}">{{ set }} ({{ set.count }})</a></li>
diff --git
a/templates/catalogue/tagged_object_list.html
b/templates/catalogue/tagged_object_list.html
index
3aa9a36
..
de7d4f0
100644
(file)
--- a/
templates/catalogue/tagged_object_list.html
+++ b/
templates/catalogue/tagged_object_list.html
@@
-78,7
+78,7
@@
<div id="tags-list">
<div class="dontsplit">
{% if categories.set %}
<div id="tags-list">
<div class="dontsplit">
{% if categories.set %}
- <h2>
Zestawy
</h2>
+ <h2>
Półki
</h2>
<ul>
{% for set in categories.set %}
<li><a href="{% catalogue_url tags set %}">{{ set }} ({{ set.count }})</a></li>
<ul>
{% for set in categories.set %}
<li><a href="{% catalogue_url tags set %}">{{ set }} ({{ set.count }})</a></li>