Skip to content

Commit

Permalink
Enable adding a message using BANNER_HTML env var
Browse files Browse the repository at this point in the history
  • Loading branch information
prihoda committed Apr 3, 2022
1 parent 917c493 commit 785c56b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
5 changes: 4 additions & 1 deletion biophi/common/web/app_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@

# Show newsletter popup at the bottom of landing page
# using provided user/newsletter ID (something like c7bcd0367a4cdbbfe2ef413ff/c5b4d513538dcdb730f72a9db)
MAILCHIMP_NEWSLETTER = os.environ.get('MAILCHIMP_NEWSLETTER')
MAILCHIMP_NEWSLETTER = os.environ.get('MAILCHIMP_NEWSLETTER')

# Optional banner HTML (will not be sanitized!)
BANNER_HTML = os.environ.get('BANNER_HTML')
13 changes: 13 additions & 0 deletions biophi/common/web/static/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@
color: rgba(255,255,255,.90);
}

.nav-custom-banner {
padding: 0.5rem 1rem;
color: white;
}

.nav-custom-banner a{
color: #a194f1;
text-decoration: underline;
}
.nav-custom-banner a:hover{
color: #c5bcff;
}

#header {
background-position: center 80%;
background-size: cover;
Expand Down
3 changes: 3 additions & 0 deletions biophi/common/web/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
</div>
</div>
<div class="d-flex navbar-nav">
{% if BANNER_HTML %}
<span class="nav-custom-banner">{{ BANNER_HTML | safe }}</span>
{% endif %}
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#helpModal">Help</a>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions biophi/common/web/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
app.jinja_env.globals.update(sorted=sorted)
app.jinja_env.globals.update(min=min)
app.jinja_env.globals.update(max=max)
app.jinja_env.globals.update(BANNER_HTML=app.config['BANNER_HTML'])

app.register_blueprint(biophi_humanization, url_prefix='/humanization')

Expand Down

0 comments on commit 785c56b

Please sign in to comment.