Display shelf sharing only for own shelves.
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 19 May 2010 10:48:49 +0000 (12:48 +0200)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 19 May 2010 10:48:49 +0000 (12:48 +0200)
apps/catalogue/views.py
wolnelektury/templates/catalogue/tagged_object_list.html

index cf1461f..7cef726 100644 (file)
@@ -86,6 +86,7 @@ def tagged_object_list(request, tags=''):
     model = models.Book
     shelf = [tag for tag in tags if tag.category == 'set']
     shelf_is_set = (len(tags) == 1 and tags[0].category == 'set')
+    my_shelf_is_set = shelf_is_set and tags[0].user == request.user
     theme_is_set = len([tag for tag in tags if tag.category == 'theme']) > 0
     if theme_is_set:
         model = models.Fragment
@@ -110,6 +111,7 @@ def tagged_object_list(request, tags=''):
         extra_context = {
             'categories': categories,
             'shelf_is_set': shelf_is_set,
+            'my_shelf_is_set': my_shelf_is_set,
             'only_author': only_author,
             'pd_counter': pd_counter,
             'user_is_owner': user_is_owner,
index b105c70..f5b896c 100644 (file)
                     <div class="clearboth"></div>
                 </form>
             </div>
+            {% if my_shelf_is_set %}
             <div id="toggle-share-shelf"><p>{% trans "Share this shelf" %}</p></div>
             <div id="share-shelf">
                 <p>{% trans "Copy this link and share it with other people to let them see your shelf." %}
                 <input id="share-shelf-url" value='http://{{ request.META.HTTP_HOST }}{{ request.path }}' />
                 </p>
             </div>
+                       {% endif %}
         {% endif %}
         {% if last_tag.gazeta_link %}
         <p><a href="{{ last_tag.gazeta_link }}">