Class: Qbrick::PagesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/qbrick/pages_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
10
11
12
# File 'app/controllers/qbrick/pages_controller.rb', line 7

def index
  @search = params[:search]
  return if @search.blank?

  @pages = Qbrick::Page.unscoped.published.content_page.search(@search)
end

#lookup_by_idObject



27
28
29
30
# File 'app/controllers/qbrick/pages_controller.rb', line 27

def lookup_by_id
  @page = Page.find(params[:id])
  redirect_to "/#{@page.url}"
end

#showObject



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

def show
  if redirect_page?
    session[:qbrick_referrer] = @page.id
    redirect_to @page.redirect_url
  elsif @page.present?
    respond_with @page
  elsif @page.blank? && respond_to?(:handle_404)
    handle_404
  else
    raise ActionController::RoutingError, 'Not Found'
  end
end