]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/views/readers.py
made it so that when you are searching questions the questions tab is highlighted
[osqa.git] / forum / views / readers.py
index 17cea0fe2599c86331b61f3afb6804d8205327b4..b865fbb0dc2b91f9ddef69b6928b66e698c5ac8f 100644 (file)
@@ -91,16 +91,24 @@ def question_list(request, initial, list_description=_('questions'), sort=None,
     if page_title is None:
         page_title = _("Questions")
 
+    keywords =  ""
+    if request.GET.get("q"):
+        keywords = request.GET.get("q").strip()
+
     answer_count = Answer.objects.filter(deleted=None, parent__in=questions).count()   
+    answer_description = _("answers")
 
     return {
         "questions" : questions,
         "questions_count" : questions.count(),
         "answer_count" : answer_count,
+        "keywords" : keywords,
         #"tags_autocomplete" : _get_tags_cache_json(),
         "list_description": list_description,
+        "answer_description": answer_description,
         "base_path" : base_path,
         "page_title" : page_title,
+        "tab" : "questions",
         }
 
 
@@ -227,7 +235,11 @@ def question(request, id, slug):
     if question.deleted and not request.user.can_view_deleted_post(question):
         raise Http404
 
-    answer_form = AnswerForm(question)
+    if request.POST:
+        answer_form = AnswerForm(question, request.POST)
+    else:
+        answer_form = AnswerForm(question)
+
     answers = request.user.get_visible_answers(question)
 
     if answers is not None: