Sha256: 9a7698f349a1000a04f8ea4b4303f31afcf3f1e6164e492c181f9595aa7981f8

Contents?: true

Size: 669 Bytes

Versions: 2

Compression:

Stored size: 669 Bytes

Contents

module Remotipart
  # Responder used to automagically wrap any non-xml replies in a text-area
  # as expected by iframe-transport.
  module RenderOverrides
    include ActionView::Helpers::TagHelper

    def self.included(base)
      base.class_eval do
        alias_method_chain :render, :remotipart
      end
    end

    def render_with_remotipart *args
      render_without_remotipart *args
      if remotipart_submitted?
        response.body = %{<textarea data-type=\"#{content_type}\" response-code=\"#{response.response_code}\">#{escape_once(response.body)}</textarea>}
        response.content_type = Mime::HTML
      end
      response_body
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
remotipart-1.0.5 lib/remotipart/render_overrides.rb
remotipart-1.0.4 lib/remotipart/render_overrides.rb