Sha256: e3be969bc9b977967f357c9c261856fbdafe7c5a6b0ded9eb769f645a88fcc97
Contents?: true
Size: 1.12 KB
Versions: 7
Compression:
Stored size: 1.12 KB
Contents
require_dependency "pages_cms/application_controller" module PagesCms class PagesController < ApplicationController def show page = Page.find_by_slug(params[:slug]) page_setup(page) end def subpage page = Page.find_by_slug(params[:slug]) page_setup(page) end def home page = Page.find_by_title('Home') page_setup(page) end private def page_setup(page) if page != nil @page = page if @page.sidebar && @page.sidebar.show && @page.sidebar.use_instead.nil? @sidebar = @page.sidebar elsif @page.sidebar && !@page.sidebar.show @sidebar = false elsif @page.sidebar && !@page.sidebar.use_instead.nil? @sidebar = Sidebar.find(@page.sidebar.use_instead) else @sidebar = false end if @page.sliders && @page.sliders.any? @sliders = @page.sliders.order(:order) else @sliders = false end render template: 'pages_cms/pages/show' else redirect_to '/' end end end end
Version data entries
7 entries across 7 versions & 1 rubygems