Adding config element for alert message in navbar (#938)

This commit is contained in:
Maxime Beauchemin 2016-08-12 23:40:24 -07:00 committed by GitHub
parent e243a14c64
commit 1b9458dcf0
4 changed files with 18 additions and 1 deletions

View File

@ -202,3 +202,8 @@ div.widget .slice_container {
.alert a:not(.close) {
color: gray !important;
}
.navbar .alert {
padding: 5px 10px;
margin-top: 15px;
}

View File

@ -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

View File

@ -180,6 +180,11 @@ BACKUP_COUNT = 30
# 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

View File

@ -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>