diff options
author | Johan Sørensen <johan@johansorensen.com> | 2009-12-17 13:52:54 +0100 |
---|---|---|
committer | Johan Sørensen <johan@johansorensen.com> | 2010-01-07 13:37:55 +0100 |
commit | 7abd7a06e801678dc1c4a1cf996f11ec31aad318 (patch) | |
tree | 4d27dc63c8d9a8803c7b51801ca18ae664af8186 /public/javascripts/application.js | |
parent | 51d1119f89552f3bd97d446f0f98ecf4f4355f7d (diff) | |
download | gitorious-mainline-outdated-7abd7a06e801678dc1c4a1cf996f11ec31aad318.zip gitorious-mainline-outdated-7abd7a06e801678dc1c4a1cf996f11ec31aad318.tar.gz gitorious-mainline-outdated-7abd7a06e801678dc1c4a1cf996f11ec31aad318.tar.bz2 |
Added a UI for managing whether to receive email when a feed item appears or not
Flagging this is a per favorite setting and is opt-in
Diffstat (limited to 'public/javascripts/application.js')
-rw-r--r-- | public/javascripts/application.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 0f11fb6..25fe896 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -227,6 +227,40 @@ $(document).ready(function() { }); }); + // Favorite toggling and deletion on the /favorites page + $("#favorite-listing tr:odd").addClass("odd"); + $("#favorite-listing td.notification .favorite.update a").click(function() { + $this = $(this); + payload = "_method=put&favorite[notify_by_email]=1"; + $.post($this.attr("href"), payload, function(data, respTxt){ + if ("success" === respTxt) { + if ("off" === $this.text()) { + $this.text("on").removeClass("disabled").addClass("enabled"); + } else { + $this.text("off").removeClass("enabled").addClass("disabled") + } + } + }); + + return false; + }); + + $("#favorite-listing td.unwatch .favorite a.watch-link").click(function() { + $this = $(this); + payload = "_method=delete"; + $.post($this.attr("href"), payload, function(data, respTxt){ + if ("success" === respTxt) { + $this.parents("tr").fadeOut("normal", function(){ + $(this).remove(); + $("#favorite-listing tr").removeClass("odd"); + $("#favorite-listing tr:odd").addClass("odd"); + }); + } + }); + + return false; + }); + }); if (!Gitorious) |