Skip to content

Commit

Permalink
title is no longer required in frontpage.json
Browse files Browse the repository at this point in the history
As a result, the jumbotron is completely hidden if none of
title, subtitle, text are set and show_input is False
  • Loading branch information
dbdean committed Oct 15, 2017
1 parent 8f08906 commit 8ce7f52
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions nbviewer/frontpage.schema.json
Expand Up @@ -29,6 +29,5 @@
]
}
}
},
"required": ["title"]
}
}
4 changes: 2 additions & 2 deletions nbviewer/handlers.py
Expand Up @@ -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', [])))

Expand Down
8 changes: 4 additions & 4 deletions nbviewer/templates/index.html
@@ -1,11 +1,10 @@
{% extends "layout.html" %}

{% block body %}
{% if title or subtitle or text or show_input %}
<header class="jumbotron masthead">
<h1>{{ title }}</h1>
{% if subtitle %}
<h2>{{ subtitle }}</h2>
{% endif %}
{% if title %}<h1>{{ title }}</h1>{% endif %}
{% if subtitle %}<h2>{{ subtitle }}</h2>{% endif %}
{% if text %}
{{ text | markdown | safe }}
{% endif %}
Expand All @@ -31,6 +30,7 @@ <h2>{{ subtitle }}</h2>
</div>
{% endif %}
</header>
{% endif %}

{% for section in sections %}
<section>
Expand Down

0 comments on commit 8ce7f52

Please sign in to comment.