Sha256: 1addfd78cd77024f5dfddffaa7b4227c4e3ef6c87fbee8d684b690eab4b99007

Contents?: true

Size: 695 Bytes

Versions: 1

Compression:

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
remotipart-1.1.1 lib/remotipart/render_overrides.rb