##// END OF EJS Templates
Nice dashboard page titles like /.../examples/notebooks/
Brian E. Granger -
Show More
@@ -1,6 +1,6 b''
1 {% extends "page.html" %}
1 {% extends "page.html" %}
2
2
3 {% block title %}IPython Dashboard{% endblock %}
3 {% block title %}{{page_title}}{% endblock %}
4
4
5
5
6 {% block stylesheet %}
6 {% block stylesheet %}
@@ -39,6 +39,18 b' class TreeHandler(IPythonHandler):'
39 breadcrumbs.append((link, comps[i]))
39 breadcrumbs.append((link, comps[i]))
40 return breadcrumbs
40 return breadcrumbs
41
41
42 def generate_page_title(self, path):
43 comps = path.split('/')
44 if len(comps) > 3:
45 for i in range(len(comps)-2):
46 comps.pop(0)
47 comps.insert(0, '...')
48 page_title = url_escape(url_path_join(*comps))
49 if page_title:
50 return '/'+page_title+'/'
51 else:
52 return '/'
53
42 @web.authenticated
54 @web.authenticated
43 def get(self, path='', name=None):
55 def get(self, path='', name=None):
44 path = path.strip('/')
56 path = path.strip('/')
@@ -55,9 +67,10 b' class TreeHandler(IPythonHandler):'
55 # no such directory, 404
67 # no such directory, 404
56 raise web.HTTPError(404)
68 raise web.HTTPError(404)
57 breadcrumbs = self.generate_breadcrumbs(path)
69 breadcrumbs = self.generate_breadcrumbs(path)
70 page_title = self.generate_page_title(path)
58 self.write(self.render_template('tree.html',
71 self.write(self.render_template('tree.html',
59 project=self.project_dir,
72 project=self.project_dir,
60 tree_url_path=path,
73 page_title=page_title,
61 notebook_path=path,
74 notebook_path=path,
62 breadcrumbs=breadcrumbs
75 breadcrumbs=breadcrumbs
63 ))
76 ))
General Comments 0
You need to be logged in to leave comments. Login now