Sha256: e1b7a37ff21d61235de6c89e3b410ba4250c4b0107d4d93b739dbaccbc962d2d
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
module Lookbook class PagesController < ApplicationController def self.controller_path "lookbook/pages" end def index landing = Lookbook.pages.find(&:landing) || Lookbook.pages.first if landing.present? redirect_to page_path landing.lookup_path else @title = "Not found" render "not_found" end end def show @pages = Lookbook.pages @page = @pages.find_by_path(params[:path]) if @page if @page.errors.any? render "lookbook/error", locals: {error: @page.errors.first} else begin @page_content = page_controller.render_page(@page) @next_page = @pages.find_next(@page) @previous_page = @pages.find_previous(@page) @title = @page.title rescue => exception render "lookbook/error", locals: {error: exception} end end else render "not_found" end 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lookbook-0.7.2.beta.0 | app/controllers/lookbook/pages_controller.rb |