mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
Nice dashboard page titles like /.../examples/notebooks/
This commit is contained in:
parent
6ac7f6c2b4
commit
378b18b2fb
@ -1,6 +1,6 @@
|
||||
{% extends "page.html" %}
|
||||
|
||||
{% block title %}IPython Dashboard{% endblock %}
|
||||
{% block title %}{{page_title}}{% endblock %}
|
||||
|
||||
|
||||
{% block stylesheet %}
|
||||
|
@ -39,6 +39,18 @@ class TreeHandler(IPythonHandler):
|
||||
breadcrumbs.append((link, comps[i]))
|
||||
return breadcrumbs
|
||||
|
||||
def generate_page_title(self, path):
|
||||
comps = path.split('/')
|
||||
if len(comps) > 3:
|
||||
for i in range(len(comps)-2):
|
||||
comps.pop(0)
|
||||
comps.insert(0, '...')
|
||||
page_title = url_escape(url_path_join(*comps))
|
||||
if page_title:
|
||||
return '/'+page_title+'/'
|
||||
else:
|
||||
return '/'
|
||||
|
||||
@web.authenticated
|
||||
def get(self, path='', name=None):
|
||||
path = path.strip('/')
|
||||
@ -55,9 +67,10 @@ class TreeHandler(IPythonHandler):
|
||||
# no such directory, 404
|
||||
raise web.HTTPError(404)
|
||||
breadcrumbs = self.generate_breadcrumbs(path)
|
||||
page_title = self.generate_page_title(path)
|
||||
self.write(self.render_template('tree.html',
|
||||
project=self.project_dir,
|
||||
tree_url_path=path,
|
||||
page_title=page_title,
|
||||
notebook_path=path,
|
||||
breadcrumbs=breadcrumbs
|
||||
))
|
||||
|
Loading…
Reference in New Issue
Block a user