Sha256: bf72363029208cfd216d928790a0b18a14fad3c3833df296f4bb4f19d73a2565

Contents?: true

Size: 348 Bytes

Versions: 1

Compression:

Stored size: 348 Bytes

Contents

module NavigationHelper

  def subnav
    # TODO: cache subnav
    if parent.present?
      parent_page = Page.find_by_path(parent)
      children = parent_page.immediate_children
      render 'shared/subnav', items: children if children.any?
    end
  end

  private

    def parent
      request.path.split('/').reject(&:blank?)[-2]
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
forest_cms-0.98.1 app/helpers/navigation_helper.rb