Skip to content

Commit

Permalink
Adding config element for alert message in navbar (#938)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored Aug 13, 2016
1 parent e243a14 commit 1b9458d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions caravel/assets/stylesheets/caravel.css
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,8 @@ div.widget .slice_container {
.alert a:not(.close) {
color: gray !important;
}

.navbar .alert {
padding: 5px 10px;
margin-top: 15px;
}
1 change: 0 additions & 1 deletion caravel/bin/caravel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ from __future__ import unicode_literals
import logging
from datetime import datetime
from subprocess import Popen
import textwrap

from flask_migrate import MigrateCommand
from flask_script import Manager
Expand Down
5 changes: 5 additions & 0 deletions caravel/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@
# Set this API key to enable Mapbox visualizations
MAPBOX_API_KEY = ""

# If defined, shows this text in an alert-warning box in the navbar
# one example use case may be "STAGING" to make it clear that this is
# not the production version of the site.
WARNING_MSG = None


try:
from caravel_config import * # noqa
Expand Down
8 changes: 8 additions & 0 deletions caravel/templates/appbuilder/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
{% include 'appbuilder/navbar_menu.html' %}
</ul>
<ul class="nav navbar-nav navbar-right">
{% set WARNING_MSG = appbuilder.app.config.get('WARNING_MSG') %}
{% if WARNING_MSG %}
<li>
<div class="alert alert-danger" role="alert">
{{ WARNING_MSG | safe }}
</div>
</li>
{% endif %}
<li><a href="https://github.com/airbnb/caravel" title="Caravel's Github">
<i class="fa fa-github fa-lg"></i></a>
</li>
Expand Down

0 comments on commit 1b9458d

Please sign in to comment.