Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding base_project_url and base_kernel_url as HTML data attribs.

* Also saving the notebook_id using that as well.
  • Loading branch information...
commit 9ba28dfd54e8b29c68dbc930c8116c6a789cdf0e 1 parent 71d3d18
Brian E. Granger ellisonbg authored committed
9 IPython/frontend/html/notebook/handlers.py
@@ -57,7 +57,8 @@ class NBBrowserHandler(AuthenticatedHandler):
57 57 def get(self):
58 58 nbm = self.application.notebook_manager
59 59 project = nbm.notebook_dir
60   - self.render('nbbrowser.html', project=project)
  60 + self.render('nbbrowser.html', project=project,
  61 + base_project_url=u'/', base_kernel_url=u'/')
61 62
62 63 class LoginHandler(AuthenticatedHandler):
63 64 def get(self):
@@ -75,7 +76,8 @@ class NewHandler(AuthenticatedHandler):
75 76 @web.authenticated
76 77 def get(self):
77 78 notebook_id = self.application.notebook_manager.new_notebook()
78   - self.render('notebook.html', notebook_id=notebook_id)
  79 + self.render('notebook.html', notebook_id=notebook_id,
  80 + base_project_url=u'/', base_kernel_url=u'/')
79 81
80 82
81 83 class NamedNotebookHandler(AuthenticatedHandler):
@@ -84,7 +86,8 @@ def get(self, notebook_id):
84 86 nbm = self.application.notebook_manager
85 87 if not nbm.notebook_exists(notebook_id):
86 88 raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
87   - self.render('notebook.html', notebook_id=notebook_id)
  89 + self.render('notebook.html', notebook_id=notebook_id,
  90 + base_project_url=u'/', base_kernel_url=u'/')
88 91
89 92
90 93 #-----------------------------------------------------------------------------
2  IPython/frontend/html/notebook/static/js/savewidget.js
@@ -87,7 +87,7 @@ var IPython = (function (IPython) {
87 87
88 88
89 89 SaveWidget.prototype.get_notebook_id = function () {
90   - return this.element.find('span#notebook_id').text()
  90 + return $('body').data('notebookId');
91 91 };
92 92
93 93
2  IPython/frontend/html/notebook/templates/nbbrowser.html
@@ -17,7 +17,7 @@
17 17
18 18 </head>
19 19
20   -<body>
  20 +<body data-base-project-url={{base_project_url}} data-base-kernel-url={{base_kernel_url}}>
21 21
22 22 <div id="header">
23 23 <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
4 IPython/frontend/html/notebook/templates/notebook.html
@@ -47,13 +47,13 @@
47 47
48 48 </head>
49 49
50   -<body onload='CheckMathJax();'>
  50 +<body data-base-project-url={{base_project_url}} data-base-kernel-url={{base_kernel_url}}
  51 + data-notebook-id={{notebook_id}} onload='CheckMathJax();'>
51 52
52 53 <div id="header">
53 54 <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
54 55 <span id="save_widget">
55 56 <input type="text" id="notebook_name" size="20"></textarea>
56   - <span id="notebook_id" style="display:none">{{notebook_id}}</span>
57 57 <button id="save_notebook"><u>S</u>ave</button>
58 58 </span>
59 59 <span id="quick_help_area">

0 comments on commit 9ba28df

Please sign in to comment.
Something went wrong with that request. Please try again.