fixing broken links from recent changes.

After fixing operating system path changes in previous commits,
many links needed to be adjusted to direct to the correct URL.
This commit is contained in:
Zachary Sailer 2013-08-13 14:58:40 -07:00 committed by MinRK
parent 470595f9e7
commit 34b9840786
6 changed files with 21 additions and 33 deletions

View File

@ -100,4 +100,5 @@ _notebook_path_regex = r"(?P<notebook_path>.+)"
default_handlers = [
(r"/notebooks/%s" % _notebook_path_regex, NamedNotebookHandler),
(r"/notebooks/", NotebookHandler),
]
]

View File

@ -77,8 +77,7 @@ class FileNotebookManager(NotebookManager):
def get_notebook_names(self, path):
"""List all notebook names in the notebook dir."""
names = glob.glob(os.path.join(self.notebook_dir, path,
'*' + self.filename_ext))
names = glob.glob(self.get_os_path('*'+self.filename_ext, path))
names = [os.path.basename(name)
for name in names]
return names

View File

@ -190,6 +190,7 @@ default_handlers = [
(r"api/notebooks/%s/checkpoints" % _notebook_path_regex, NotebookCheckpointsHandler),
(r"api/notebooks/%s/checkpoints/%s" % (_notebook_path_regex, _checkpoint_id_regex),
ModifyNotebookCheckpointsHandler),
(r"api/notebooks/%s/" % _notebook_path_regex, NotebookHandler),
(r"api/notebooks/%s" % _notebook_path_regex, NotebookHandler),
(r"api/notebooks/", NotebookRootRedirect),
(r"api/notebooks", NotebookRootHandler),

View File

@ -52,14 +52,8 @@ var IPython = (function (IPython) {
MenuBar.prototype.notebookPath = function() {
var path = $('body').data('notebookPath');
if (path != 'None') {
if (path[path.length-1] != '/') {
path = path.substring(0,path.length);
};
return path;
} else {
return '';
}
path = decodeURIComponent(path);
return path
};
MenuBar.prototype.style = function () {
@ -81,7 +75,7 @@ var IPython = (function (IPython) {
IPython.notebook.new_notebook();
});
this.element.find('#open_notebook').click(function () {
window.open(that.baseProjectUrl() + 'tree/' + that.notebookPath());
window.open(that.baseProjectUrl() + 'tree' + that.notebookPath());
});
this.element.find('#copy_notebook').click(function () {
IPython.notebook.copy_notebook();
@ -89,13 +83,13 @@ var IPython = (function (IPython) {
});
this.element.find('#download_ipynb').click(function () {
var notebook_name = IPython.notebook.get_notebook_name();
var url = that.baseProjectUrl() + 'api/notebooks/' + that.notebookPath() +
var url = that.baseProjectUrl() + 'api/notebooks' + that.notebookPath() +
notebook_name + '?format=json'+ '&download=True';
window.location.assign(url);
});
this.element.find('#download_py').click(function () {
var notebook_name = IPython.notebook.get_notebook_name();
var url = that.baseProjectUrl() + 'api/notebooks/' + that.notebookPath() +
var url = that.baseProjectUrl() + 'api/notebooks' + that.notebookPath() +
notebook_name + '?format=py' + '&download=True';
window.location.assign(url);
});

View File

@ -29,14 +29,7 @@ var IPython = (function (IPython) {
NotebookList.prototype.notebookPath = function() {
var path = $('body').data('notebookPath');
path = decodeURIComponent(path);
if (path != "") {
if (path[path.length-1] != '/') {
path = path.substring(0,path.length);
};
return path;
} else {
return path;
};
return path;
};
NotebookList.prototype.url_name = function(name){
@ -147,7 +140,7 @@ var IPython = (function (IPython) {
},this)
};
var url = this.baseProjectUrl() + 'api/notebooks/' + this.notebookPath();
var url = this.baseProjectUrl() + 'api/notebooks' + this.notebookPath();
$.ajax(url, settings);
};
@ -209,7 +202,7 @@ var IPython = (function (IPython) {
item.data('path', path);
item.find(".item_name").text(nbname);
item.find("a.item_link")
.attr('href', this.baseProjectUrl() + "notebooks/" + this.notebookPath() + nbname + ".ipynb")
.attr('href', this.baseProjectUrl() + "notebooks" + this.notebookPath() + nbname + ".ipynb")
.attr('target','_blank');
};
@ -280,7 +273,7 @@ var IPython = (function (IPython) {
parent_item.remove();
}
};
var url = notebooklist.baseProjectUrl() + 'api/notebooks/' + notebooklist.notebookPath() + nbname + '.ipynb';
var url = notebooklist.baseProjectUrl() + 'api/notebooks' + notebooklist.notebookPath() + nbname + '.ipynb';
$.ajax(url, settings);
}
},
@ -347,10 +340,10 @@ var IPython = (function (IPython) {
dataType : "json",
success:$.proxy(function (data, status, xhr){
notebook_name = data.name;
window.open(this.baseProjectUrl() +'notebooks/' + this.notebookPath()+ notebook_name);
window.open(this.baseProjectUrl() +'notebooks' + this.notebookPath()+ notebook_name, '_blank');
}, this)
};
var url = this.baseProjectUrl() + 'notebooks/' + path;
var url = this.baseProjectUrl() + 'notebooks' + path;
$.ajax(url,settings);
};

View File

@ -31,7 +31,7 @@ class ProjectDashboardHandler(IPythonHandler):
self.write(self.render_template('tree.html',
project=self.project,
project_component=self.project.split('/'),
notebook_path= "''"
notebook_path= "/"
))
@ -41,7 +41,7 @@ class ProjectPathDashboardHandler(IPythonHandler):
def get(self, notebook_path):
nbm = self.notebook_manager
name, path = nbm.named_notebook_path(notebook_path)
if name != None:
if name is not None:
# ends with .ipynb
self.redirect(self.base_project_url + 'notebooks' + path + name)
else:
@ -49,7 +49,7 @@ class ProjectPathDashboardHandler(IPythonHandler):
path = nbm.url_encode(path)
self.write(self.render_template('tree.html',
project=project,
project_component=project.split('/'),
project_component=project.split('/')[:-1],
notebook_path=path,
notebook_name=name))
@ -65,7 +65,7 @@ class TreePathRedirectHandler(IPythonHandler):
@web.authenticated
def get(self, notebook_path):
url = self.base_project_url + 'tree/'+ notebook_path
url = self.base_project_url + 'tree/'+ notebook_path+'/'
self.redirect(url)
class ProjectRedirectHandler(IPythonHandler):
@ -84,8 +84,8 @@ class ProjectRedirectHandler(IPythonHandler):
_notebook_path_regex = r"(?P<notebook_path>.+)"
default_handlers = [
(r"/tree/%s/" % _notebook_path_regex, TreePathRedirectHandler),
(r"/tree/%s" % _notebook_path_regex, ProjectPathDashboardHandler),
(r"/tree/%s/" % _notebook_path_regex, ProjectPathDashboardHandler),
(r"/tree/%s" % _notebook_path_regex, TreePathRedirectHandler),
(r"/tree", ProjectDashboardHandler),
(r"/tree/", TreeRedirectHandler),
(r"/", ProjectRedirectHandler)