diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index 64b2eb4..2e6e173 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -762,6 +762,23 @@ var IPython = (function (IPython) { }; }; + Notebook.prototype.publish_notebook = function () { + var w = window.open('', '_blank', 'scrollbars=1,menubar=1'); + var html = '' + + $('head').clone().html() + + '' + + '' + + $('#notebook').clone().html() + + ''; + + w.document.open(); + w.document.write(html); + w.document.close(); + + return false; + }; Notebook.prototype.notebook_saved = function (data, status, xhr) { this.dirty = false; diff --git a/IPython/frontend/html/notebook/static/js/savewidget.js b/IPython/frontend/html/notebook/static/js/savewidget.js index fdbb0bf..8c1d732 100644 --- a/IPython/frontend/html/notebook/static/js/savewidget.js +++ b/IPython/frontend/html/notebook/static/js/savewidget.js @@ -21,6 +21,7 @@ var IPython = (function (IPython) { SaveWidget.prototype.style = function () { this.element.find('input#notebook_name').addClass('ui-widget ui-widget-content'); this.element.find('button#save_notebook').button(); + this.element.find('button#publish_notebook').button(); var left_panel_width = $('div#left_panel').outerWidth(); var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth(); $('span#save_widget').css({marginLeft:left_panel_width+left_panel_splitter_width}); @@ -33,6 +34,10 @@ var IPython = (function (IPython) { IPython.notebook.save_notebook(); that.set_document_title(); }); + + this.element.find('button#publish_notebook').click(function () { + IPython.notebook.publish_notebook(); + }); }; @@ -84,20 +89,23 @@ var IPython = (function (IPython) { SaveWidget.prototype.status_save = function () { - this.element.find('span.ui-button-text').text('Save'); - this.element.find('button#save_notebook').button('enable'); - }; + $('button#save_notebook').button('option', 'label', 'Save'); + $('button#save_notebook').button('enable'); + $('button#publish_notebook').button('enable'); + }; SaveWidget.prototype.status_saving = function () { - this.element.find('span.ui-button-text').text('Saving'); - this.element.find('button#save_notebook').button('disable'); - }; + $('button#save_notebook').button('option', 'label', 'Saving'); + $('button#save_notebook').button('disable'); + $('button#publish_notebook').button('disable'); + }; SaveWidget.prototype.status_loading = function () { - this.element.find('span.ui-button-text').text('Loading'); - this.element.find('button#save_notebook').button('disable'); + $('button#save_notebook').button('option', 'label', 'Loading'); + $('button#save_notebook').button('disable'); + $('button#publish_notebook').button('disable'); }; diff --git a/IPython/frontend/html/notebook/templates/notebook.html b/IPython/frontend/html/notebook/templates/notebook.html index 71be3d1..da00127 100644 --- a/IPython/frontend/html/notebook/templates/notebook.html +++ b/IPython/frontend/html/notebook/templates/notebook.html @@ -41,6 +41,7 @@ + Idle