How to get Twitter-Bootstrap navigation to show active link?

前端 未结 22 2097
一整个雨季
一整个雨季 2020-11-27 09:31

I\'m not understanding how Twitter Bootstrap does active links for the navigation. If I have a regular navigation like this (with ruby on rails linking):

<         


        
22条回答
  •  孤城傲影
    2020-11-27 10:09

      def active_navigation?(controllers_name, actions_name)
       'active' if controllers_name.include?(controller_name) && actions_name.include?(action_name)
      end
    

    slim

    li class=(active_navigation?(['events'], ['index', 'show'])) = link_to t('navbar.events'), events_path
    

提交回复
热议问题