From 255772cfad6ee6c21216ce2e074bdb633cb10df5 Mon Sep 17 00:00:00 2001 From: Eric Charles Date: Tue, 25 Apr 2023 18:50:17 +0200 Subject: [PATCH] Add show_banner trait to control the banner display (#243) --- docs/environment.yml | 2 +- docs/source/frontend_config.rst | 9 +++++++++ nbclassic/notebookapp.py | 8 ++++++++ nbclassic/static/base/js/namespace.js | 2 +- nbclassic/templates/page.html | 2 ++ setup.cfg | 2 +- 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/environment.yml b/docs/environment.yml index cb88eae3f..f3550267b 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -20,4 +20,4 @@ dependencies: - sphinxcontrib_github_alt - ipython_genutils - jupyter_server>=1.8 - - notebook_shim>=0.1.0 + - notebook_shim>=0.2.3 diff --git a/docs/source/frontend_config.rst b/docs/source/frontend_config.rst index afcef9ab5..b0430ad42 100644 --- a/docs/source/frontend_config.rst +++ b/docs/source/frontend_config.rst @@ -89,3 +89,12 @@ taking various value depending on the page where the configuration is issued. ``
`` can take various values like ``notebook``, ``tree``, and ``editor``. A ``common`` section contains configuration settings shared by all pages. + + +Persisting configuration settings +--------------------------------- + +A banner might be shown to users to inform them about news or updates. This +banner can be hidden launching the server with the show_banner trait.:: + + jupyter notebook --NotebookApp.show_banner=False diff --git a/nbclassic/notebookapp.py b/nbclassic/notebookapp.py index e6cbd546a..bcf947eba 100644 --- a/nbclassic/notebookapp.py +++ b/nbclassic/notebookapp.py @@ -120,6 +120,13 @@ class NotebookApp( default_url = Unicode("%s/tree" % nbclassic_path()).tag(config=True) + show_banner = Bool( + True, + help="""Whether the banner is displayed on the page. + By default, the banner is displayed. + """ + ).tag(config=True) + # Override the default open_Browser trait in ExtensionApp, # setting it to True. open_browser = Bool( @@ -184,6 +191,7 @@ def _prepare_templates(self): base_dir, 'nbclassic/i18n'), fallback=True) self.jinja2_env.install_gettext_translations(nbui, newstyle=False) self.jinja2_env.globals.update(nbclassic_path=nbclassic_path) + self.jinja2_env.globals.update(show_banner=self.show_banner) def _link_jupyter_server_extension(self, serverapp): # Monkey-patch Jupyter Server's and nbclassic's static path list to include diff --git a/nbclassic/static/base/js/namespace.js b/nbclassic/static/base/js/namespace.js index b3e9d3a19..a791249f4 100644 --- a/nbclassic/static/base/js/namespace.js +++ b/nbclassic/static/base/js/namespace.js @@ -73,7 +73,7 @@ define(function(){ // tree jglobal('SessionList','tree/js/sessionlist'); - Jupyter.version = "0.5.5"; + Jupyter.version = "0.6.0.dev0"; Jupyter._target = '_blank'; return Jupyter; diff --git a/nbclassic/templates/page.html b/nbclassic/templates/page.html index 7ad964739..8b1b1a837 100644 --- a/nbclassic/templates/page.html +++ b/nbclassic/templates/page.html @@ -138,6 +138,7 @@