nav menu: fix 'Forum' link not getting '.current' class.
Fixes the '.current' class not being set on the 'Forum' link when viewing the /forum_topics page. As a result, the link wasn't bolded and didn't have the background set.
This commit is contained in:
@@ -8,10 +8,10 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def nav_link_to(text, url, **options)
|
def nav_link_to(text, url, **options)
|
||||||
|
klass = options.delete(:class)
|
||||||
|
|
||||||
if nav_link_match(params[:controller], url)
|
if nav_link_match(params[:controller], url)
|
||||||
klass = "current"
|
klass = "#{klass} current"
|
||||||
else
|
|
||||||
klass = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
li_link_to(text, url, id_prefix: "nav-", class: klass, **options)
|
li_link_to(text, url, id_prefix: "nav-", class: klass, **options)
|
||||||
|
|||||||
Reference in New Issue
Block a user