Class: SiteController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SiteController
- Includes:
- TrustyCms::Pagination::Controller
- Defined in:
- app/controllers/site_controller.rb
Instance Attribute Summary
Attributes inherited from ApplicationController
#cache, #pagination_parameters, #trusty_config
Class Method Summary collapse
Instance Method Summary collapse
- #cacheable_request? ⇒ Boolean
-
#set_etag(val) ⇒ Object
hide_action :set_expiry.
-
#set_expiry(time, options = {}) ⇒ Object
hide_action :cacheable_request?.
- #show_page ⇒ Object
Methods included from TrustyCms::Pagination::Controller
#configure_pagination, included, #pagination_parameters
Methods inherited from ApplicationController
#after_sign_in_path_for, #initialize, #template_name
Methods included from LoginSystem
Constructor Details
This class inherits a constructor from ApplicationController
Class Method Details
.cache_timeout ⇒ Object
14 15 16 |
# File 'app/controllers/site_controller.rb', line 14 def self.cache_timeout TrustyCms::PageResponseCacheDirector.cache_timeout end |
.cache_timeout=(val) ⇒ Object
10 11 12 |
# File 'app/controllers/site_controller.rb', line 10 def self.cache_timeout=(val) TrustyCms::PageResponseCacheDirector.cache_timeout = val end |
Instance Method Details
#cacheable_request? ⇒ Boolean
44 45 46 |
# File 'app/controllers/site_controller.rb', line 44 def cacheable_request? (request.head? || request.get?) && live? end |
#set_etag(val) ⇒ Object
hide_action :set_expiry
56 57 58 |
# File 'app/controllers/site_controller.rb', line 56 def set_etag(val) headers['ETag'] = val end |
#set_expiry(time, options = {}) ⇒ Object
hide_action :cacheable_request?
50 51 52 |
# File 'app/controllers/site_controller.rb', line 50 def set_expiry(time, = {}) expires_in time, end |
#show_page ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/site_controller.rb', line 18 def show_page url = params[:url] url = if Array === url url.join('/') else url.to_s end if @page = find_page(url) batch_page_status_refresh if url == '/' || url == '' # This is a bit of a hack to get Vanity URL pages working in another extension # In Rails 2, redirect_to halted execution, so process_page could be aliased and # a redirect could be used. This no longer works. There's a better fix for this, # but for now, anything that aliases process_page can return false if it's rendering # or redirecting on its own. return unless process_page(@page) set_cache_control @performed_render ||= true render layout: false else render template: 'site/not_found', status: 404, layout: false end rescue Page::MissingRootPageError redirect_to welcome_path end |