Sha256: fd5efffa5999638a930450e270aef28580a4051e152a77872a50ccdbd14429ee

Contents?: true

Size: 788 Bytes

Versions: 3

Compression:

Stored size: 788 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 ERB::Util

    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?
        textarea_body = response.content_type == 'text/html' ? html_escape(response.body) : response.body
        response.body = %{<textarea data-type=\"#{response.content_type}\" data-status=\"#{response.response_code}\" data-statusText=\"#{response.message}\">#{textarea_body}</textarea>}
        response.content_type = Mime::HTML
      end
      response_body
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/remotipart-1.2.1/lib/remotipart/render_overrides.rb
remotipart-1.2.1 lib/remotipart/render_overrides.rb
remotipart-1.2.0 lib/remotipart/render_overrides.rb