Module: Cms::ContentRenderingSupport
- Included in:
- AttachmentsController, ContentBlockController, ContentController, FormEntriesController
- Defined in:
- lib/cms/content_rendering_support.rb
Instance Method Summary collapse
- #handle_access_denied_on_page(exception) ⇒ Object
- #handle_draft_not_found(exception) ⇒ Object
- #handle_not_found_on_page(exception) ⇒ Object
- #handle_server_error_on_page(exception) ⇒ Object
- #show_content_as_page(content) ⇒ Object
Instance Method Details
#handle_access_denied_on_page(exception) ⇒ Object
35 36 37 38 |
# File 'lib/cms/content_rendering_support.rb', line 35 def handle_access_denied_on_page(exception) logger.warn "Access denied for user '#{current_user.login}': Returning the 403 page." handle_error_with_cms_page(Cms::ErrorPages::FORBIDDEN_PATH, exception, :forbidden) end |
#handle_draft_not_found(exception) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/cms/content_rendering_support.rb', line 23 def handle_draft_not_found(exception) logger.warn "Draft Content Not Found" render(:layout => 'cms/application', :template => 'cms/content/no_page', :status => :not_found) end |
#handle_not_found_on_page(exception) ⇒ Object
30 31 32 33 |
# File 'lib/cms/content_rendering_support.rb', line 30 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
40 41 42 43 44 |
# File 'lib/cms/content_rendering_support.rb', line 40 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 |
#show_content_as_page(content) ⇒ Object
18 19 20 21 |
# File 'lib/cms/content_rendering_support.rb', line 18 def show_content_as_page(content) @page = content # page templates expect a @page attribute @content_block = content # render.html.erb's expect a @content_block attribute end |