Class: PagesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#app_init

Instance Method Details

#previewObject



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

def preview
  @page = Page.new(params[:page])
  @page_title = @page.seo_title.blank? ? @page.title : @page.seo_title
  unless @page.published?
    flash.now[:warning] = "This page is not yet published and will not appear on your live website."
  end
  render :action => :show
end

#showObject



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

def show
  @page = current_user.blank? ? Page.published.find_by_path!("/#{params[:slugs]}") : Page.find_by_path!("/#{params[:slugs]}")
  @page_title = @page.seo_title.blank? ? @page.title : @page.seo_title

  if @page.key == "contact-us"
    redirect_to contact_index_path if @page.key == "contact-us"
  else
    respond_to do |format|
      format.html {  }
      format.mobile { render :template => "mobile/page" }
    end
  end
end