Module: RailsConnector::TableOfContentsHelper

Included in:
DefaultCmsHelper
Defined in:
app/helpers/rails_connector/table_of_contents_helper.rb

Overview

This module contains a helper that can be used to build a table of contents of an object.

Instance Method Summary collapse

Instance Method Details

#table_of_contents(obj) ⇒ Object

The table_of_contents helper method gets an object as argument and returns an array, which can be used as the table of contents of the given object.

The returned array consists of the child objects of the given object. The array is sorted according to the configured sort order and the sort keys. It also contains only objects which the current user is permitted to view.



18
19
20
# File 'app/helpers/rails_connector/table_of_contents_helper.rb', line 18

def table_of_contents(obj)
  obj.sorted_toclist.reject { |o| not o.permitted_for_user?(current_user) }
end