Adding data-project to the body data attribs.

This commit is contained in:
Brian E. Granger 2011-09-06 16:59:47 -07:00 committed by MinRK
parent c900979a80
commit 36e15cb5c2
3 changed files with 24 additions and 10 deletions

View File

@ -61,8 +61,10 @@ class NBBrowserHandler(AuthenticatedHandler):
def get(self):
nbm = self.application.notebook_manager
project = nbm.notebook_dir
self.render('nbbrowser.html', project=project,
base_project_url=u'/', base_kernel_url=u'/')
self.render(
'nbbrowser.html', project=project,
base_project_url=u'/', base_kernel_url=u'/'
)
class LoginHandler(AuthenticatedHandler):
@ -82,9 +84,14 @@ class NewHandler(AuthenticatedHandler):
@web.authenticated
def get(self):
notebook_id = self.application.notebook_manager.new_notebook()
self.render('notebook.html', notebook_id=notebook_id,
base_project_url=u'/', base_kernel_url=u'/')
nbm = self.application.notebook_manager
project = nbm.notebook_dir
notebook_id = nbm.new_notebook()
self.render(
'notebook.html', project=project,
notebook_id=notebook_id,
base_project_url=u'/', base_kernel_url=u'/'
)
class NamedNotebookHandler(AuthenticatedHandler):
@ -92,10 +99,14 @@ class NamedNotebookHandler(AuthenticatedHandler):
@web.authenticated
def get(self, notebook_id):
nbm = self.application.notebook_manager
project = nbm.notebook_dir
if not nbm.notebook_exists(notebook_id):
raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
self.render('notebook.html', notebook_id=notebook_id,
base_project_url=u'/', base_kernel_url=u'/')
self.render(
'notebook.html', project=project,
notebook_id=notebook_id,
base_project_url=u'/', base_kernel_url=u'/'
)
#-----------------------------------------------------------------------------

View File

@ -14,7 +14,8 @@
</head>
<body data-base-project-url={{base_project_url}} data-base-kernel-url={{base_kernel_url}}>
<body data-project={{project}} data-base-project-url={{base_project_url}}
data-base-kernel-url={{base_kernel_url}}>
<div id="header">
<span id="ipython_notebook"><h1>IPython Notebook</h1></span>

View File

@ -44,8 +44,10 @@
</head>
<body data-base-project-url={{base_project_url}} data-base-kernel-url={{base_kernel_url}}
data-notebook-id={{notebook_id}} onload='CheckMathJax();'>
<body onload='CheckMathJax();'
data-project={{project}} data-notebook-id={{notebook_id}}
data-base-project-url={{base_project_url}} data-base-kernel-url={{base_kernel_url}}
>
<div id="header">
<span id="ipython_notebook"><h1>IPython Notebook</h1></span>