Class: Seiten::PagesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/seiten/pages_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



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

def show
  if current_page.nil?
    raise ActionController::RoutingError.new("Page /#{params[:page]} not found")
  else

    if params[:page]
      filename = params[:page]
    else
      filename = Seiten.config[:root_page_filename]
    end

    file = Seiten::PageStore.current.file_path(filename: filename)

    if current_page.layout
      render file: file, layout: current_page.layout
    else
      render file: file
    end
  end
end