##// END OF EJS Templates
fixing broken links from recent changes....
Zachary Sailer -
Show More
@@ -100,4 +100,5 b' _notebook_path_regex = r"(?P<notebook_path>.+)"'
100 default_handlers = [
100 default_handlers = [
101 (r"/notebooks/%s" % _notebook_path_regex, NamedNotebookHandler),
101 (r"/notebooks/%s" % _notebook_path_regex, NamedNotebookHandler),
102 (r"/notebooks/", NotebookHandler),
102 (r"/notebooks/", NotebookHandler),
103 ] No newline at end of file
103 ]
104
@@ -77,8 +77,7 b' class FileNotebookManager(NotebookManager):'
77
77
78 def get_notebook_names(self, path):
78 def get_notebook_names(self, path):
79 """List all notebook names in the notebook dir."""
79 """List all notebook names in the notebook dir."""
80 names = glob.glob(os.path.join(self.notebook_dir, path,
80 names = glob.glob(self.get_os_path('*'+self.filename_ext, path))
81 '*' + self.filename_ext))
82 names = [os.path.basename(name)
81 names = [os.path.basename(name)
83 for name in names]
82 for name in names]
84 return names
83 return names
@@ -190,6 +190,7 b' default_handlers = ['
190 (r"api/notebooks/%s/checkpoints" % _notebook_path_regex, NotebookCheckpointsHandler),
190 (r"api/notebooks/%s/checkpoints" % _notebook_path_regex, NotebookCheckpointsHandler),
191 (r"api/notebooks/%s/checkpoints/%s" % (_notebook_path_regex, _checkpoint_id_regex),
191 (r"api/notebooks/%s/checkpoints/%s" % (_notebook_path_regex, _checkpoint_id_regex),
192 ModifyNotebookCheckpointsHandler),
192 ModifyNotebookCheckpointsHandler),
193 (r"api/notebooks/%s/" % _notebook_path_regex, NotebookHandler),
193 (r"api/notebooks/%s" % _notebook_path_regex, NotebookHandler),
194 (r"api/notebooks/%s" % _notebook_path_regex, NotebookHandler),
194 (r"api/notebooks/", NotebookRootRedirect),
195 (r"api/notebooks/", NotebookRootRedirect),
195 (r"api/notebooks", NotebookRootHandler),
196 (r"api/notebooks", NotebookRootHandler),
@@ -52,14 +52,8 b' var IPython = (function (IPython) {'
52
52
53 MenuBar.prototype.notebookPath = function() {
53 MenuBar.prototype.notebookPath = function() {
54 var path = $('body').data('notebookPath');
54 var path = $('body').data('notebookPath');
55 if (path != 'None') {
55 path = decodeURIComponent(path);
56 if (path[path.length-1] != '/') {
56 return path
57 path = path.substring(0,path.length);
58 };
59 return path;
60 } else {
61 return '';
62 }
63 };
57 };
64
58
65 MenuBar.prototype.style = function () {
59 MenuBar.prototype.style = function () {
@@ -81,7 +75,7 b' var IPython = (function (IPython) {'
81 IPython.notebook.new_notebook();
75 IPython.notebook.new_notebook();
82 });
76 });
83 this.element.find('#open_notebook').click(function () {
77 this.element.find('#open_notebook').click(function () {
84 window.open(that.baseProjectUrl() + 'tree/' + that.notebookPath());
78 window.open(that.baseProjectUrl() + 'tree' + that.notebookPath());
85 });
79 });
86 this.element.find('#copy_notebook').click(function () {
80 this.element.find('#copy_notebook').click(function () {
87 IPython.notebook.copy_notebook();
81 IPython.notebook.copy_notebook();
@@ -89,13 +83,13 b' var IPython = (function (IPython) {'
89 });
83 });
90 this.element.find('#download_ipynb').click(function () {
84 this.element.find('#download_ipynb').click(function () {
91 var notebook_name = IPython.notebook.get_notebook_name();
85 var notebook_name = IPython.notebook.get_notebook_name();
92 var url = that.baseProjectUrl() + 'api/notebooks/' + that.notebookPath() +
86 var url = that.baseProjectUrl() + 'api/notebooks' + that.notebookPath() +
93 notebook_name + '?format=json'+ '&download=True';
87 notebook_name + '?format=json'+ '&download=True';
94 window.location.assign(url);
88 window.location.assign(url);
95 });
89 });
96 this.element.find('#download_py').click(function () {
90 this.element.find('#download_py').click(function () {
97 var notebook_name = IPython.notebook.get_notebook_name();
91 var notebook_name = IPython.notebook.get_notebook_name();
98 var url = that.baseProjectUrl() + 'api/notebooks/' + that.notebookPath() +
92 var url = that.baseProjectUrl() + 'api/notebooks' + that.notebookPath() +
99 notebook_name + '?format=py' + '&download=True';
93 notebook_name + '?format=py' + '&download=True';
100 window.location.assign(url);
94 window.location.assign(url);
101 });
95 });
@@ -29,14 +29,7 b' var IPython = (function (IPython) {'
29 NotebookList.prototype.notebookPath = function() {
29 NotebookList.prototype.notebookPath = function() {
30 var path = $('body').data('notebookPath');
30 var path = $('body').data('notebookPath');
31 path = decodeURIComponent(path);
31 path = decodeURIComponent(path);
32 if (path != "") {
32 return path;
33 if (path[path.length-1] != '/') {
34 path = path.substring(0,path.length);
35 };
36 return path;
37 } else {
38 return path;
39 };
40 };
33 };
41
34
42 NotebookList.prototype.url_name = function(name){
35 NotebookList.prototype.url_name = function(name){
@@ -147,7 +140,7 b' var IPython = (function (IPython) {'
147 },this)
140 },this)
148 };
141 };
149
142
150 var url = this.baseProjectUrl() + 'api/notebooks/' + this.notebookPath();
143 var url = this.baseProjectUrl() + 'api/notebooks' + this.notebookPath();
151 $.ajax(url, settings);
144 $.ajax(url, settings);
152 };
145 };
153
146
@@ -209,7 +202,7 b' var IPython = (function (IPython) {'
209 item.data('path', path);
202 item.data('path', path);
210 item.find(".item_name").text(nbname);
203 item.find(".item_name").text(nbname);
211 item.find("a.item_link")
204 item.find("a.item_link")
212 .attr('href', this.baseProjectUrl() + "notebooks/" + this.notebookPath() + nbname + ".ipynb")
205 .attr('href', this.baseProjectUrl() + "notebooks" + this.notebookPath() + nbname + ".ipynb")
213 .attr('target','_blank');
206 .attr('target','_blank');
214 };
207 };
215
208
@@ -280,7 +273,7 b' var IPython = (function (IPython) {'
280 parent_item.remove();
273 parent_item.remove();
281 }
274 }
282 };
275 };
283 var url = notebooklist.baseProjectUrl() + 'api/notebooks/' + notebooklist.notebookPath() + nbname + '.ipynb';
276 var url = notebooklist.baseProjectUrl() + 'api/notebooks' + notebooklist.notebookPath() + nbname + '.ipynb';
284 $.ajax(url, settings);
277 $.ajax(url, settings);
285 }
278 }
286 },
279 },
@@ -347,10 +340,10 b' var IPython = (function (IPython) {'
347 dataType : "json",
340 dataType : "json",
348 success:$.proxy(function (data, status, xhr){
341 success:$.proxy(function (data, status, xhr){
349 notebook_name = data.name;
342 notebook_name = data.name;
350 window.open(this.baseProjectUrl() +'notebooks/' + this.notebookPath()+ notebook_name);
343 window.open(this.baseProjectUrl() +'notebooks' + this.notebookPath()+ notebook_name, '_blank');
351 }, this)
344 }, this)
352 };
345 };
353 var url = this.baseProjectUrl() + 'notebooks/' + path;
346 var url = this.baseProjectUrl() + 'notebooks' + path;
354 $.ajax(url,settings);
347 $.ajax(url,settings);
355 };
348 };
356
349
@@ -31,7 +31,7 b' class ProjectDashboardHandler(IPythonHandler):'
31 self.write(self.render_template('tree.html',
31 self.write(self.render_template('tree.html',
32 project=self.project,
32 project=self.project,
33 project_component=self.project.split('/'),
33 project_component=self.project.split('/'),
34 notebook_path= "''"
34 notebook_path= "/"
35 ))
35 ))
36
36
37
37
@@ -41,7 +41,7 b' class ProjectPathDashboardHandler(IPythonHandler):'
41 def get(self, notebook_path):
41 def get(self, notebook_path):
42 nbm = self.notebook_manager
42 nbm = self.notebook_manager
43 name, path = nbm.named_notebook_path(notebook_path)
43 name, path = nbm.named_notebook_path(notebook_path)
44 if name != None:
44 if name is not None:
45 # ends with .ipynb
45 # ends with .ipynb
46 self.redirect(self.base_project_url + 'notebooks' + path + name)
46 self.redirect(self.base_project_url + 'notebooks' + path + name)
47 else:
47 else:
@@ -49,7 +49,7 b' class ProjectPathDashboardHandler(IPythonHandler):'
49 path = nbm.url_encode(path)
49 path = nbm.url_encode(path)
50 self.write(self.render_template('tree.html',
50 self.write(self.render_template('tree.html',
51 project=project,
51 project=project,
52 project_component=project.split('/'),
52 project_component=project.split('/')[:-1],
53 notebook_path=path,
53 notebook_path=path,
54 notebook_name=name))
54 notebook_name=name))
55
55
@@ -65,7 +65,7 b' class TreePathRedirectHandler(IPythonHandler):'
65
65
66 @web.authenticated
66 @web.authenticated
67 def get(self, notebook_path):
67 def get(self, notebook_path):
68 url = self.base_project_url + 'tree/'+ notebook_path
68 url = self.base_project_url + 'tree/'+ notebook_path+'/'
69 self.redirect(url)
69 self.redirect(url)
70
70
71 class ProjectRedirectHandler(IPythonHandler):
71 class ProjectRedirectHandler(IPythonHandler):
@@ -84,8 +84,8 b' class ProjectRedirectHandler(IPythonHandler):'
84 _notebook_path_regex = r"(?P<notebook_path>.+)"
84 _notebook_path_regex = r"(?P<notebook_path>.+)"
85
85
86 default_handlers = [
86 default_handlers = [
87 (r"/tree/%s/" % _notebook_path_regex, TreePathRedirectHandler),
87 (r"/tree/%s/" % _notebook_path_regex, ProjectPathDashboardHandler),
88 (r"/tree/%s" % _notebook_path_regex, ProjectPathDashboardHandler),
88 (r"/tree/%s" % _notebook_path_regex, TreePathRedirectHandler),
89 (r"/tree", ProjectDashboardHandler),
89 (r"/tree", ProjectDashboardHandler),
90 (r"/tree/", TreeRedirectHandler),
90 (r"/tree/", TreeRedirectHandler),
91 (r"/", ProjectRedirectHandler)
91 (r"/", ProjectRedirectHandler)
General Comments 0
You need to be logged in to leave comments. Login now