##// END OF EJS Templates
Merge pull request #2218 from Carreau/new_redirect...
Brian E. Granger -
r8189:1ad91e6b merge
parent child Browse files
Show More
@@ -123,6 +123,14 b' def authenticate_unless_readonly(f, self, *args, **kwargs):'
123 else:
123 else:
124 return auth_f(self, *args, **kwargs)
124 return auth_f(self, *args, **kwargs)
125
125
126 def urljoin(*pieces):
127 """Join componenet of url into a relative url
128
129 Use to prevent double slash when joining subpath
130 """
131 striped = [s.strip('/') for s in pieces]
132 return '/'.join(s for s in striped if s)
133
126 #-----------------------------------------------------------------------------
134 #-----------------------------------------------------------------------------
127 # Top-level handlers
135 # Top-level handlers
128 #-----------------------------------------------------------------------------
136 #-----------------------------------------------------------------------------
@@ -267,17 +275,7 b' class NewHandler(AuthenticatedHandler):'
267 nbm = self.application.notebook_manager
275 nbm = self.application.notebook_manager
268 project = nbm.notebook_dir
276 project = nbm.notebook_dir
269 notebook_id = nbm.new_notebook()
277 notebook_id = nbm.new_notebook()
270 self.render(
278 self.redirect('/'+urljoin(self.application.ipython_app.base_project_url, notebook_id))
271 'notebook.html', project=project,
272 notebook_id=notebook_id,
273 base_project_url=self.application.ipython_app.base_project_url,
274 base_kernel_url=self.application.ipython_app.base_kernel_url,
275 kill_kernel=False,
276 read_only=False,
277 logged_in=self.logged_in,
278 login_available=self.login_available,
279 mathjax_url=self.application.ipython_app.mathjax_url,
280 )
281
279
282
280
283 class NamedNotebookHandler(AuthenticatedHandler):
281 class NamedNotebookHandler(AuthenticatedHandler):
@@ -663,17 +661,7 b' class NotebookCopyHandler(AuthenticatedHandler):'
663 nbm = self.application.notebook_manager
661 nbm = self.application.notebook_manager
664 project = nbm.notebook_dir
662 project = nbm.notebook_dir
665 notebook_id = nbm.copy_notebook(notebook_id)
663 notebook_id = nbm.copy_notebook(notebook_id)
666 self.render(
664 self.redirect('/'+urljoin(self.application.ipython_app.base_project_url, notebook_id))
667 'notebook.html', project=project,
668 notebook_id=notebook_id,
669 base_project_url=self.application.ipython_app.base_project_url,
670 base_kernel_url=self.application.ipython_app.base_kernel_url,
671 kill_kernel=False,
672 read_only=False,
673 logged_in=self.logged_in,
674 login_available=self.login_available,
675 mathjax_url=self.application.ipython_app.mathjax_url,
676 )
677
665
678
666
679 #-----------------------------------------------------------------------------
667 #-----------------------------------------------------------------------------
@@ -60,7 +60,6 b' $(document).ready(function () {'
60 IPython.layout_manager.do_resize();
60 IPython.layout_manager.do_resize();
61 $([IPython.events]).on('notebook_loaded.Notebook', function () {
61 $([IPython.events]).on('notebook_loaded.Notebook', function () {
62 IPython.layout_manager.do_resize();
62 IPython.layout_manager.do_resize();
63 IPython.save_widget.update_url();
64 })
63 })
65 IPython.notebook.load_notebook($('body').data('notebookId'));
64 IPython.notebook.load_notebook($('body').data('notebookId'));
66
65
@@ -120,15 +120,6 b' var IPython = (function (IPython) {'
120 };
120 };
121
121
122
122
123 SaveWidget.prototype.update_url = function () {
124 var notebook_id = IPython.notebook.get_notebook_id();
125 if (notebook_id !== null) {
126 var new_url = $('body').data('baseProjectUrl') + notebook_id;
127 window.history.replaceState({}, '', new_url);
128 };
129 };
130
131
132 SaveWidget.prototype.set_save_status = function (msg) {
123 SaveWidget.prototype.set_save_status = function (msg) {
133 this.element.find('span#save_status').html(msg);
124 this.element.find('span#save_status').html(msg);
134 }
125 }
General Comments 0
You need to be logged in to leave comments. Login now