Skip to content

Commit 785c56b

Browse files
committed
Enable adding a message using BANNER_HTML env var
1 parent 917c493 commit 785c56b

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

biophi/common/web/app_config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@
1818

1919
# Show newsletter popup at the bottom of landing page
2020
# using provided user/newsletter ID (something like c7bcd0367a4cdbbfe2ef413ff/c5b4d513538dcdb730f72a9db)
21-
MAILCHIMP_NEWSLETTER = os.environ.get('MAILCHIMP_NEWSLETTER')
21+
MAILCHIMP_NEWSLETTER = os.environ.get('MAILCHIMP_NEWSLETTER')
22+
23+
# Optional banner HTML (will not be sanitized!)
24+
BANNER_HTML = os.environ.get('BANNER_HTML')

biophi/common/web/static/main.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@
1515
color: rgba(255,255,255,.90);
1616
}
1717

18+
.nav-custom-banner {
19+
padding: 0.5rem 1rem;
20+
color: white;
21+
}
22+
23+
.nav-custom-banner a{
24+
color: #a194f1;
25+
text-decoration: underline;
26+
}
27+
.nav-custom-banner a:hover{
28+
color: #c5bcff;
29+
}
30+
1831
#header {
1932
background-position: center 80%;
2033
background-size: cover;

biophi/common/web/templates/layout.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
</div>
4242
</div>
4343
<div class="d-flex navbar-nav">
44+
{% if BANNER_HTML %}
45+
<span class="nav-custom-banner">{{ BANNER_HTML | safe }}</span>
46+
{% endif %}
4447
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#helpModal">Help</a>
4548
</div>
4649
</div>

biophi/common/web/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
app.jinja_env.globals.update(sorted=sorted)
3434
app.jinja_env.globals.update(min=min)
3535
app.jinja_env.globals.update(max=max)
36+
app.jinja_env.globals.update(BANNER_HTML=app.config['BANNER_HTML'])
3637

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

0 commit comments

Comments
 (0)