Sha256: 7bceec7a2d77a4ca96e7ff3fddc13f346985fc8c0c94edf627e699e2c3af9786

Contents?: true

Size: 1.02 KB

Versions: 12

Compression:

Stored size: 1.02 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

12 entries across 12 versions & 2 rubygems

Version Path
wiselinks-artirix-1.3.0 lib/wiselinks/rendering.rb
wiselinks-1.2.1 lib/wiselinks/rendering.rb
wiselinks-1.2.0 lib/wiselinks/rendering.rb
wiselinks-1.1.4 lib/wiselinks/rendering.rb
wiselinks-1.1.2 lib/wiselinks/rendering.rb
wiselinks-1.1.1 lib/wiselinks/rendering.rb
wiselinks-1.1.0 lib/wiselinks/rendering.rb
wiselinks-1.0.0 lib/wiselinks/rendering.rb
wiselinks-0.7.3 lib/wiselinks/rendering.rb
wiselinks-0.7.2 lib/wiselinks/rendering.rb
wiselinks-0.7.1 lib/wiselinks/rendering.rb
wiselinks-0.7.0 lib/wiselinks/rendering.rb