summaryrefslogtreecommitdiff
path: root/app/helpers/navigation_helper.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-05-04 14:35:47 -0700
committerelijah <elijah@riseup.net>2013-05-04 14:35:47 -0700
commitaecb1d4ea95506f6afbb371ab55ec621edf90734 (patch)
tree6d7d1d5e8f9659ec1589339741ec8309ca8e0da1 /app/helpers/navigation_helper.rb
parenta5f2ca408800532df55eae5ddd3c0a5ae6dbca65 (diff)
added child_summaries support.
Diffstat (limited to 'app/helpers/navigation_helper.rb')
-rw-r--r--app/helpers/navigation_helper.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/helpers/navigation_helper.rb b/app/helpers/navigation_helper.rb
index b4ca514..30faa78 100644
--- a/app/helpers/navigation_helper.rb
+++ b/app/helpers/navigation_helper.rb
@@ -42,6 +42,21 @@ module NavigationHelper
page_body(page)
end
+ def child_summaries(page=@page)
+ return unless page
+ menu = submenu_for_page(page)
+ return unless menu
+ haml do
+ menu.children.each do |submenu|
+ child_page = page.child(submenu.name)
+ haml :h3 do
+ haml :a, child_page.nav_title, :href => child_page.path.join('/')
+ end
+ haml :p, child_page.props.summary
+ end
+ end
+ end
+
private
def menu_item_path(item)
@@ -103,4 +118,14 @@ module NavigationHelper
@page && @page.path == ['home']
end
+ def submenu_for_page(page)
+ menu = site.menu
+ page.path.each do |segment|
+ menu = menu.submenu(segment)
+ end
+ return menu
+ rescue
+ return nil
+ end
+
end