Skip to content

Commit

Permalink
Add confirmation dialog to unsubscribe. Closes #740.
Browse files Browse the repository at this point in the history
  • Loading branch information
onyxfish committed Jun 6, 2012
1 parent b7341a0 commit 40c4099
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions client/static/js/views/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,26 @@ PANDA.views.User = Backbone.View.extend({
var uri = element.attr("data-uri");
var sub = this.user.subscriptions.get(uri);

this.user.subscriptions.remove(sub);
sub.destroy();
element.parent("li").remove();

// Destroy tooltip popup
$(".tooltip").remove();

return false;
bootbox.dialog(
"Are you sure you want to stop receiving notifications for this search?",
[
{
"label": "Stop notifications",
"class": "btn-danger",
"callback": _.bind(function(result) {
this.user.subscriptions.remove(sub);
sub.destroy();
element.parent("li").remove();

// Destroy tooltip popup
$(".tooltip").remove();
}, this)
},
{
"label": "Cancel"
}
]
);
}
});

0 comments on commit 40c4099

Please sign in to comment.