Skip to content

Commit 0114baa

Browse files
committed
Branding: logo
1 parent 187933b commit 0114baa

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed
Binary file not shown.
Binary file not shown.

caterva2/services/sub.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,20 @@ def url(path: str) -> str:
500500
return f"{settings.urlbase}/{path}"
501501

502502

503+
def brand_logo():
504+
path = "media/brand/logo.webp"
505+
if (BASE_DIR / path).exists():
506+
return url(path)
507+
508+
return url("static/logo-caterva2-horizontal-small.webp")
509+
510+
503511
templates = Jinja2Templates(directory=BASE_DIR / "templates")
504512
templates.env.filters["filesizeformat"] = custom_filesizeformat
505513
templates.env.globals["url"] = url
514+
templates.env.globals["brand"] = {
515+
"logo": brand_logo(),
516+
}
506517

507518

508519
# Add CSS/JS to templates namespace
@@ -2492,6 +2503,7 @@ async def jupyter_heartbeat():
24922503
#
24932504

24942505
app.mount("/static", StaticFiles(directory=BASE_DIR / "static"), name="static")
2506+
app.mount("/media", StaticFiles(directory=BASE_DIR / "media"), name="media")
24952507

24962508

24972509
#

caterva2/services/templates/base_anon.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<body class="vh-100 d-flex align-items-center">
1212
<main class="card m-auto" style="width: 450px" id="page-login">
1313
<div class="card-body">
14-
<img src="{{ url('static/logo-caterva2-horizontal-small.png') }}" alt="Caterva2 logo" id="logo" class="mb-4">
14+
<img src="{{ brand.logo }}" alt="Caterva2 logo" id="logo" class="mb-4">
1515
{% block main %}
1616
{% endblock %}
1717
</div>

caterva2/services/templates/root_list.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<a href="{{ url('') }}">
2-
<img src="{{ url('static/logo-caterva2-horizontal-small.png') }}" alt="Caterva2 logo" id="logo">
1+
<a href="{{ url('') }}" class="mx-2">
2+
<img src="{{ brand.logo }}" alt="Caterva2 logo" id="logo">
33
</a>
44

55
<form hx-get="{{ url('htmx/path-list/') }}"

0 commit comments

Comments
 (0)