plantagoIT / Spina

Spina CMS
http://www.spinacms.com
Other
0 stars 0 forks source link

Make active links in navigation #3

Closed derschiw closed 2 years ago

derschiw commented 3 years ago

In spina js is used to add a .active class to the page the user is currently on. This is now broken without js. Since the controller only renders a partial for the content, the .active class is not moved.

kahrpatrick commented 3 years ago

I extended the Spina MenuPresenter to add an .active class to navigation items.

      def get_active_class(item, item_css)
        @current_path == item.materialized_path ? item_css + " " + active_class : item_css
      end