Sha256: fe74f4d0e979ecd50b21aaf870f14884df847ed9c3f0042e6edd9de1ba2fd719

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 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=\"#{response.content_type}\" data-status=\"#{response.response_code}\" data-statusText=\"#{response.message}\">#{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.0 lib/remotipart/render_overrides.rb