This could be hideModal instead of cancel, right?

I'm thinking that these same lines appear in many places, and it would be nice if edit_helpers.hideModal checked the conditions itself so you could just always call it with abandon.