[CHANGE] Only show theme selection if more than 1 theme is available

This commit is contained in:
Peter Pfeufer 2025-06-15 12:10:44 +02:00
parent a650f0730e
commit dd42c2b074
No known key found for this signature in database
2 changed files with 18 additions and 9 deletions

View File

@ -50,6 +50,7 @@
{% theme_select %}
</a>
</li>
{% theme_select %}
{% if user.is_superuser %}
<li><hr class="dropdown-divider"></li>

View File

@ -1,13 +1,21 @@
{% load i18n %}
<form action="{% url 'theme' %}?next={{ next|urlencode }}" method="post">
{% csrf_token %}
{% if themes|length > 1 %}
<li><h6 class="dropdown-header">{% translate "Theme" %}</h6></li>
<select name="theme" class="form-select" aria-label="" onchange="this.form.submit()">
<option selected>{% translate "Select Theme" %}</option>
<li>
<form class="dropdown-item" action="{% url 'theme' %}?next={{ next|urlencode }}" method="post">
{% csrf_token %}
{% for theme in themes %}
<option value="{{ theme.get_name }}"{% if selected_theme.name == theme.name %} selected="selected"{% endif %}>{{ theme.name }}</option>
{% endfor %}
</select>
</form>
<select name="theme" class="form-select" onchange="this.form.submit()">
<option selected>{% translate "Select Theme" %}</option>
{% for theme in themes %}
<option value="{{ theme.get_name }}"{% if selected_theme.name == theme.name %} selected="selected"{% endif %}>
{{ theme.name }}
</option>
{% endfor %}
</select>
</form>
</li>
{% endif %}