Skip to content

Commit

Permalink
notebook download implies save
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Oct 18, 2011
1 parent bf4b2a0 commit 2aacd8b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions IPython/frontend/html/notebook/static/js/panelsection.js
Expand Up @@ -106,9 +106,19 @@ var IPython = (function (IPython) {
});
this.content.find('#download_notebook').click(function () {
var format = that.content.find('#download_format').val();
var notebook_id = IPython.save_widget.get_notebook_id();
var url = '/notebooks/' + notebook_id + '?format=' + format;
window.open(url,'_newtab');
// save on download
IPython.save_widget.save_notebook();
// hook into notebook_saved method to download on success:
var old_notebook_saved = IPython.save_widget.notebook_saved;
IPython.save_widget.notebook_saved = function() {
// restore and call original function:
IPython.save_widget.notebook_saved = old_notebook_saved;
IPython.save_widget.notebook_saved();
// now trigger download
var notebook_id = IPython.save_widget.get_notebook_id();
var url = '/notebooks/' + notebook_id + '?format=' + format;
window.open(url,'_newtab');
}
});
};

Expand Down

0 comments on commit 2aacd8b

Please sign in to comment.