]> git.openstreetmap.org Git - osqa.git/commitdiff
AMore rss feed improvements.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 28 Jun 2010 11:53:53 +0000 (11:53 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 28 Jun 2010 11:53:53 +0000 (11:53 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@456 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/feed.py
forum/skins/default/media/style/style.css
forum/skins/default/templates/questions.html
forum/views/readers.py

index 2575e6669e21a0051c85ba4a4072ce408612b28a..15a8ab9da366e97e7ae307e198dfe146ecc92268 100644 (file)
@@ -1,8 +1,11 @@
 try:
     from django.contrib.syndication.views import Feed, FeedDoesNotExist
+    old_version = False
 except:
     from django.contrib.syndication.feeds import Feed, FeedDoesNotExist
+    old_version = True
 
+from django.http import HttpResponse
 from django.utils.translation import ugettext as _
 from models import Question
 from forum import settings
@@ -15,7 +18,10 @@ class RssQuestionFeed(Feed):
         self._title = title
         self._description = description
         self._question_list = question_list
-        self._url = request.path
+        self._url = request.path + "&" + "&".join(["%s=%s" % (k, v) for k, v in request.GET.items() if not k in ('page', 'pagesize', 'sort')])
+
+        if old_version:
+            super(RssQuestionFeed, self).__init__('', request)
 
     def title(self):
         return self._title
@@ -35,5 +41,16 @@ class RssQuestionFeed(Feed):
     def item_pubdate(self, item):
         return item.added_at
 
+    def item_categories(self, item):
+        return item.tagname_list()  
+
     def items(self, item):
        return self._question_list[:30]
+
+    if old_version:
+        def __call__(self, request):
+            feedgen = self.get_feed('')
+            response = HttpResponse(mimetype=feedgen.mime_type)
+            feedgen.write(response, 'utf-8')
+            return response
+            
index 3c94bea1849403888a1df19e91d5cfcc8e7e0516..a2a9fa865cf2b9b40c770484d98d588c90aeb20a 100644 (file)
@@ -1710,4 +1710,10 @@ div.dialog.prompt .dialog-content select, div.dialog.prompt .dialog-content text
 
 .suspended-user {
     text-decoration: line-through;
+}
+
+.feed-icon {
+    width: 14px;
+    height: 14px;
+    float: left;
 }
\ No newline at end of file
index 16ba09f26efcb4ce65eca670e1dc67702100d382..9c3523ac9514eba6360e5cecb76e6c0190249b49 100644 (file)
@@ -14,7 +14,7 @@
 {% block content %}\r
 <div class="tabBar">\r
     {% question_list_title %}\r
-    <a style="float:left" href="{{ feed_url }}" title="{% trans "subscribe to question RSS feed" %}"><img src="{% media "media/images/feed-icon-small.png" %}" alt=""></a>\r
+    <a class="feed-icon" style="background-image:url('{% media "media/images/feed-icon-small.png" %}');" href="{{ feed_url }}" title="{% trans "subscribe to question RSS feed" %}"></a>\r
     {% question_sort_tabs sort_context %}\r
 </div>\r
 <div id="listA">{% for question in questions %}\r
index 7a73856317486c23def9391a8c6a1462815e00b9..134fff24fb5e09e21991efbb95f51ddb730c641b 100644 (file)
@@ -149,7 +149,11 @@ def question_list(request, initial,
     answer_description = _("answers")
 
     if not feed_url:
-        feed_url = request.path + "?type=rss"
+        req_params = "&".join(["%s=%s" % (k, v) for k, v in request.GET.items() if not k in ('page', 'pagesize', 'sort')])
+        if req_params:
+            req_params = '&' + req_params
+
+        feed_url = mark_safe(request.path + "?type=rss" + req_params)
 
     return {
     "questions" : questions,