Permalink
Browse files

Adding base_project_url and base_kernel_url as HTML data attribs.

* Also saving the notebook_id using that as well.
  • Loading branch information...
1 parent 71d3d18 commit 9ba28dfd54e8b29c68dbc930c8116c6a789cdf0e @ellisonbg ellisonbg committed with Sep 6, 2011
@@ -57,7 +57,8 @@ class NBBrowserHandler(AuthenticatedHandler):
def get(self):
nbm = self.application.notebook_manager
project = nbm.notebook_dir
- self.render('nbbrowser.html', project=project)
+ self.render('nbbrowser.html', project=project,
+ base_project_url=u'/', base_kernel_url=u'/')
class LoginHandler(AuthenticatedHandler):
def get(self):
@@ -75,7 +76,8 @@ class NewHandler(AuthenticatedHandler):
@web.authenticated
def get(self):
notebook_id = self.application.notebook_manager.new_notebook()
- self.render('notebook.html', notebook_id=notebook_id)
+ self.render('notebook.html', notebook_id=notebook_id,
+ base_project_url=u'/', base_kernel_url=u'/')
class NamedNotebookHandler(AuthenticatedHandler):
@@ -84,7 +86,8 @@ def get(self, notebook_id):
nbm = self.application.notebook_manager
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)
+ self.render('notebook.html', notebook_id=notebook_id,
+ base_project_url=u'/', base_kernel_url=u'/')
#-----------------------------------------------------------------------------
@@ -87,7 +87,7 @@ var IPython = (function (IPython) {
SaveWidget.prototype.get_notebook_id = function () {
- return this.element.find('span#notebook_id').text()
+ return $('body').data('notebookId');
};
@@ -17,7 +17,7 @@
</head>
-<body>
+<body 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>
@@ -47,13 +47,13 @@
</head>
-<body onload='CheckMathJax();'>
+<body data-base-project-url={{base_project_url}} data-base-kernel-url={{base_kernel_url}}
+ data-notebook-id={{notebook_id}} onload='CheckMathJax();'>
<div id="header">
<span id="ipython_notebook"><h1>IPython Notebook</h1></span>
<span id="save_widget">
<input type="text" id="notebook_name" size="20"></textarea>
- <span id="notebook_id" style="display:none">{{notebook_id}}</span>
<button id="save_notebook"><u>S</u>ave</button>
</span>
<span id="quick_help_area">

0 comments on commit 9ba28df

Please sign in to comment.