Agile Web Development

Build it. Launch it. Love it.

Responds to Parent

Adds responds_to_parent to your controller to respond to the parent document of your page. Make Ajaxy file uploads by posting the form to a hidden iframe, and respond with RJS to the parent window.

Example

Controller:

  class Test < ActionController::Base
    def main
    end

    def form_action
      # Do stuff with params[:uploaded_file]

      responds_to_parent do
        render :update do |page|
          page << "alert($('stuff').innerHTML)"
        end
      end
    end
  end

Vitals

Home http://sean.treadway.info/responds-to-parent/
Repository http://responds-to-parent.googlecode.com/svn/trunk
License Rails' (MIT)
Rating (22 votes)
Owner Sean Treadway
Created 29 May 2006

Comments

  • Avatar
    17 October 2007

    Wonderful resource, the only problem is that http://sean.treadway.info/svn/plugins/respondstoparent/ seems to be down... :(

    Any alternative location for this pluging?

  • Vitali
    27 November 2007

    http://sean.treadway.info/2007/11/12/responds-to-parent-resurrected/

  • Avatar
    20 March 2009

    This works like a charm even with Rails 2.3.2.1

  • Avatar
    23 May 2009

    Yep, Glenn. Worked for me too, on version 2.3.2. Thanks very much!

Add a comment