Class: Bhf::PagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/bhf/pages_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#index

Instance Method Details

#showObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/bhf/pages_controller.rb', line 4

def show
  unless platform_options = @config.content_for_page(@page)
    raise Exception.new("Page '#{@page}' could not be found")
  end

  if request.xhr?
    params.each do |key, value|
      return render_platform(key) if value.is_a?(Hash)
    end
  end

  @platforms = platform_options.each_with_object([]) do |opts, obj|
    platform = Bhf::Platform.new(opts, @page, )
    next if platform.table_hide?
    platform.pagination = Bhf::Pagination.new(platform.entries_per_page)
    paginate_platform_objects(platform)
    obj << platform
  end
end