0

I'd like to add a

current_page?

to my

.navbar.navbar-default.admin-header
  %ul.nav.navbar-nav.navbar-left
   %li= link_to "Dashboard", admins_dashboard_path, class: 'active'

to achieve that if my current page is /dashboard only in that case will be the

class: 'active'

in my link (later i want to use specific stylesheet to active and not active nav links.

Please helap me to get this together! Thy

1 Answers1

0

Documentation of this method describes how to implement it. In your case it's going to be something like:

.navbar.navbar-default.admin-header
  %ul.nav.navbar-nav.navbar-left
   %li= link_to "Dashboard", admins_dashboard_path, class: ('active' if current_page?(admins_dashboard_path))
Igor Drozdov
  • 14,690
  • 5
  • 37
  • 53
  • thankyou! i was laerning in typescript and just got involved in a ruby group and everything is so strange atm. this one working perfectly :D – Kovács Áron May 08 '18 at 12:40