Skip to content

Commit

Permalink
Add voila style to tree page (#1385)
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Aug 25, 2023
1 parent 68f6985 commit e854c30
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 3 additions & 1 deletion share/jupyter/voila/templates/lab/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
{%- endblock html_head_js -%}

{%- block notebook_css -%}
{{ resources.include_js("static/voila-style.js") }}
{% if frontend == "voila" %}
{{ resources.include_js("static/voila-style.js") }}
{% endif %}

{{ spinner.css() }}

Expand Down
3 changes: 3 additions & 0 deletions share/jupyter/voila/templates/lab/tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{% block stylesheets %}
{{ super() }}

{% if frontend == "voila" %}
{{ resources.include_js("static/voila-style.js") }}
{% endif %}
<style>
body {
background-color: var(--jp-layout-color0);
Expand Down
4 changes: 3 additions & 1 deletion share/jupyter/voila/templates/reveal/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
{%- block notebook_css -%}
{{ resources.include_css("static/materialcolors.css") }}
{{ resources.include_css("static/labvariables.css") }}
{{ resources.include_js("static/voila-style.js") }}
{% if frontend == "voila" %}
{{ resources.include_js("static/voila-style.js") }}
{% endif %}

{{ spinner.css() }}

Expand Down
9 changes: 8 additions & 1 deletion voila/tornado/treehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
from tornado import web

from ..treehandler import VoilaTreeHandler
from ..utils import get_page_config, get_server_root_dir
from ..utils import (
create_include_assets_functions,
get_page_config,
get_server_root_dir,
)


class TornadoVoilaTreeHandler(VoilaTreeHandler):
Expand Down Expand Up @@ -64,6 +68,8 @@ def allowed_content(content):
page_config["frontend"] = "voila"
page_config["query"] = self.request.query
template_name = "tree-lab.html" if not classic_tree else "tree.html"

resources = create_include_assets_functions(template_name, self.base_url)
self.write(
self.render_template(
template_name,
Expand All @@ -78,6 +84,7 @@ def allowed_content(content):
query=self.request.query,
page_config=page_config,
theme=theme_arg,
resources=resources,
)
)
elif file_exists:
Expand Down

0 comments on commit e854c30

Please sign in to comment.