Class: QuicCms::PagesController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



16
17
18
19
20
21
22
23
24
# File 'app/controllers/quic_cms/pages_controller.rb', line 16

def index
  @page = Page.find_by_permalink("home")
  if @page.nil?
    @page = Page.new(:title => "Page with permalink of #{params[:permalink]} does not exist",
                     :content => "If you are an Admin Please <a href='/users/sign_in'> Log in </a>and create it",
                     :permalink => params[:permalink], @show_title => true)
  end
  render 'show'
end

#showObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/quic_cms/pages_controller.rb', line 3

def show
  if params[:permalink]
    @page = Page.find_by_permalink(params[:permalink])
    if @page.nil?
      @page = Page.new(:title => "Page with permalink of #{params[:permalink]} does not exist",
                       :content => "If you are an Admin Please <a href='/users/sign_in'> Log in </a>and create it",
                       :permalink => params[:permalink], @show_title => true)
    end
  else
    @page = Page.find(params[:id])
  end
end