Socket
Book a DemoInstallSign in
Socket

tfe-remotipart

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tfe-remotipart

0.2.1
bundlerRubygems
Version published
Maintainers
2
Created
Source

= Remotipart

Remotipart is a Ruby on Rails gem enabling remote multipart forms (AJAX style file uploads) with jQuery. This gem augments the native Rails jQuery remote form function enabling asynchronous file uploads with little to no modification to your application.

== Dependencies

  • {Rails 3}[http://github.com/rails/rails]
  • {jQuery}[http://jquery.com]
  • {The Rails jQuery driver}[http://github.com/rails/jquery-ujs]
  • {The jQuery Form plugin}[http://jquery.malsup.com/form/]

== Installation

  • Install the Remotipart gem gem install remotipart
  • Run the Remotipart generator to add jquery.remotipart.js to public/javascripts/ rails g remotipart
  • Add the Javascript files for jQuery, the Rails jQuery driver, jQuery Form plugin, and Remotipart to your template, making sure to include jquery.remotipart.js after the jQuery and the Rails jQuery driver <%= javascript_include_tag 'jquery-1.4.4.min', 'rails', 'jquery.form', 'jquery.remotipart' %>

== Usage

  • For multipart / forms with file inputs, set your form_for to remote as you would for a normal ajax form: :remote => true
  • When Javascript is enabled in the user's browser, the form, including the file, will be submitted asynchronously to your controller with: :format == 'js'
  • In the JS response template for your controller action, wrap all of your response code in one remotipart_response block: <%= remotipart_response do %> All Javascript response code goes here <% end %>

=== Example

sample_layout.html.erb <%= form_for @sample, :html => { :multipart => true }, :remote => true do |f| %>

<%= f.label :file %> <%= f.file_field :file %>
<%= f.submit %>
<% end %>

sample_controller.rb def create respond_to do |format| if @sample.save format.js end end end

create.js.erb <%= remotipart_response do %> //Display a Javascript alert alert('success!'); <% end %>

== Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

== Copyright

Copyright (c) 2010 Greg Leppert. See LICENSE for details.

FAQs

Package last updated on 09 Jan 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.