Sha256: fa6dd24aa3ac812fc342afd2c330358a415ec9d5789920eba7e63fda53f8007a

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

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

  protected

    def render_with_wiselinks(*args)      
      options = _normalize_render(*args)

      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)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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