code-dot-org/dashboard — pull request #868 by Bjvanminnen (2014-06-20 18:21:19+00:00)
Title: remove superfluous dialog hiding

Turns out there are a bunch of ways to close dialogs. Here are a few:
(1) Hit Esc
(2) Click close button
(3) Click outside of dialog (unless options.backdrop is true).
(4) Click button in dialog ('i.e. try again')
(5) Hit space or enter on some dialogs (via callback provided by client)

Most of these are automatically handled by bootstrap's modal dialog functionality. For some reason, we then try to provide some of these again ourselves. Furthermore, when handling it by ourselves we end up calling .hide after we've already handled hidden.bs.modal and removed the parent element. I suspect this is the source of the errors we've seen on New Relic, though I'm not certain.

There are also cases where the client adds click events to buttons and calls .hide. In this case, hide gets called before the hidden.bs.modal event. It seems like it would be better to have all this logic in one place (rather than having it in dashboard in some cases and blockly in others), but that's out of scope for this change.

I've tested this on Mac Chrome/Safari/FF and on IE 11.