]> git.openstreetmap.org Git - osqa.git/commitdiff
Jira OSQA-528, display the tag name in the meta description on the tag view, extendin...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sun, 31 Jul 2011 17:00:47 +0000 (17:00 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sun, 31 Jul 2011 17:00:47 +0000 (17:00 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1139 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/skins/default/templates/questions.html
forum/views/readers.py

index 8d4ee0ad63fa0160598273a336a8e05c02e2c19f..6b9e0a394873104747cb36128f162134ad95dacc 100644 (file)
@@ -7,6 +7,12 @@
 \r
 {% block title %}{% spaceless %}{{ page_title }}{% endspaceless %}{% endblock %}\r
 \r
+{% block metadescription %}{% spaceless %}\r
+    {% if tag %}\r
+        {% blocktrans with settings.APP_TITLE as app_title %}Questions and answers about {{ tag }} on {{ app_title }}{% endblocktrans %}\r
+    {% endif %}\r
+{% endspaceless %}{% endblock %}\r
+\r
 {% block meta %}\r
     <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ feed_url }}" />\r
 {% endblock %}\r
index d757e51da1bca65df3b3f35b23ba731840d3b90e..a16712e2164805193ca44d45adf4245adcc27b36 100644 (file)
@@ -113,13 +113,24 @@ def tag(request, tag):
             except User.DoesNotExist:
                 raise Http404
 
-    return question_list(request,
+    # The extra tag context we need to pass
+    tag_context = {
+        'tag' : tag,
+    }
+
+    # The context returned by the question_list function, contains info about the questions
+    question_context = question_list(request,
                          questions,
                          mark_safe(_(u'questions tagged <span class="tag">%(tag)s</span>') % {'tag': tag}),
                          None,
                          mark_safe(_(u'Questions Tagged With %(tag)s') % {'tag': tag}),
                          False)
 
+    # Create the combined context
+    context = dict(question_context, **tag_context)
+
+    return context
+
 @decorators.render('questions.html', 'questions', tabbed=False)
 def user_questions(request, mode, user, slug):
     user = get_object_or_404(User, id=user)
@@ -185,16 +196,19 @@ def question_list(request, initial,
 
         feed_url = request.path + "?type=rss" + req_params
 
-    return pagination.paginated(request, ('questions', paginator_context or QuestionListPaginatorContext()), {
-    "questions" : questions.distinct(),
-    "questions_count" : questions.count(),
-    "keywords" : keywords,
-    "list_description": list_description,
-    "base_path" : base_path,
-    "page_title" : page_title,
-    "tab" : "questions",
-    'feed_url': feed_url,
-    })
+    context = {
+        'questions' : questions.distinct(),
+        'questions_count' : questions.count(),
+        'keywords' : keywords,
+        'list_description': list_description,
+        'base_path' : base_path,
+        'page_title' : page_title,
+        'tab' : 'questions',
+        'feed_url': feed_url,
+    }
+
+    return pagination.paginated(request,
+                               ('questions', paginator_context or QuestionListPaginatorContext()), context)
 
 
 def search(request):