Skip to content

Commit

Permalink
added ability to set custom logo in navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Nov 27, 2023
1 parent 31f9328 commit 977d282
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cookbook/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
{% if not request.user.is_authenticated or request.user.userpreference.theme == request.user.userpreference.TANDOOR %}
<a class="navbar-brand p-0 me-2 justify-content-center" href="{% base_path request 'base' %}"
aria-label="Tandoor">
<img class="brand-icon" src="{% static 'assets/brand_logo.png' %}" alt="Logo">
<img class="brand-icon" src="{% logo_url request %}" alt="Logo">
</a>
{% endif %}
{% endif %}
Expand All @@ -96,7 +96,7 @@
{% if not request.user.is_authenticated or request.user.userpreference.theme == request.user.userpreference.TANDOOR %}
<a class="navbar-brand p-0 me-2 justify-content-center" href="{% base_path request 'base' %}"
aria-label="Tandoor">
<img class="brand-icon" src="{% static 'assets/brand_logo.png' %}" alt="Logo">
<img class="brand-icon" src="{% logo_url request %}" alt="Logo">
</a>
{% endif %}
{% endif %}
Expand Down
8 changes: 8 additions & 0 deletions cookbook/templatetags/theming_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ def theme_url(request):
raise AttributeError


@register.simple_tag
def logo_url(request):
if request.user.is_authenticated and request.space.image:
return request.space.image.file.url
else:
return static('assets/brand_logo.png')


@register.simple_tag
def nav_color(request):
if not request.user.is_authenticated:
Expand Down

0 comments on commit 977d282

Please sign in to comment.