Minor improvements

This commit is contained in:
2024-11-29 23:49:35 +01:00
parent 83444266cb
commit 005ea11011
2 changed files with 8 additions and 1 deletions

View File

@@ -4,8 +4,12 @@
Bookshelf Bookshelf
</a> </a>
<ul class="dropdown-menu" aria-labelledby="bookshelfDropdownMenuLink"> <ul class="dropdown-menu" aria-labelledby="bookshelfDropdownMenuLink">
{% if books_menu %}
<li><a class="dropdown-item" href="{% url 'books' %}">Books</a></li> <li><a class="dropdown-item" href="{% url 'books' %}">Books</a></li>
{% endif %}
{% if catalogs_menu %}
<li><a class="dropdown-item" href="{% url 'catalogs' %}">Catalogs</a></li> <li><a class="dropdown-item" href="{% url 'catalogs' %}">Catalogs</a></li>
{% endif %}
</ul> </ul>
</li> </li>
{% endif %} {% endif %}

View File

@@ -7,8 +7,11 @@ register = template.Library()
@register.inclusion_tag('bookshelf/bookshelf_menu.html') @register.inclusion_tag('bookshelf/bookshelf_menu.html')
def show_bookshelf_menu(): def show_bookshelf_menu():
# FIXME: Filter out unpublished books and catalogs?
return { return {
"bookshelf_menu": (Book.objects.exists() or Catalog.objects.exists()) "bookshelf_menu": (Book.objects.exists() or Catalog.objects.exists()),
"books_menu": Book.objects.exists(),
"catalogs_menu": Catalog.objects.exists(),
} }