]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/views/readers.py
Fixed OSQA-150: "tags pages" and "unanswered questions" pages have proper titles...
[osqa.git] / forum / views / readers.py
index 7f201aa551357d362c8bb88b2e22a65f1e4e6f4f..bac3c0c244b5c3ae05e4e08f6b8c9de1136f3f61 100644 (file)
@@ -48,19 +48,21 @@ def index(request):
 @decorators.render('questions.html', 'unanswered')
 def unanswered(request):
     return question_list(request, Question.objects.filter(extra_ref=None),
 @decorators.render('questions.html', 'unanswered')
 def unanswered(request):
     return question_list(request, Question.objects.filter(extra_ref=None),
-                         _('Open questions without an accepted answer'))
+                         _('Open questions without an accepted answer'),
+                         'active', None, _("Unanswered questions"))
 
 @decorators.render('questions.html', 'questions')
 def questions(request):
 
 @decorators.render('questions.html', 'questions')
 def questions(request):
-    return question_list(request, Question.objects.all())
+    return question_list(request, Question.objects.all(), _('questions'), 'active')
 
 @decorators.render('questions.html')
 def tag(request, tag):
     return question_list(request, Question.objects.filter(tags__name=unquote(tag)),
 
 @decorators.render('questions.html')
 def tag(request, tag):
     return question_list(request, Question.objects.filter(tags__name=unquote(tag)),
-                        mark_safe(_('Questions tagged <span class="tag">%(tag)s</span>') % {'tag': tag}))
+                        mark_safe(_('Questions tagged <span class="tag">%(tag)s</span>') % {'tag': tag}),
+                        'active', None, mark_safe(_('Questions tagged %(tag)s') % {'tag': tag}))
 
 @decorators.list('questions', QUESTIONS_PAGE_SIZE)
 
 @decorators.list('questions', QUESTIONS_PAGE_SIZE)
-def question_list(request, initial, list_description=_('questions'), sort=None, base_path=None):
+def question_list(request, initial, list_description=_('questions'), sort=None, base_path=None, page_title=None):
     questions = initial.filter(deleted=None, in_moderation=None)
 
     if request.user.is_authenticated():
     questions = initial.filter(deleted=None, in_moderation=None)
 
     if request.user.is_authenticated():
@@ -77,12 +79,16 @@ def question_list(request, initial, list_description=_('questions'), sort=None,
 
         questions=questions.order_by(view_dic.get(sort, '-added_at'))
 
 
         questions=questions.order_by(view_dic.get(sort, '-added_at'))
 
+    if page_title is None:
+        page_title = _("Questions")
+        
     return {
         "questions" : questions,
         "questions_count" : questions.count(),
         #"tags_autocomplete" : _get_tags_cache_json(),
         "list_description": list_description,
         "base_path" : base_path,
     return {
         "questions" : questions,
         "questions_count" : questions.count(),
         #"tags_autocomplete" : _get_tags_cache_json(),
         "list_description": list_description,
         "base_path" : base_path,
+        "page_title" : page_title,
         }
 
 
         }