Module: Cms::ContentRenderingSupport

Included in:
AttachmentsController, ContentController
Defined in:
lib/cms/content_rendering_support.rb

Instance Method Summary collapse

Instance Method Details

#determine_page_layoutObject

Basic implementation for looking up the template based on the page layout. This will be overwritten by Cms::MobileAware to show mobile aware templates.



33
34
35
# File 'lib/cms/content_rendering_support.rb', line 33

def determine_page_layout
  @page.layout
end

#handle_access_denied_on_page(exception) ⇒ Object



20
21
22
23
# File 'lib/cms/content_rendering_support.rb', line 20

def handle_access_denied_on_page(exception)
  logger.warn "Access denied for user '#{current_user.}': Returning the 403 page."
  handle_error_with_cms_page(Cms::ErrorPages::FORBIDDEN_PATH, exception, :forbidden)
end

#handle_not_found_on_page(exception) ⇒ Object



15
16
17
18
# File 'lib/cms/content_rendering_support.rb', line 15

def handle_not_found_on_page(exception)
  logger.warn "Resource not found: Returning the 404 page."
  handle_error_with_cms_page(Cms::ErrorPages::NOT_FOUND_PATH, exception, :not_found)
end

#handle_server_error_on_page(exception) ⇒ Object



25
26
27
28
29
# File 'lib/cms/content_rendering_support.rb', line 25

def handle_server_error_on_page(exception)
  logger.error "An Unexpected exception occurred: #{exception.message}\n"
  logger.error "#{exception.backtrace.join("\n")}\n"
  handle_error_with_cms_page(Cms::ErrorPages::SERVER_ERROR_PATH, exception, :internal_server_error)
end