]> git.openstreetmap.org Git - osqa.git/commitdiff
#OSQA-388, showing message to the current user on submit, the username of the awarded...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 15 Mar 2011 14:20:17 +0000 (14:20 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 15 Mar 2011 14:20:17 +0000 (14:20 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@842 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/skins/default/media/js/osqa.main.js
forum/skins/default/templates/node/award_points.html
forum/views/commands.py

index 31271d16cc68996f257634074a3644cfd1939b97..d95e4e0523a1f8005f34a1b78029652dcf1a0b48 100644 (file)
@@ -71,6 +71,10 @@ var response_commands = {
         });\r
     },\r
 \r
         });\r
     },\r
 \r
+    award_points: function(id) {\r
+        alert('ok');\r
+    },\r
+\r
     insert_comment: function(post_id, comment_id, comment, username, profile_url, delete_url, edit_url, convert_url) {\r
         var $container = $('#comments-container-' + post_id);\r
         var skeleton = $('#new-comment-skeleton-' + post_id).html().toString();\r
     insert_comment: function(post_id, comment_id, comment, username, profile_url, delete_url, edit_url, convert_url) {\r
         var $container = $('#comments-container-' + post_id);\r
         var skeleton = $('#new-comment-skeleton-' + post_id).html().toString();\r
index 82100694d26bb2a117ffd6fe5413376e32a3da2d..c7b7fcbc778195c6bc83c55ccde1a19e0a4cf193 100644 (file)
@@ -13,11 +13,14 @@ Award {{ awarded_user }} with reputation points.
 
 <div class="award_points_slider"></div>
 
 
 <div class="award_points_slider"></div>
 
+<input type="hidden" name="points" id="points_input" value="0" />
+
 <script>
 $('.award_points_slider').slider({
     min: 1, max: {{ user.reputation }},
     slide: function(evt, ui) {
         $('#reputation_points_award').html(ui.value)
 <script>
 $('.award_points_slider').slider({
     min: 1, max: {{ user.reputation }},
     slide: function(evt, ui) {
         $('#reputation_points_award').html(ui.value)
+        $('#points_input').val(ui.value)
     }
 });
 </script>
\ No newline at end of file
     }
 });
 </script>
\ No newline at end of file
index a447ffefb79c27ac6c3f2bc711f49b14629f38f4..bd8e373eaacd2621c5400520a0e8040ed2e18d32 100644 (file)
@@ -564,6 +564,8 @@ def award_points(request, user_id, answer_id):
     if not user.is_authenticated():
         raise AnonymousNotAllowedException(_('award'))
 
     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