Sha256: 59f3991c582549c2ef9153448d6adefbde39c49c587015e0f2f8df3a4be02fae

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

Contents

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

  protected

    def render_with_wiselinks(*args, &block)
      options = _normalize_args(*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, &block)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
wiselinks-0.6.4 lib/wiselinks/rendering.rb
wiselinks-0.6.3 lib/wiselinks/rendering.rb
wiselinks-0.6.2 lib/wiselinks/rendering.rb
wiselinks-0.6.1 lib/wiselinks/rendering.rb
wiselinks-0.6.0 lib/wiselinks/rendering.rb
wiselinks-0.5.6 lib/wiselinks/rendering.rb
wiselinks-0.5.5 lib/wiselinks/rendering.rb
wiselinks-0.5.4 lib/wiselinks/rendering.rb
wiselinks-0.5.3 lib/wiselinks/rendering.rb
wiselinks-0.5.2 lib/wiselinks/rendering.rb