Show More
@@ -762,6 +762,23 b' var IPython = (function (IPython) {' | |||||
762 | }; |
|
762 | }; | |
763 | }; |
|
763 | }; | |
764 |
|
764 | |||
|
765 | Notebook.prototype.publish_notebook = function () { | |||
|
766 | var w = window.open('', '_blank', 'scrollbars=1,menubar=1'); | |||
|
767 | var html = '<html><head>' + | |||
|
768 | $('head').clone().html() + | |||
|
769 | '<style type="text/css">' + | |||
|
770 | '@media print { body { overflow: visible !important; } }' + | |||
|
771 | '</style>' + | |||
|
772 | '</head><body style="overflow: auto;">' + | |||
|
773 | $('#notebook').clone().html() + | |||
|
774 | '</body></html>'; | |||
|
775 | ||||
|
776 | w.document.open(); | |||
|
777 | w.document.write(html); | |||
|
778 | w.document.close(); | |||
|
779 | ||||
|
780 | return false; | |||
|
781 | }; | |||
765 |
|
782 | |||
766 | Notebook.prototype.notebook_saved = function (data, status, xhr) { |
|
783 | Notebook.prototype.notebook_saved = function (data, status, xhr) { | |
767 | this.dirty = false; |
|
784 | this.dirty = false; |
@@ -21,6 +21,7 b' var IPython = (function (IPython) {' | |||||
21 | SaveWidget.prototype.style = function () { |
|
21 | SaveWidget.prototype.style = function () { | |
22 | this.element.find('input#notebook_name').addClass('ui-widget ui-widget-content'); |
|
22 | this.element.find('input#notebook_name').addClass('ui-widget ui-widget-content'); | |
23 | this.element.find('button#save_notebook').button(); |
|
23 | this.element.find('button#save_notebook').button(); | |
|
24 | this.element.find('button#publish_notebook').button(); | |||
24 | var left_panel_width = $('div#left_panel').outerWidth(); |
|
25 | var left_panel_width = $('div#left_panel').outerWidth(); | |
25 | var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth(); |
|
26 | var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth(); | |
26 | $('span#save_widget').css({marginLeft:left_panel_width+left_panel_splitter_width}); |
|
27 | $('span#save_widget').css({marginLeft:left_panel_width+left_panel_splitter_width}); | |
@@ -33,6 +34,10 b' var IPython = (function (IPython) {' | |||||
33 | IPython.notebook.save_notebook(); |
|
34 | IPython.notebook.save_notebook(); | |
34 | that.set_document_title(); |
|
35 | that.set_document_title(); | |
35 | }); |
|
36 | }); | |
|
37 | ||||
|
38 | this.element.find('button#publish_notebook').click(function () { | |||
|
39 | IPython.notebook.publish_notebook(); | |||
|
40 | }); | |||
36 | }; |
|
41 | }; | |
37 |
|
42 | |||
38 |
|
43 | |||
@@ -84,20 +89,23 b' var IPython = (function (IPython) {' | |||||
84 |
|
89 | |||
85 |
|
90 | |||
86 | SaveWidget.prototype.status_save = function () { |
|
91 | SaveWidget.prototype.status_save = function () { | |
87 | this.element.find('span.ui-button-text').text('Save'); |
|
92 | $('button#save_notebook').button('option', 'label', 'Save'); | |
88 |
|
|
93 | $('button#save_notebook').button('enable'); | |
|
94 | $('button#publish_notebook').button('enable'); | |||
89 |
}; |
|
95 | }; | |
90 |
|
96 | |||
91 |
|
97 | |||
92 | SaveWidget.prototype.status_saving = function () { |
|
98 | SaveWidget.prototype.status_saving = function () { | |
93 | this.element.find('span.ui-button-text').text('Saving'); |
|
99 | $('button#save_notebook').button('option', 'label', 'Saving'); | |
94 |
|
|
100 | $('button#save_notebook').button('disable'); | |
|
101 | $('button#publish_notebook').button('disable'); | |||
95 |
}; |
|
102 | }; | |
96 |
|
103 | |||
97 |
|
104 | |||
98 | SaveWidget.prototype.status_loading = function () { |
|
105 | SaveWidget.prototype.status_loading = function () { | |
99 | this.element.find('span.ui-button-text').text('Loading'); |
|
106 | $('button#save_notebook').button('option', 'label', 'Loading'); | |
100 |
|
|
107 | $('button#save_notebook').button('disable'); | |
|
108 | $('button#publish_notebook').button('disable'); | |||
101 | }; |
|
109 | }; | |
102 |
|
110 | |||
103 |
|
111 |
@@ -41,6 +41,7 b'' | |||||
41 | <input type="text" id="notebook_name" size="20"></textarea> |
|
41 | <input type="text" id="notebook_name" size="20"></textarea> | |
42 | <span id="notebook_id" style="display:none">{{notebook_id}}</span> |
|
42 | <span id="notebook_id" style="display:none">{{notebook_id}}</span> | |
43 | <button id="save_notebook">Save</button> |
|
43 | <button id="save_notebook">Save</button> | |
|
44 | <button id="publish_notebook">Publish</button> | |||
44 | </span> |
|
45 | </span> | |
45 | <span id="kernel_status">Idle</span> |
|
46 | <span id="kernel_status">Idle</span> | |
46 | </div> |
|
47 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now