quintel / etmoses

Online decision support tool to create local energy situations for neighbourhoods, cities and regions with a time resolution of 15 minutes created and maintained by Quintel – Not maintained
https://moses.energytransitionmodel.com
MIT License
11 stars 3 forks source link

Make 'clone' function exactly the same as 'save as' #1401

Closed grdw closed 8 years ago

grdw commented 8 years ago

Fixes: #1352

antw commented 8 years ago

I had to make a change to get this to work. onSaveAs.bind(this) was being called in the window context, so the callback was being bound to the document object and not to the button element. This meant that I would enter a name for the new LES, click "Save", and nothing would happen. It just... didn't work.

I added a namespace to the event and called off("click.onSaveAs") before binding; if the user moved to a different page and then hit their back button, multiple onSaveAs events would be bound to the same button. I think we should be using event delegation more.