Skip to content

chrisroberts/rails_responds_to_parent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rails Responds To Parent plugin

This is a responds to parent plugin that is compatible with rails 2 and rails 3. It is based off the original work by Sean Treadway and has updates from Nicolas Papon. This plugin is available as a ruby gem to aid plugins and applications using bundler to easily resolve dependency issues.

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

main.html.erb:

<html>
  <body>
    <div id="stuff">Here is some stuff</div>

    <form target="frame" action="form_action">
      <input type="file" name="uploaded_file"/>
      <input type="submit"/>
    </form>

    <iframe id='frame' name="frame"></iframe>
  </body>
</html>

Original sources

About

Responds to parent plugin that is compatible with Rails 2 and 3

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages