From 96e9e11916b1e23edbfb23d9ff9e0a08a86b61d3 Mon Sep 17 00:00:00 2001 From: jordan Date: Tue, 15 Mar 2011 14:20:17 +0000 Subject: [PATCH 1/1] #OSQA-388, showing message to the current user on submit, the username of the awarded user and the number of points that had been given. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@842 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/skins/default/media/js/osqa.main.js | 4 ++++ forum/skins/default/templates/node/award_points.html | 3 +++ forum/views/commands.py | 8 +++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/forum/skins/default/media/js/osqa.main.js b/forum/skins/default/media/js/osqa.main.js index 31271d1..d95e4e0 100644 --- a/forum/skins/default/media/js/osqa.main.js +++ b/forum/skins/default/media/js/osqa.main.js @@ -71,6 +71,10 @@ var response_commands = { }); }, + award_points: function(id) { + alert('ok'); + }, + insert_comment: function(post_id, comment_id, comment, username, profile_url, delete_url, edit_url, convert_url) { var $container = $('#comments-container-' + post_id); var skeleton = $('#new-comment-skeleton-' + post_id).html().toString(); diff --git a/forum/skins/default/templates/node/award_points.html b/forum/skins/default/templates/node/award_points.html index 8210069..c7b7fcb 100644 --- a/forum/skins/default/templates/node/award_points.html +++ b/forum/skins/default/templates/node/award_points.html @@ -13,11 +13,14 @@ Award {{ awarded_user }} with reputation points.
+ + \ No newline at end of file diff --git a/forum/views/commands.py b/forum/views/commands.py index a447ffe..bd8e373 100644 --- a/forum/views/commands.py +++ b/forum/views/commands.py @@ -564,6 +564,8 @@ def award_points(request, user_id, answer_id): if not user.is_authenticated(): raise AnonymousNotAllowedException(_('award')) - return render_to_response("node/award_points.html", { 'user' : user, 'awarded_user' : awarded_user, }) - # Display the template - return render_to_response('node/permanent_link.html', { 'url' : url, }) + if not request.POST: + return render_to_response("node/award_points.html", { 'user' : user, 'awarded_user' : awarded_user, }) + else: + points = int(request.POST['points']) + return { 'message' : _("You have awarded %s with %d points") % (awarded_user, points) } \ No newline at end of file -- 2.39.5