From c63b2834d26228f4bba5da1d811b232b38f05d74 Mon Sep 17 00:00:00 2001
From: Hangzhi Yu <hangzhi@protonmail.com>
Date: Sat, 8 Jan 2022 18:26:18 +0100
Subject: [PATCH] Add option for sidebar navigation to open entry in new tab

---
 CHANGELOG.rst                                     | 1 +
 aleksis/core/templates/core/partials/sidenav.html | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 1d173115f..a95e4c068 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -12,6 +12,7 @@ Unreleased
 Added
 ~~~~~
 
+* Add option to open entry in new tab for sidebar navigation menu.
 * Add preference for configuring the default phone number country code.
 * Admins recieve an mail for celery tasks with status "FAILURE"
 
diff --git a/aleksis/core/templates/core/partials/sidenav.html b/aleksis/core/templates/core/partials/sidenav.html
index 54df4fe73..9b3be9705 100644
--- a/aleksis/core/templates/core/partials/sidenav.html
+++ b/aleksis/core/templates/core/partials/sidenav.html
@@ -9,7 +9,7 @@
   {% for item in core_menu %}
     {% if not item.submenu %}
       <li class="{% if item.selected %} active {% endif %}">
-        <a class="truncate" href="{{ item.url }}">
+        <a class="truncate" {% if item.new_tab %} target="_blank" {% endif %} href="{{ item.url }}">
           {% if item.icon_class %}
             <i class="{{ item.icon_class }}"></i>
           {% elif item.icon %}
@@ -25,7 +25,7 @@
     {% endif %}
     {% if item.submenu %}
       <li class="bold {% if item.selected %} active {% endif %}">
-        <a class="collapsible-header waves-effect waves-primary truncate" href="{{ item.url|default:"#" }}">
+        <a class="collapsible-header waves-effect waves-primary truncate" {% if item.new_tab %} target="_blank" {% endif %} href="{{ item.url|default:"#" }}">
           {% if item.icon_class %}
             <i class="{{ item.icon_class }}"></i>
           {% elif item.icon %}
-- 
GitLab