From 8ce7f52edb7fc20e726a9a51c717598a0d393aef Mon Sep 17 00:00:00 2001 From: David Dean Date: Sun, 15 Oct 2017 19:27:31 +1000 Subject: [PATCH] title is no longer required in frontpage.json As a result, the jumbotron is completely hidden if none of title, subtitle, text are set and show_input is False --- nbviewer/frontpage.schema.json | 3 +-- nbviewer/handlers.py | 4 ++-- nbviewer/templates/index.html | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/nbviewer/frontpage.schema.json b/nbviewer/frontpage.schema.json index ed3c7282..b8bc8abf 100644 --- a/nbviewer/frontpage.schema.json +++ b/nbviewer/frontpage.schema.json @@ -29,6 +29,5 @@ ] } } - }, - "required": ["title"] + } } diff --git a/nbviewer/handlers.py b/nbviewer/handlers.py index 6d2249b3..9a5fdda3 100644 --- a/nbviewer/handlers.py +++ b/nbviewer/handlers.py @@ -35,9 +35,9 @@ class IndexHandler(BaseHandler): def get(self): self.finish(self.render_template( 'index.html', - title=self.frontpage_setup['title'], + title=self.frontpage_setup.get('title', None), subtitle=self.frontpage_setup.get('subtitle', None), - text=self.frontpage_setup.get('text',None), + text=self.frontpage_setup.get('text', None), show_input=self.frontpage_setup.get('show_input', True), sections=self.frontpage_setup.get('sections', []))) diff --git a/nbviewer/templates/index.html b/nbviewer/templates/index.html index c076f08e..a535338f 100644 --- a/nbviewer/templates/index.html +++ b/nbviewer/templates/index.html @@ -1,11 +1,10 @@ {% extends "layout.html" %} {% block body %} + {% if title or subtitle or text or show_input %}
-

{{ title }}

- {% if subtitle %} -

{{ subtitle }}

- {% endif %} + {% if title %}

{{ title }}

{% endif %} + {% if subtitle %}

{{ subtitle }}

{% endif %} {% if text %} {{ text | markdown | safe }} {% endif %} @@ -31,6 +30,7 @@

{{ subtitle }}

{% endif %}
+ {% endif %} {% for section in sections %}