]> git.openstreetmap.org Git - osqa.git/commitdiff
adding support for focusing answers when linking to them
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Wed, 7 Dec 2011 21:51:23 +0000 (21:51 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Wed, 7 Dec 2011 21:51:23 +0000 (21:51 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1208 0cfe37f9-358a-4d5e-be75-b63607b5c754

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

index 58bc23aa3374bf51a740db1db03fda7cd70c5e8c..883c8913928b8de54eaa81e923d7669f49ddbabc 100644 (file)
@@ -795,6 +795,10 @@ div.question-body p, div.answer-body p {
     color: #6B2B28;
 }
 
+.focusedAnswer {
+    background: #FFFFCC;
+}
+
 .tagsList {
     list-style-type: none;
     margin: 0;
index aff082b9f98a53d3733e782ce0ef81b9776a9ece..2172da9c4089c07bbd232dd1ca7ad7ff27caee17 100644 (file)
   \r
                 {% for answer in answers.paginator.page %}\r
                     <a name="{{ answer.id }}"></a>\r
-                    <div id="answer-container-{{ answer.id }}" class="answer {% post_classes answer %}">\r
+                    <div id="answer-container-{{ answer.id }}" class="answer {% post_classes answer %}{% ifequal answer.id focused_answer_id %} focusedAnswer{% endifequal %}">\r
                         <table style="width:100%;">\r
                             <tr>\r
                                 <td style="width:30px;vertical-align:top">\r
index 99233e895abd01915576b2a0867a5d442718b094..3de8c4148c4f4ebaf3fc2e9e509d8ccd3da839dd 100644 (file)
@@ -324,8 +324,8 @@ def answer_redirect(request, answer):
     if page == 0:
         page = 1
 
-    return HttpResponsePermanentRedirect("%s?%s=%s#%s" % (
-        answer.question.get_absolute_url(), _('page'), page, answer.id))
+    return HttpResponseRedirect("%s?%s=%s&focusedAnswerId=%s#%s" % (
+        answer.question.get_absolute_url(), _('page'), page, answer.id, answer.id))
 
 @decorators.render("question.html", 'questions')
 def question(request, id, slug='', answer=None):
@@ -375,6 +375,10 @@ def question(request, id, slug='', answer=None):
             subscription = False
     else:
         subscription = False
+    try:
+        focused_answer_id = int(request.GET.get("focusedAnswerId", None))
+    except TypeError, ValueError:
+        focused_answer_id = None
 
     return pagination.paginated(request, ('answers', AnswerPaginatorContext()), {
     "question" : question,
@@ -383,6 +387,7 @@ def question(request, id, slug='', answer=None):
     "similar_questions" : question.get_related_questions(),
     "subscription": subscription,
     "embed_youtube_videos" : settings.EMBED_YOUTUBE_VIDEOS,
+    "focused_answer_id" : focused_answer_id
     })