Sha256: 4215e8b1557ca177b99b7aa962ab6c386acccefcdd6e744613bdb11177508b97

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

module Wiselinks
  module Rendering    
    
    def self.included(base)            
      base.alias_method_chain :render, :wiselinks
    end

  protected

    def render_with_wiselinks(options = {}, *args, &block)      
      if self.request.wiselinks?        
        self.headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'
        self.headers['Pragma'] = 'no-cache'

        if self.request.wiselinks_partial?
          Wiselinks.log("Processing partial request")
          options[:partial] ||= action_name
        else
          Wiselinks.log("Processing template request")
          if Wiselinks.options[:layout] != false
            options[:layout] = self.wiselinks_layout 
          end
        end

        if Wiselinks.options[:assets_digest].present?
          Wiselinks.log("Assets digest #{Wiselinks.options[:assets_digest]}")

          self.headers['X-Wiselinks-Assets-Digest'] = Wiselinks.options[:assets_digest]          
        end
      end

      self.render_without_wiselinks(options, args, &block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wiselinks-0.5.0 lib/wiselinks/rendering.rb