From 7b6ee0fbc86d9811d844b78b861ab8f706ddb7d9 Mon Sep 17 00:00:00 2001
From: Fredrik Jonsson <frjo@xdeb.org>
Date: Mon, 8 Jul 2024 17:54:45 +0200
Subject: [PATCH] Use correct perm check for Administration link in user menu.
 Use same icon for Administration button as in user menu (#4030)

---
 .../dashboard/contracting_dashboard.html      |  4 ++--
 .../dashboard/finance_dashboard.html          |  4 ++--
 .../templates/dashboard/staff_dashboard.html  |  4 ++--
 .../apply/users/templates/users/account.html  |  6 ++---
 hypha/templates/includes/user_menu.html       | 22 ++++++++++---------
 5 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/hypha/apply/dashboard/templates/dashboard/contracting_dashboard.html b/hypha/apply/dashboard/templates/dashboard/contracting_dashboard.html
index b6299cbac..f9e50d92a 100644
--- a/hypha/apply/dashboard/templates/dashboard/contracting_dashboard.html
+++ b/hypha/apply/dashboard/templates/dashboard/contracting_dashboard.html
@@ -10,8 +10,8 @@
 
         {% if perms.wagtailadmin.access_admin %}
             <a href="{% url 'wagtailadmin_home' %}" class="button button--primary">
-                {% heroicon_mini "wrench-screwdriver" size=20 class="mr-1 inline align-text-bottom" %}
-                {% trans "Admin" %}
+                {% heroicon_solid "cog-6-tooth" size=20 class="me-1 inline align-text-bottom" aria_hidden=true %}
+                {% trans "Administration" %}
             </a>
         {% endif %}
     {% endadminbar %}
diff --git a/hypha/apply/dashboard/templates/dashboard/finance_dashboard.html b/hypha/apply/dashboard/templates/dashboard/finance_dashboard.html
index 68f49e594..d4d55f759 100644
--- a/hypha/apply/dashboard/templates/dashboard/finance_dashboard.html
+++ b/hypha/apply/dashboard/templates/dashboard/finance_dashboard.html
@@ -10,8 +10,8 @@
 
         {% if perms.wagtailadmin.access_admin %}
             <a href="{% url 'wagtailadmin_home' %}" class="button button--primary">
-                {% heroicon_mini "wrench-screwdriver" size=20 class="mr-1 inline align-text-bottom" %}
-                {% trans "Admin" %}
+                {% heroicon_solid "cog-6-tooth" size=20 class="me-1 inline align-text-bottom" aria_hidden=true %}
+                {% trans "Administration" %}
             </a>
         {% endif %}
     {% endadminbar %}
diff --git a/hypha/apply/dashboard/templates/dashboard/staff_dashboard.html b/hypha/apply/dashboard/templates/dashboard/staff_dashboard.html
index 517b4af32..dea8429e5 100644
--- a/hypha/apply/dashboard/templates/dashboard/staff_dashboard.html
+++ b/hypha/apply/dashboard/templates/dashboard/staff_dashboard.html
@@ -15,8 +15,8 @@
 
         {% if perms.wagtailadmin.access_admin %}
             <a href="{% url 'wagtailadmin_home' %}" id="wagtail-admin-button" class="button button--primary">
-                {% heroicon_mini "wrench-screwdriver" size=20 class="mr-1 inline align-text-bottom" %}
-                {% trans "Admin" %}
+                {% heroicon_solid "cog-6-tooth" size=20 class="me-1 inline align-text-bottom" aria_hidden=true %}
+                {% trans "Administration" %}
             </a>
         {% endif %}
     {% endadminbar %}
diff --git a/hypha/apply/users/templates/users/account.html b/hypha/apply/users/templates/users/account.html
index b331d32e1..4b5ceb77d 100644
--- a/hypha/apply/users/templates/users/account.html
+++ b/hypha/apply/users/templates/users/account.html
@@ -11,7 +11,7 @@
         <span class="flex gap-4">
             {% if user.can_access_dashboard %}
                 <a href="{% url 'dashboard:dashboard' %}" class="button button--primary">
-                    {% heroicon_mini "squares-2x2" size=20 class="mr-1 inline align-text-bottom" %}
+                    {% heroicon_mini "squares-2x2" size=20 class="me-1 inline align-text-bottom" aria_hidden=true %}
                     {% trans "Go to my dashboard" %}
                 </a>
             {% else %}
@@ -28,8 +28,8 @@
             {% endif %}
             {% if perms.wagtailadmin.access_admin %}
                 <a href="{% url 'wagtailadmin_home' %}" id="wagtail-admin-button" class="button button--primary">
-                    {% heroicon_mini "wrench-screwdriver" size=20 class="mr-1 inline align-text-bottom" %}
-                    {% trans "Admin" %}
+                    {% heroicon_solid "cog-6-tooth" size=20 class="me-1 inline align-text-bottom" aria_hidden=true %}
+                    {% trans "Administration" %}
                 </a>
             {% endif %}
         </span>
diff --git a/hypha/templates/includes/user_menu.html b/hypha/templates/includes/user_menu.html
index 3ec7778b0..d135f7df9 100644
--- a/hypha/templates/includes/user_menu.html
+++ b/hypha/templates/includes/user_menu.html
@@ -53,16 +53,18 @@
                     {% heroicon_outline "flag" size=18 class="stroke-gray-500 inline group-hover:scale-110 group-hover:stroke-2 group-hover:stroke-dark-blue transition-transform" aria_hidden=true %}
                     {% trans "My flagged" %}
                 </a>
-                <a
-                    href="{% url 'wagtailadmin_home' %}"
-                    title="Goto wagtail admin"
-                    class="px-3 py-2 text-black flex items-center gap-2
-                           focus-visible:outline-dashed outline-1 transition-colors border-x
-                           hover:bg-slate-100 hover:text-dark-blue hover:font-semibold group"
-                >
-                    {% heroicon_outline "cog-6-tooth" size=18 class="stroke-gray-500 inline group-hover:scale-110 group-hover:stroke-2 group-hover:stroke-dark-blue transition-transform" aria_hidden=true %}
-                    {% trans "Administration" %}
-                </a>
+                {% if perms.wagtailadmin.access_admin %}
+                    <a
+                        href="{% url 'wagtailadmin_home' %}"
+                        title="Goto wagtail admin"
+                        class="px-3 py-2 text-black flex items-center gap-2
+                               focus-visible:outline-dashed outline-1 transition-colors border-x
+                               hover:bg-slate-100 hover:text-dark-blue hover:font-semibold group"
+                    >
+                        {% heroicon_outline "cog-6-tooth" size=18 class="stroke-gray-500 inline group-hover:scale-110 group-hover:stroke-2 group-hover:stroke-dark-blue transition-transform" aria_hidden=true %}
+                        {% trans "Administration" %}
+                    </a>
+                {% endif %}
             {% endif %}
             <a
                 href="{% url 'users:logout' %}"
-- 
GitLab