##// END OF EJS Templates
fix kernel change breaking new notebook list
Mathieu -
Show More
@@ -86,9 +86,28 b' define(['
86 86
87 87 // put the current kernel at the top of File > New Notebook
88 88 var cur_kernel_entry = $("#new-notebook-submenu-" + ks.name);
89 if (cur_kernel_entry.length) {
90 cur_kernel_entry.parent().prepend($("<li>").attr("class","divider"))
91 .prepend(cur_kernel_entry);
89 var parent = cur_kernel_entry.parent();
90 // do something only if there is more than one kernel
91 if (parent.children().length > 1) {
92 // first, sort back the submenu
93 parent.append(
94 parent.children("li[class!='divider']").sort(
95 function (a,b) {
96 var da = $("a",a).text();
97 var db = $("a",b).text();
98 if (da === db) {
99 return 0;
100 } else if (da > db) {
101 return 1;
102 } else {
103 return -1;
104 }}));
105 // then, if there is no divider yet, add one
106 if (!parent.children("li[class='divider']").length) {
107 parent.prepend($("<li>").attr("class","divider"));
108 }
109 // finally, put the current kernel at the top
110 parent.prepend(cur_kernel_entry);
92 111 }
93 112
94 113 // load logo
General Comments 0
You need to be logged in to leave comments. Login now