Permalink
Browse files

Fix dialog closing event for left - top Close button

  • Loading branch information...
1 parent 670bb53 commit 524876d4cbebd3316d4c1ac2a6fcfbbfd7cfcf1f @oivoodoo oivoodoo committed Feb 13, 2012
Showing with 11 additions and 7 deletions.
  1. +11 −7 public/app/views/pomodoros/timer.js
@@ -4,21 +4,25 @@ App.Views.Pomodoros.Timer = Backbone.View.extend({
initialize: function(options) {
var self = this;
+ this.timer = null;
this.minutes = options.minutes;
_.bindAll(this);
- $('#timer').bind('dialogclose', function() {
- self.leave();
+ var closeDialog = function() {
+ self.leave.call(self);
self.cleanupTimer.call(self);
+ $('#timer').dialog('close');
+ };
+
+ $('#timer [data-icon=delete]').live('click', function(event) {
+ event.preventDefault();
+ closeDialog();
});
this.$('.cancel').bind('click', function(event) {
event.preventDefault();
-
- self.cleanupTimer.call(self);
- self.leave();
- $('#timer').dialog('close');
+ closeDialog();
});
this.render();
@@ -84,7 +88,7 @@ App.Views.Pomodoros.Timer = Backbone.View.extend({
},
leave: function() {
- $(this.el).unbind('dialogclose');
this.$('.cancel').unbind('dialogclose');
+ $('#timer [data-icon=delete]').unbind('click');
}
});

0 comments on commit 524876d

Please sign in to comment.