diff --git a/IPython/html/static/tree/js/main.js b/IPython/html/static/tree/js/main.js index 6982b6f..986ebb5 100644 --- a/IPython/html/static/tree/js/main.js +++ b/IPython/html/static/tree/js/main.js @@ -130,6 +130,7 @@ require([ IPython.session_list = session_list; IPython.kernel_list = kernel_list; IPython.login_widget = login_widget; + IPython.new_notebook_widget = nnw; events.trigger('app_initialized.DashboardApp'); diff --git a/IPython/html/static/tree/js/newnotebook.js b/IPython/html/static/tree/js/newnotebook.js index a860712..5753316 100644 --- a/IPython/html/static/tree/js/newnotebook.js +++ b/IPython/html/static/tree/js/newnotebook.js @@ -58,17 +58,12 @@ define([ var li = $("
  • ") .attr("id", "kernel-" +ks.name) .data('kernelspec', ks).append( - $('').attr('href', '#').append($('') - .addClass('kernel-menu-icon fa') - .attr('href', '#') - .click($.proxy(this.select_kernel, this, ks.name)) - ).append($('') + $('') .attr('href', '#') .click($.proxy(this.new_notebook, this, ks.name)) .text(ks.display_name) .attr('title', 'Create a new notebook with ' + ks.display_name) - ) - ); + ); menu.append(li); } this.config.loaded.then(function () { @@ -77,17 +72,17 @@ define([ }; NewNotebookWidget.prototype._load_default_kernelspec = function (default_name) { - /** load default kernelspec name from localStorage, if defined */ + /** load default kernelspec name from config, if defined */ if (this.config.data.NewNotebookWidget && this.config.data.NewNotebookWidget.current_selection && this.kernelspecs[this.config.data.NewNotebookWidget.current_selection] !== undefined ) { default_name = this.config.data.NewNotebookWidget.current_selection; } - this.select_kernel(default_name); + this.set_default_kernel(default_name); }; - NewNotebookWidget.prototype.select_kernel = function (kernel_name) { + NewNotebookWidget.prototype.set_default_kernel = function (kernel_name) { /** select the current default kernel */ this.current_selection = kernel_name; this.config.update({ @@ -99,33 +94,13 @@ define([ var display_name; if (spec) { display_name = spec.display_name; - localStorage.default_kernel_name = kernel_name; this.element.find("#current-kernel").text(display_name); } else { display_name = 'default kernel'; - delete localStorage.default_kernel_name; } this.element.find("#new_notebook").attr('title', 'Create a new notebook with ' + display_name ); - this.element.find("li").map(function (i, li) { - li = $(li); - var ks = li.data('kernelspec'); - if (ks.name == kernel_name) { - li.find(".kernel-menu-icon") - .attr('title', display_name + ' is the default kernel') - .addClass("kernel-menu-icon-current"); - } else { - li.find(".kernel-menu-icon") - .attr('title', 'Make ' + ks.display_name + ' the default kernel') - .removeClass("kernel-menu-icon-current"); - } - }); - }; - - NewNotebookWidget.prototype.new_with_kernel = function (kernel_name) { - /** record current selection and open a new notebook */ - this.new_notebook(kernel_name); }; NewNotebookWidget.prototype.new_notebook = function (kernel_name) {