Change all context menues for a Sone after following/unfollowing.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 22 Jun 2011 18:56:53 +0000 (20:56 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 22 Jun 2011 19:33:38 +0000 (21:33 +0200)
src/main/resources/static/javascript/sone.js

index 05aab1d..44eee87 100644 (file)
@@ -829,6 +829,12 @@ function ajaxifyPost(postElement) {
                        ajaxGet("followSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() {
                                $(followElement).addClass("hidden");
                                $(followElement).parent().find(".unfollow").removeClass("hidden");
+                               $("#sone .sone-menu").each(function() {
+                                       if (getMenuSone(this) == soneId) {
+                                               $(".follow", this).toggleClass("hidden", true);
+                                               $(".unfollow", this).toggleClass("hidden", false);
+                                       }
+                               });
                        });
                        return false;
                });
@@ -837,6 +843,12 @@ function ajaxifyPost(postElement) {
                        ajaxGet("unfollowSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() {
                                $(unfollowElement).addClass("hidden");
                                $(unfollowElement).parent().find(".follow").removeClass("hidden");
+                               $("#sone .sone-menu").each(function() {
+                                       if (getMenuSone(this) == soneId) {
+                                               $(".follow", this).toggleClass("hidden", false);
+                                               $(".unfollow", this).toggleClass("hidden", true);
+                                       }
+                               });
                        });
                        return false;
                });