diff --git a/IPython/frontend/html/notebook/static/js/clusterlist.js b/IPython/frontend/html/notebook/static/js/clusterlist.js index 8ef1de0..ed8ff61 100644 --- a/IPython/frontend/html/notebook/static/js/clusterlist.js +++ b/IPython/frontend/html/notebook/static/js/clusterlist.js @@ -84,6 +84,11 @@ var IPython = (function (IPython) { this.style(); }; + ClusterItem.prototype.baseProjectUrl = function(){ + return this._baseProjectUrl || $('body').data('baseProjectUrl'); + }; + + ClusterItem.prototype.style = function () { this.element.addClass('list_item ui-widget ui-widget-content ui-helper-clearfix'); @@ -138,7 +143,7 @@ var IPython = (function (IPython) { } }; status_col.html('starting'); - var url = this.baseProjectUrl() + 'clusters/' + that.data.profile + '/start'; + var url = that.baseProjectUrl() + 'clusters/' + that.data.profile + '/start'; $.ajax(url, settings); }; }); @@ -172,7 +177,7 @@ var IPython = (function (IPython) { } }; status_col.html('stopping') - var url = this.baseProjectUrl() + 'clusters/' + that.data.profile + '/stop'; + var url = that.baseProjectUrl() + 'clusters/' + that.data.profile + '/stop'; $.ajax(url, settings); }); }; diff --git a/IPython/frontend/html/notebook/static/js/menubar.js b/IPython/frontend/html/notebook/static/js/menubar.js index fc586cf..4e41924 100644 --- a/IPython/frontend/html/notebook/static/js/menubar.js +++ b/IPython/frontend/html/notebook/static/js/menubar.js @@ -65,18 +65,19 @@ var IPython = (function (IPython) { MenuBar.prototype.bind_events = function () { // File + var that = this; this.element.find('#new_notebook').click(function () { - window.open(this.baseProjectUrl()+'new'); + window.open(that.baseProjectUrl()+'new'); }); this.element.find('#open_notebook').click(function () { - window.open(this.baseProjectUrl()); + window.open(that.baseProjectUrl()); }); this.element.find('#rename_notebook').click(function () { IPython.save_widget.rename_notebook(); }); this.element.find('#copy_notebook').click(function () { var notebook_id = IPython.notebook.get_notebook_id(); - var url = this.baseProjectUrl() + notebook_id + '/copy'; + var url = that.baseProjectUrl() + notebook_id + '/copy'; window.open(url,'_blank'); return false; }); @@ -85,13 +86,13 @@ var IPython = (function (IPython) { }); this.element.find('#download_ipynb').click(function () { var notebook_id = IPython.notebook.get_notebook_id(); - var url = this.baseProjectUrl() + 'notebooks/' + + var url = that.baseProjectUrl() + 'notebooks/' + notebook_id + '?format=json'; window.location.assign(url); }); this.element.find('#download_py').click(function () { var notebook_id = IPython.notebook.get_notebook_id(); - var url = this.baseProjectUrl() + 'notebooks/' + + var url = that.baseProjectUrl() + 'notebooks/' + notebook_id + '?format=py'; window.location.assign(url); }); diff --git a/IPython/frontend/html/notebook/static/js/notebooklist.js b/IPython/frontend/html/notebook/static/js/notebooklist.js index 58b681e..513a509 100644 --- a/IPython/frontend/html/notebook/static/js/notebooklist.js +++ b/IPython/frontend/html/notebook/static/js/notebooklist.js @@ -216,7 +216,7 @@ var IPython = (function (IPython) { that.load_list(); } }; - var url = this.baseProjectUrl() + 'kernels/'+kernel; + var url = that.baseProjectUrl() + 'kernels/'+kernel; $.ajax(url, settings); }); new_buttons.append(shutdown_button); @@ -257,7 +257,7 @@ var IPython = (function (IPython) { parent_item.remove(); } }; - var url = this.baseProjectUrl() + 'notebooks/' + notebook_id; + var url = that.baseProjectUrl() + 'notebooks/' + notebook_id; $.ajax(url, settings); $(this).dialog('close'); }, @@ -306,7 +306,7 @@ var IPython = (function (IPython) { }; var qs = $.param({name:nbname, format:nbformat}); - var url = this.baseProjectUrl() + 'notebooks?' + qs; + var url = that.baseProjectUrl() + 'notebooks?' + qs; $.ajax(url, settings); }); var cancel_button = $('').button().