Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding config element for alert message in navbar #938

Merged
merged 1 commit into from
Aug 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ WARNING_MSG / NAV_BAR_WARNING_MSG



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