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>&raquo;</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

Version Path
soapbox-0.3.1 app/helpers/page_helper.rb
soapbox-0.3.0 app/helpers/page_helper.rb
soapbox-0.2.24 app/helpers/page_helper.rb
soapbox-0.2.23 app/helpers/page_helper.rb
soapbox-0.2.21 app/helpers/page_helper.rb
soapbox-0.2.20 app/helpers/page_helper.rb
soapbox-0.2.18 app/helpers/page_helper.rb
soapbox-0.2.16 app/helpers/page_helper.rb
soapbox-0.2.15 app/helpers/page_helper.rb
soapbox-0.2.14 app/helpers/page_helper.rb
soapbox-0.2.12 app/helpers/page_helper.rb
soapbox-0.2.11 app/helpers/page_helper.rb