From: jordan Date: Mon, 24 Oct 2011 22:59:35 +0000 (+0000) Subject: check the setting before deciding whether to append or to prepend X-Git-Tag: live~122 X-Git-Url: https://git.openstreetmap.org/osqa.git/commitdiff_plain/c8537fcc3215267c5ffc9a80137a02ceffc7e895 check the setting before deciding whether to append or to prepend git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1195 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/skins/default/media/js/osqa.main.js b/forum/skins/default/media/js/osqa.main.js index 17de794..89a59ef 100644 --- a/forum/skins/default/media/js/osqa.main.js +++ b/forum/skins/default/media/js/osqa.main.js @@ -104,7 +104,7 @@ var response_commands = { alert('ok'); }, - insert_comment: function(post_id, comment_id, comment, username, profile_url, delete_url, edit_url, convert_url, can_convert) { + insert_comment: function(post_id, comment_id, comment, username, profile_url, delete_url, edit_url, convert_url, can_convert, show_latest_comments_first) { var $container = $('#comments-container-' + post_id); var skeleton = $('#new-comment-skeleton-' + post_id).html().toString(); @@ -115,8 +115,11 @@ var response_commands = { .replace(new RegExp('%DELETE_URL%', 'g'), delete_url) .replace(new RegExp('%EDIT_URL%', 'g'), edit_url) .replace(new RegExp('%CONVERT_URL%', 'g'), convert_url); - - $container.prepend(skeleton); + if (show_latest_comments_first) { + $container.prepend(skeleton); + } else { + $container.append(skeleton); + } // Show the convert comment to answer tool only if the current comment can be converted if (can_convert == true) { diff --git a/forum/views/commands.py b/forum/views/commands.py index 0e33552..e909bdf 100644 --- a/forum/views/commands.py +++ b/forum/views/commands.py @@ -284,6 +284,7 @@ def comment(request, id): reverse('node_markdown', kwargs={'id': comment.id}), reverse('convert_comment', kwargs={'id': comment.id}), user.can_convert_comment_to_answer(comment), + bool(settings.SHOW_LATEST_COMMENTS_FIRST) ] } }