Skip to content

Commit

Permalink
Only add <hr> to options when they are any
Browse files Browse the repository at this point in the history
  • Loading branch information
pehala committed Nov 26, 2023
1 parent c7a381a commit 7a0ede9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion frontend/static/styles.sass
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,7 @@ p
background-color: #f5f5f5

.custom-link
color: $colDefault
color: $colDefault

.small-hr
height: 1px
5 changes: 2 additions & 3 deletions frontend/templates/base/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load sass_tags %}
{% load i18n %}
{% load menu %}
{% load menu_utils %}
{% load utils %}

{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
Expand Down Expand Up @@ -84,9 +84,8 @@
<input name="language" type=hidden value={{ locale.code }}>
</form>
{% endfor %}
<hr class="mt-2 mb-1">
<div class="d-flex flex-column">
{% block extra_options %}{% endblock %}
{% filter prefix:"<div><hr class='mt-2 mb-1 small-hr'></div>" %}{% block extra_options %}{% endblock %}{% endfilter %}
</div>
</div>
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tags for drawing the menu"""
from django import template
from django.template.defaultfilters import stringfilter

from tenants.utils import create_tenant_string

Expand All @@ -12,3 +13,10 @@ def draw_menu(context, key, use_tenant=False):
if use_tenant:
key = create_tenant_string(context.request.tenant, key)
return {"menu": context["menus"][key]}


@register.filter
@stringfilter
def prefix(value, args):
"""Adds prefix if value is not empty"""
return str(args) + value if value else value

0 comments on commit 7a0ede9

Please sign in to comment.