changeset 263:307a74e28112

Fixing #113; re-arrange the RSS forum feed icons around a bit.
author Brian Neal <bgneal@gmail.com>
date Thu, 23 Sep 2010 00:26:07 +0000
parents 5232d5808057
children 91c0902de04d
files gpp/forums/views/main.py gpp/templates/forums/forum_index.html gpp/templates/forums/index.html
diffstat 3 files changed, 25 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/gpp/forums/views/main.py	Wed Sep 22 23:54:49 2010 +0000
+++ b/gpp/forums/views/main.py	Thu Sep 23 00:26:07 2010 +0000
@@ -38,6 +38,8 @@
 
 TOPICS_PER_PAGE = 50
 POSTS_PER_PAGE = 20
+FEED_BASE = '/feeds/forums/'
+FORUM_FEED = FEED_BASE + '%s/'
 
 
 def get_page_num(request):
@@ -92,7 +94,7 @@
         return redirect(SPECIAL_QUERIES[query])
 
     public_forums = Forum.objects.public_forums()
-    feeds = [{'name': 'All Forums', 'feed': '/feeds/forums/'}]
+    feeds = [{'name': 'All Forums', 'feed': FEED_BASE}]
 
     forums = Forum.objects.forums_for_user(request.user)
     get_forum_unread_status(forums, request.user)
@@ -102,7 +104,7 @@
         if forum.has_feed:
             feeds.append({
                 'name': '%s Forum' % forum.name,
-                'feed': '/feeds/forums/%s/' % forum.slug,
+                'feed': FORUM_FEED % forum.slug,
                 })
 
         cat = cats.setdefault(forum.category.id, {
@@ -130,6 +132,13 @@
     if not forum.category.can_access(request.user):
         return HttpResponseForbidden()
 
+    feed = None
+    if not forum.category.groups.all():
+        feed = {
+            'name': '%s Forum' % forum.name,
+            'feed': FORUM_FEED % forum.slug,
+        }
+
     topics = forum.topics.select_related('user', 'last_post', 'last_post__user')
     get_topic_unread_status(forum, topics, request.user)
 
@@ -149,6 +158,7 @@
     
     return render_to_response('forums/forum_index.html', {
         'forum': forum,
+        'feed': feed,
         'page': page,
         'page_nav': page_nav,
         'can_moderate': can_moderate,
--- a/gpp/templates/forums/forum_index.html	Wed Sep 22 23:54:49 2010 +0000
+++ b/gpp/templates/forums/forum_index.html	Thu Sep 23 00:26:07 2010 +0000
@@ -1,8 +1,17 @@
 {% extends 'base.html' %}
 {% load forum_tags %}
+{% block custom_head %}
+{% if feed %}
+<link rel="alternate" type="application/rss+xml" title="{{ feed.name }}" href="{{ feed.feed }}" />
+{% endif %}
+{% endblock %}
 {% block title %}Forums: {{ forum.name }}{% endblock %}
 {% block content %}
-<h2>Forums: {{ forum.name }}</h2>
+<h2>Forums: {{ forum.name }}
+   {% if feed %}
+   <a href="{{ feed.feed }}"><img src="{{ MEDIA_URL }}icons/feed.png" alt="RSS Feed" title="Feed for this forum" /></a>
+   {% endif %}
+</h2>
 
 <h3>
    <a href="{% url forums-index %}">SurfGuitar101 Forum Index</a> &raquo;
--- a/gpp/templates/forums/index.html	Wed Sep 22 23:54:49 2010 +0000
+++ b/gpp/templates/forums/index.html	Thu Sep 23 00:26:07 2010 +0000
@@ -40,12 +40,9 @@
                   {% if forum.has_unread %}
                   <img src="{{ MEDIA_URL }}icons/new.png" alt="New Posts" title="New Posts" class="forums-topic-icon" />
                   {% endif %}
-                  <h4><a href="{{ forum.get_absolute_url }}">{{ forum.name }}</a>
-                     {% if forum.has_feed %}
-                     <a href="/feeds/forums/{{ forum.slug }}/">
-                        <img src="{{ MEDIA_URL }}icons/feed.png" alt="RSS Feed" title="Feed for this forum" /></a>
-                     {% endif %}</h4>
-                  <p>{{ forum.description }}</p></td>
+                  <h4><a href="{{ forum.get_absolute_url }}">{{ forum.name }}</a></h4>
+                  <p>{{ forum.description }}</p>
+               </td>
                <td class="forum-topics">{{ forum.topic_count }}</td>
                <td class="forum-posts">{{ forum.post_count }}</td>
                <td class="forum-last_post">{% last_post_info forum.last_post %}</td>