Skip to content

Commit

Permalink
make logo redirection dependent on current path
Browse files Browse the repository at this point in the history
  • Loading branch information
giohappy committed Feb 2, 2022
1 parent 6b442df commit 1572fc5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load static %}
{% load get_menu_json %}
{% load catalogue_urls %}
{% get_user_menu as USER_MENU %}

{% block extra_style %}
Expand All @@ -11,7 +12,7 @@
{% block left_menu %}
<ul class="gn-menu-list">
<li>
<a href="{% block logo_href %}#{% endblock %}">
<a href="{% block logo_href %}{% catalogue_home %}{% endblock %}">
{% if custom_theme.logo and custom_theme.logo.url %}
<img src="{{ custom_theme.logo.url }}">
{% else %}
Expand Down
19 changes: 19 additions & 0 deletions geonode_mapstore_client/templatetags/catalogue_urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os
import logging

from django import template

logger = logging.getLogger(__name__)
register = template.Library()

@register.simple_tag(takes_context=True)
def catalogue_home(context):
if context and 'request' in context:
current_path = context['request'].path
if current_path == '/':
return "/"
elif current_path.find('/catalogue') == 0:
return "#"
else:
return "/catalogue/#"
return ""

0 comments on commit 1572fc5

Please sign in to comment.