From 94085b15dc67b8eb58ee10ea318fa1bc04ea284d Mon Sep 17 00:00:00 2001 From: Shane Tomlinson <stomlinson@mozilla.com> Date: Wed, 10 Aug 2011 16:26:03 -0700 Subject: [PATCH] Now the cancel/back buttons work correctly --- .../static/dialog/controllers/page_controller.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/browserid/static/dialog/controllers/page_controller.js b/browserid/static/dialog/controllers/page_controller.js index cede8db04..37bde2c5d 100644 --- a/browserid/static/dialog/controllers/page_controller.js +++ b/browserid/static/dialog/controllers/page_controller.js @@ -17,11 +17,15 @@ this.renderTemplates(bodyTemplate, bodyVars, footerTemplate, footerVars); $("form").bind("submit", this.onSubmit.bind(this)); + $("#cancel").click(this.onCancel.bind(this)); + $("#back").click(this.onBack.bind(this)); }, destroy: function() { $("form").unbind("submit"); $("input").unbind("keyup"); + $("#cancel").unbind("click"); + $("#back").unbind("click"); this._super(); }, @@ -81,16 +85,17 @@ $("#error_dialog").fadeIn(500); }, - "#cancel click": function() { + onCancel: function(event) { + event.preventDefault(); + event.stopPropagation(); this.close("cancel"); }, - "#back click": function(event) { + onBack: function(event) { + event.preventDefault(); + event.stopPropagation(); this.close("start"); } - - - }); }()); -- GitLab