Sha256: af980bbcf570610e01e507bfb8089604fc401e11a3b9868c84599a1ac9830def
Contents?: true
Size: 789 Bytes
Versions: 12
Compression:
Stored size: 789 Bytes
Contents
module PageHelper def breadcrumb(page) html = "" while page = page.parent html = "#{link_to page_path(page)} <span>»</span> #{html}" end html.html_safe end def page_nav(pages = Page.published.where("parent_id is ?", nil), id = nil) html = "" html << "<ul id='#{ id || "" }'>" pages.each do |page| next if (!page.published? && !user_logged_in? rescue false) # add published method to any menuable object html << "<li class='#{page.nav_label.gsub(" ","_").downcase}'>" html << link_to(page.nav_label != "" ? page.nav_label : page.title, page.homepage? ? "/" : page_path(page)) html << page_nav(page.children) if !page.children.empty? html << "</li>" end html << "</ul>" html.html_safe end end
Version data entries
12 entries across 12 versions & 1 rubygems