Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

Commit

Permalink
fixed menu to render dropdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Adams committed Oct 13, 2008
1 parent f7105bf commit 9c71e65
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/models/page.rb
Expand Up @@ -25,6 +25,10 @@ class Page < ActiveRecord::Base
attr_protected :page_number, :pages
has_many :page_plugins

def linked_children
children.select{|x| x.linked? }
end

def full_title
full_title = read_attribute('full_title')
if full_title.nil? or full_title.size == 0
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_menu.html.erb
Expand Up @@ -2,7 +2,7 @@
if menu_entry.link == 'special'
case menu_entry.name
when 'pages' -%>
<%= render :partial => 'shared/top_nav' -%>
<%= render :partial => 'shared/top_nav', :locals => { :entries => @topNav } -%>
<%
end
else
Expand Down
7 changes: 6 additions & 1 deletion app/views/shared/_top_nav.html.erb
@@ -1,7 +1,12 @@
<% @topNav.each do |page|
<% entries.each do |page|
isActive = @breadcrumb && (page == @breadcrumb[1] || page == @page)
url = "/pages/" + page.name + "/" %>
<li <%= "class=\"active\"" if isActive -%>>
<a href='<%= url %>'><%= page.title -%></a>
<% if page.linked_children.any? && page.parent_id -%>
<ul>
<%= render :partial => 'shared/top_nav', :locals => { :entries => page.linked_children } -%>
</ul>
<% end -%>
</li>
<% end %>

0 comments on commit 9c71e65

Please sign in to comment.