Skip to content

Instantly share code, notes, and snippets.

@jerome
Forked from daz/_menu.html.erb
Created October 20, 2012 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerome/3925028 to your computer and use it in GitHub Desktop.
Save jerome/3925028 to your computer and use it in GitHub Desktop.
Bootstrap dropdown menu with Rails and Ancestry
<% if article.is_childless? %>
<li><%= link_to article.title, article_path(article) %></li>
<% else %>
<li class="dropdown">
<%= link_to '#', class: 'dropdown-toggle', data: { toggle: 'dropdown'} do %>
<%= article.title %>
<b class="caret"></b>
<% end %>
<ul class="dropdown-menu">
<%= render partial: 'site/menu', collection: article.children, as: :article %>
</ul>
</li>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment