Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vincent Grippi <Dan@SPEEDRACER.local>2010-09-15 08:24:57 +0400
committerDaniel Vincent Grippi <Dan@SPEEDRACER.local>2010-09-15 08:24:57 +0400
commitb77260af6b4e240304ce4e0d39c176768b785404 (patch)
tree5597e3c80b68ebc353ff6b7a9876760b64e53f1a
parentd9055a73d36501bcc689e06367fccb48f76a14b4 (diff)
Decrement request counter on request action
-rw-r--r--public/javascripts/aspect-edit.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js
index 1aa7b5a89..15562780c 100644
--- a/public/javascripts/aspect-edit.js
+++ b/public/javascripts/aspect-edit.js
@@ -28,6 +28,20 @@ $('#move_friends_link').live( 'click', function(){
});
+function decrementRequestsCounter(){
+ var old_request_count = $(".new_requests").html().match(/\d+/);
+
+ if( old_request_count == 1 ) {
+ $(".new_requests").html(
+ $(".new_requests").html().replace(/ \(\d+\)/,''));
+
+ } else {
+ $(".new_requests").html(
+ $(".new_requests").html().replace(/\d+/,old_request_count-1));
+ }
+
+}
+
$(function() {
$("ul .person").draggable({
revert: true
@@ -46,16 +60,7 @@ $(function() {
url: "/requests/" + ui.draggable[0].getAttribute('request_id') ,
data: {"accept" : true , "aspect_id" : $(this)[0].id },
success: function(data){
- var old_request_count = $(".new_requests").html().match(/\d+/);
-
- if( old_request_count == 1 ) {
- $(".new_requests").html(
- $(".new_requests").html().replace(/ \(\d+\)/,''));
-
- } else {
- $(".new_requests").html(
- $(".new_requests").html().replace(/\d+/,old_request_count-1));
- }
+ decrementRequestsCounter();
}
});
@@ -84,7 +89,7 @@ $(function() {
type: "DELETE",
url: "/requests/" + ui.draggable[0].getAttribute('request_id')
});
- alert("Removed Request, proably want an undo countdown.")
+ decrementRequestsCounter();
$(ui.draggable[0]).fadeOut('slow')
}else{
$.ajax({