Skip to content

Instantly share code, notes, and snippets.

@daz
Created September 4, 2012 05:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save daz/3616833 to your computer and use it in GitHub Desktop.
Save daz/3616833 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