Fixed profile selected state in navbar

This commit is contained in:
2024-09-02 11:39:03 +02:00
parent 76ea655e4f
commit 6aca35ff46
2 changed files with 5 additions and 1 deletions

View File

@@ -25,4 +25,8 @@ module ApplicationHelper
def admin? def admin?
controller.class.name.split("::").first=="Admin" controller.class.name.split("::").first=="Admin"
end end
def profile?
controller.class.name.split("::").first=="Profile"
end
end end

View File

@@ -4,7 +4,7 @@
<nav> <nav>
<ul class="flex justify-center space-x-2 font-semibold items-color"> <ul class="flex justify-center space-x-2 font-semibold items-color">
<li class="relative"> <li class="relative">
<button class="px-4 py-2 cursor-default hover:text-hsrm-red border-b-4 <%= admin? && 'border-hsrm-red-light' %>"> <button class="px-4 py-2 cursor-default hover:text-hsrm-red border-b-4 <%= profile? && 'border-hsrm-red-light' %>">
<%= link_to "Profil", profile_path %> <%= link_to "Profil", profile_path %>
</button> </button>
</li> </li>