Class: SiteController

Inherits:
ApplicationController show all
Includes:
Radiant::Pagination::Controller
Defined in:
app/controllers/site_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#cache, #config, #pagination_parameters

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Radiant::Pagination::Controller

#configure_pagination, included, #pagination_parameters

Methods inherited from ApplicationController

#include_javascript, #include_stylesheet, #initialize, #rescue_action_in_public, #template_name

Methods included from LoginSystem

included

Constructor Details

This class inherits a constructor from ApplicationController

Class Method Details

.cache_timeoutObject



10
11
12
# File 'app/controllers/site_controller.rb', line 10

def self.cache_timeout
  Radiant::PageResponseCacheDirector.cache_timeout
end

.cache_timeout=(val) ⇒ Object



7
8
9
# File 'app/controllers/site_controller.rb', line 7

def self.cache_timeout=(val)
  Radiant::PageResponseCacheDirector.cache_timeout=(val)
end

Instance Method Details

#cacheable_request?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'app/controllers/site_controller.rb', line 33

def cacheable_request?
  (request.head? || request.get?) && live?
end

#set_etag(val) ⇒ Object



43
44
45
# File 'app/controllers/site_controller.rb', line 43

def set_etag(val)
  headers['ETag'] = val
end

#set_expiry(time, options = {}) ⇒ Object



38
39
40
# File 'app/controllers/site_controller.rb', line 38

def set_expiry(time, options={})
  expires_in time, options
end

#show_pageObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/site_controller.rb', line 14

def show_page
  url = params[:url]
  if Array === url
    url = url.join('/')
  else
    url = url.to_s
  end
  if @page = find_page(url)
    batch_page_status_refresh if (url == "/" || url == "")
    process_page(@page)
    set_cache_control
    @performed_render ||= true
  else
    render :template => 'site/not_found', :status => 404
  end
rescue Page::MissingRootPageError
  redirect_to welcome_url
end