Sha256: 324e9008b4e3b2c7bbed28e9852358f148cdf574a303b57af3ffbeec6b5afdef

Contents?: true

Size: 931 Bytes

Versions: 1

Compression:

Stored size: 931 Bytes

Contents

module Cms
  module Fortress
    module ContentRenderer

      def self.included(base)

        base.class_eval do

          def render_page(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_cache, :layout => app_layout, :status => status, :content_type => mime_type) unless cached_timeout > 0 && performed?
            else
              render :text => I18n.t('cms.content.layout_not_found'), :status => 404
            end
          end

        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cms-fortress-1.3.15 lib/cms/fortress/content_renderer.rb