Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Improve active class assignment in sidebar links (#450)

Mattia0490fda46583
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 3e01dea3..1090869d 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -34,7 +34,7 @@ module ApplicationHelper
hover_class_names = [ "hover:bg-white", "hover:border-alpha-black-50", "hover:text-gray-900", "hover:shadow-xs" ]
current_page_class_names = [ "bg-white", "border-alpha-black-50", "text-gray-900", "shadow-xs" ]
- link_class_names = if current_page?(path)
+ link_class_names = if current_page?(path) || (request.path.start_with?(path) && path != "/")
base_class_names.delete("border-transparent")
base_class_names + hover_class_names + current_page_class_names
else