Sha256: 5398ae8624e6b49deb9f6f7b45d8a7981297ecc6f3387f216fc1f168cc4b4d11
Contents?: true
Size: 1.04 KB
Versions: 15
Compression:
Stored size: 1.04 KB
Contents
module Lookbook class PagesController < ApplicationController helper_method :page_controller def self.controller_path "lookbook/pages" end def index landing = Engine.pages.find(&:landing?) || Engine.pages.first raise_not_found("Page not found") unless landing.present? redirect_to lookbook_page_path(landing.path) end def show @page = @pages.find_by_path(params[:path]) raise_not_found("Page not found") unless @page @page_content = page_controller.render_page(@page) @title = @page.title @next_page = @pages.next(@page) @previous_page = @pages.previous(@page) rescue ActionView::Template::Error => err raise Lookbook::TemplateError.new( original: err, file_path: @page.file_path, source: @page.content ) end protected def page_controller controller_class = Lookbook.config.page_controller.constantize controller = controller_class.new controller.request = request controller end end end
Version data entries
15 entries across 15 versions & 1 rubygems