Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup nbextension #176

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion etc/jupyter/nbconfig/notebook.d/voila.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"load_extensions": {
"voila/nbextension": true
"voila/extension": true
}
}
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ def run(self):

data_files = [
('etc/jupyter/jupyter_server_config.d', ['etc/jupyter/jupyter_server_config.d/voila.json']),
('etc/jupyter/jupyter_notebook_config.d', ['etc/jupyter/jupyter_notebook_config.d/voila.json'])
('etc/jupyter/jupyter_notebook_config.d', ['etc/jupyter/jupyter_notebook_config.d/voila.json']),
('etc/jupyter/nbconfig/notebook.d', ['etc/jupyter/nbconfig/notebook.d/voila.json']),
('share/jupyter/nbextensions/voila', ['voila/static/extension.js'])
]

# Add all the templates
Expand Down
2 changes: 1 addition & 1 deletion voila/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def _jupyter_nbextension_paths():
section="notebook",
src="static",
dest="voila",
require="voila/nbextension")]
require="voila/extension")]
4 changes: 1 addition & 3 deletions voila/static/nbextension.js → voila/static/extension.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
define(['jquery', 'base/js/namespace'], function($, Jupyter) {
"use strict";
var open_voila = function() {
let notebook_path = Jupyter.notebook.notebook_path;
let voila_path = notebook_path.slice(0, notebook_path.length-6); // without .ipynb
let voila_url = Jupyter.notebook.base_url + "voila/render/" + voila_path;
let voila_url = Jupyter.notebook.base_url + "voila/render/" + Jupyter.notebook.notebook_path;
window.open(voila_url)

}
Expand Down