5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/cms/fortress/content_renderer.rb', line 5
def self.included(base)
base.class_eval do
def render_html(status = 200)
cached_timeout = @cms_page.cached_timeout.to_i
if cached_timeout > 0
fresh_when etag: @cms_page, last_modified: @cms_page.updated_at.utc, public: true
response.cache_control[:max_age] = cached_timeout.seconds
end
if @cms_layout = @cms_page.layout
app_layout = (@cms_layout.app_layout.blank? || request.xhr?) ? false : @cms_layout.app_layout
render(:inline => @cms_page.content, :layout => app_layout, :status => status, :content_type => 'text/html') unless cached_timeout > 0 && performed?
else
render :text => I18n.t('cms.content.layout_not_found'), :status => 404
end
end
end
end
|