Skip to content

Commit

Permalink
Update to better support theming with any or all values. Update to su…
Browse files Browse the repository at this point in the history
…pport full and relative logo urls.
  • Loading branch information
jbouder committed May 14, 2024
1 parent c381523 commit f660ab6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 5 additions & 1 deletion self-registration/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ def assign_user_to_group(user, group_name):


def get_theme():
return config.get("theme", DEFAULT_THEME)
theme = config.get("theme", {})
if theme:
return {**DEFAULT_THEME, **theme}
else:
return DEFAULT_THEME


def get_template_context(request: Request, error_message: str = None):
Expand Down
14 changes: 11 additions & 3 deletions self-registration/app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,25 @@
<head>
<title>Self Registration</title>
<script src="https://cdn.tailwindcss.com"></script>
{% if favicon.startswith('/') %}
<link rel="icon" type="image/x-icon" href="{{ url_prefix }}{{ favicon }}" />
{% else %}
<link rel="icon" type="image/x-icon" href="{{ favicon }}" />
{% endif %}
<style type="text/css">
{% include 'styles.css' %}
</style>
{% block head %}{% endblock %}
</head>
<body>
<header class="flex content-center">
<a href="{{ url_prefix }}"
><img src="{{ url_prefix }}{{ logo }}" alt="logo"
/></a>
<a href="{{ url_prefix }}">
{% if logo.startswith('/') %}
<img src="{{ url_prefix }}{{ logo }}" alt="logo" />
{% else %}
<img src="{{ logo }}" alt="logo" />
{% endif %}
</a>
</header>
<div class="container flex justify-center">
{% block content %}{% endblock %}
Expand Down

0 comments on commit f660ab6

Please sign in to comment.