mirror of
https://github.com/we-promise/sure.git
synced 2026-04-13 00:57:22 +00:00
Improve active class assignment in sidebar links (#450)
* Fix active class assignment in sidebar links * Revert "Fix active class assignment in sidebar links" This reverts commit 55924f32db9f5a0c0948d19b3af79d729feb6ef7. * Update sidebar_link_to helper to correctly assign active class for nested routes --------- Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user