Sha256: fa411b61705347ee3741ac44fee2b889a9b4d98e6b6ee6b7801c7db61eed4ebd

Contents?: true

Size: 927 Bytes

Versions: 10

Compression:

Stored size: 927 Bytes

Contents

module Cms
  module Fortress
    module ContentRenderer

      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

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cms-fortress-1.1.8 lib/cms/fortress/content_renderer.rb
cms-fortress-1.1.7 lib/cms/fortress/content_renderer.rb
cms-fortress-1.1.6 lib/cms/fortress/content_renderer.rb
cms-fortress-1.1.5 lib/cms/fortress/content_renderer.rb
cms-fortress-1.1.4 lib/cms/fortress/content_renderer.rb
cms-fortress-1.1.3 lib/cms/fortress/content_renderer.rb
cms-fortress-1.1.2 lib/cms/fortress/content_renderer.rb
cms-fortress-1.1.1 lib/cms/fortress/content_renderer.rb
cms-fortress-1.1.0 lib/cms/fortress/content_renderer.rb
cms-fortress-1.0.12 lib/cms/fortress/content_renderer.rb