Sha256: 9eda8231d6999afe5f7b9aba62a558f11181bddbc7bba06a3fa07a011f2729bf

Contents?: true

Size: 994 Bytes

Versions: 1

Compression:

Stored size: 994 Bytes

Contents

module SeitenHelper

  def render_html
    if params[:page]
      filename = params[:page]
    else
      filename = "home"
    end
    render :file => File.join(Rails.root, Seiten.config[:storage_directory], filename)
  end

  def seiten_navigation(parent_id=nil, deep=2)
    output ||= ""

    if deep > 0
      Seiten::Page.find_by_parent_id(parent_id).each do |page|
        status = page.active?(current_page) ? "active" : "inactive"
        output += "<li class='#{status}'>#{link_to(page.title, page.slug)}"
        unless page.children.blank?
          output += seiten_navigation(page.id, deep-1)
        end
        output += "</li>"
      end
    end
    raw "<ul>#{output}</ul>"
  end

  def seiten_breadcrumb
    output = content_tag(:ul, class: "breadcrumb") do
      Seiten::Page.get_breadcrumb(current_page).reverse.collect { |page|
        content_tag :li do
          raw "> #{link_to(page.title, page.slug)}"
        end
      }.join().html_safe
    end
    output
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seiten-0.0.1 app/helpers/seiten_helper.rb