Ruby on rails 多级菜单,活动链接css高亮显示。(Ruby on Rails)
场地结构:Ruby on rails 多级菜单,活动链接css高亮显示。(Ruby on Rails),ruby-on-rails,css,menu,helper,Ruby On Rails,Css,Menu,Helper,场地结构: / /products /products/design /products/photo /about 当子菜单项处于活动状态时,我希望看到父菜单项也被CSS高亮显示。 (当“设计”或“照片”处于活动状态时,“产品”也应突出显示。) 我将其用于子URL和简单URL: <li class="<%= current_page?(:action => 'design') %>"> <%= link_to_unless_current 'Desi
/
/products
/products/design
/products/photo
/about
当子菜单项处于活动状态时,我希望看到父菜单项也被CSS高亮显示。
(当“设计”或“照片”处于活动状态时,“产品”也应突出显示。)
我将其用于子URL和简单URL:
<li class="<%= current_page?(:action => 'design') %>">
<%= link_to_unless_current 'Design', :design %>
</li>
由以下人员使用:
那么,如何将我的“产品”、“设计”、“照片”三项检查全部放在一个助手中
并且可以使用类似
的东西。我不会重新创建轮子,而使用类似gem/插件的东西
这里有一个
<%= current_page?(:action => 'products') ||
current_page?(:action => 'design') %> ||
current_page?(:action => 'photo') %>
def current(childs)
if current_page?(:action => childs)
@container = "active"
else
@container = "inactive"
end
end