From 77effa3964014b07dbdf73a9e67eb0b20749d50b Mon Sep 17 00:00:00 2001
From: =?utf8?q?Marek=20St=C4=99pniowski?= <marek@stepniowski.com>
Date: Fri, 5 Sep 2008 10:54:06 +0200
Subject: [PATCH 1/1] Changed sets to shelfs.

---
 catalogue/forms.py                          | 2 +-
 catalogue/urls.py                           | 4 ++--
 catalogue/views.py                          | 6 ++++--
 templates/base.html                         | 2 +-
 templates/catalogue/book_sets.html          | 8 ++++----
 templates/catalogue/book_short.html         | 2 +-
 templates/catalogue/main_page.html          | 2 +-
 templates/catalogue/tagged_object_list.html | 2 +-
 8 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/catalogue/forms.py b/catalogue/forms.py
index 1c6ca83cd..583c9aed7 100644
--- 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(
-            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)],
diff --git a/catalogue/urls.py b/catalogue/urls.py
index 2fc293912..c253ba1b0 100644
--- 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'),
-    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'),
diff --git a/catalogue/views.py b/catalogue/views.py
index 8feb63c22..de41e1518 100644
--- a/catalogue/views.py
+++ b/catalogue/views.py
@@ -165,19 +165,21 @@ def login(request):
     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)
     
+    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():
-                return HttpResponse('<p>Zestawy zostały zapisane</p>')
+                return HttpResponse('<p>Półki zostały zapisane</p>')
             else:
                 return HttpResponseRedirect('/')
     else:
diff --git a/templates/base.html b/templates/base.html
index 8accaee6a..aa0f01c9c 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -23,7 +23,7 @@
                 {% 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 %}
diff --git a/templates/catalogue/book_sets.html b/templates/catalogue/book_sets.html
index 1ae34c3cd..c7394186a 100644
--- 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 %}
-    <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>
-        <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>
-    <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
diff --git a/templates/catalogue/book_short.html b/templates/catalogue/book_short.html
index eca279e20..019a7b8a6 100644
--- 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">
-        <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>
diff --git a/templates/catalogue/main_page.html b/templates/catalogue/main_page.html
index 221595fbf..0c58adac9 100644
--- 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 %}
-                <h2>Zestawy</h2>
+                <h2>Półki</h2>
                 <ul>
                 {% for set in categories.set %}
                     <li><a href="{% catalogue_url set %}">{{ set }}&nbsp;({{ set.count }})</a></li>
diff --git a/templates/catalogue/tagged_object_list.html b/templates/catalogue/tagged_object_list.html
index 3aa9a36b4..de7d4f095 100644
--- 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 %}
-                <h2>Zestawy</h2>
+                <h2>Półki</h2>
                 <ul>
                 {% for set in categories.set %}
                     <li><a href="{% catalogue_url tags set %}">{{ set }}&nbsp;({{ set.count }})</a></li>
-- 
2.20.1