Skip to content

Instantly share code, notes, and snippets.

@sbeam
Created November 4, 2010 18:52
Show Gist options
  • Save sbeam/662958 to your computer and use it in GitHub Desktop.
Save sbeam/662958 to your computer and use it in GitHub Desktop.
<%- collection ||= @menu_pages
# In order to match items that aren't shown in menu and highlight their associations.
# This can be supplied if the logic different in your case.
unless defined?(selected_item)
selected_item = collection.detect{|page| selected_page?(page)}
selected_item = @page if selected_item.nil?
end
if defined?(selected_item) %>
<%- if page_section_id == 'stoneybrook' %>
<%-
if @page.nested_url.length > 2
submenu_items = selected_item.parent.children
elsif @page.nested_url.length == 2 && !selected_item.children.blank?
submenu_items = selected_item.children
end
%>
<% if submenu_items %>
<ul class="subnav">
<% submenu_items.each do |item| %>
<li><a href="#<%= item.cached_slug %>"><%= item.title %></a></li>
<% end %>
</ul>
<% submenu_items.each do |item| %>
<div class="subsection">
<h1><a name="<%= item.cached_slug %>"></a><%= item.title %></h1>
<%= item['Body'].html_safe %>
<a class="backtop" href="#top">Back to top</a>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment