GithubHelp home page GithubHelp logo

leppert / remotipart Goto Github PK

View Code? Open in Web Editor NEW
292.0 6.0 266.0 534 KB

NOTE! THIS REPO HAS BEEN MOVED. SEE THE README. Remotipart is a Ruby on Rails gem enabling remote multipart forms (AJAX style file uploads) with jQuery.

Home Page: http://rubygems.org/gems/remotipart

License: MIT License

Ruby 100.00%

remotipart's Introduction

THIS REPOSITORY IS NO LONGER BEING MAINTAINED

Remotipart has a new home and is now being maintained at https://github.com/JangoSteve/remotipart.

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.

View Homepage and Demos

Copyright © 2011 Greg Leppert, Steve Schwartz. See LICENSE for details.

remotipart's People

Contributors

jangosteve avatar leppert avatar shwoodard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

remotipart's Issues

Double post

Remotipart is doing double post. I read from another closed issue not to include jquery.form but in instructions you mention we should. So what should I actually do then?
I am on rails 3.2.3 by the way. Thanks

This is my application.js :

//= require jquery
//= require jquery_ujs
//= require jquery.form
//= require jquery.remotipart
//= require jquery.colorbox
//= require usernav
//= require chosen-jquery

Content of textarea needs to be html escaped

Fix is to remove the html_safe flag (is there a better way?), so the content will automatically be correctly html escaped:

change:

text_area_tag 'remotipart_response', content

to:

text_area_tag('remotipart_response', String.new(content))

$.rails is undefined

Hi,

I can't get it to work. I have:

- public/javascripts/jquery/jquery-1.4.4.min.js
- public/javascripts/rails.js
- public/javascripts/jquery.form.js
- public/javascripts/jquery.remotipart.js

in this order in my layout and all I can see on the console is:

cannot call handleRemote on undefined.

So $.rails ist definitely not defined.

I have the correct version of rails.js for remotipart 0.3.4.

Any hints?

Cheers
Michael

Remotipart Posts twice

Hi, im using remotipart and paperclip for the file and it is posting twice and creating 2 objects, once with a html post and the second one with the JS post(the one I want). im using rails 4.2.1 and the lates version of remotipart.
Hope someone could help me
Thanx

Not working on Chrome v17.0.963.46

It works fine on IE9 or FireFox, but when I tried to upload file via chrome. It just does nothing. The server doesn't receive any data, and no error pop up.

work with devise

when the action requires authentication and the user is not logged in
the return is http 401. But it is not handled.

Where should the javascript code for handling 401 be added?

Script5: Access denied when trying to submit form in IE9 + gmail

when i submit form with file attached it works fine if i go directly to site.

but it doesn't work and throw Access Denied in IE9 when i came to site from gmail account(from link in gmail account) and trying to submit form with file attached.

I did investigation here - it's issue in jquery.iframe-transport, it throw exception when i am submitting the form. Spent 3 days but didn't found how to fix that. It would be appreciated if you'll be able to fix this issue.

Remotipart X-CSRF-Token

Because remotipart does not submit over ajax, the authenticity token is not added to the request.

The newest rails.js will not even work because not everybody loads their forms in HTML. Some load them from javascript templates.

Documentation out of date?

I think the docs for installation procedures may be out of date. The docs tell Rails 3.1 (asset pipeline) users to include this:

//= require jquery.form
//= require jquery.remotipart

however doing so seems to throw a JS error.

Uncaught Error: Sprockets::FileNotFound: couldn't find file 'jquery.form'

If, instead I do this:

//= require jquery.iframe-transport
//= require jquery.remotipart

things seem to work as expected.

Doesn't work when forms have fields added after page load

Remotipart + jquery_ujs aren't allowing us to submit forms containing file inputs via Ajax if the file input is added after page load.

The forms are marked as remote, and we have existing forms working where the file input isn't added after page load.

Double Submit

Seems like any time the form is submitted with a file selected, it calls the controller action twice (and inserts two records). Has anyone seen this? Thanks in advance.

Issue with jquery-rails 2.1.0

I upgraded jquery-rails in by rails 3.2.8 app and my ajax form submit with file input stopped working. Rails logs showed that the POST contained all the of the form data except the file input.

format attribute should be js, not .js

I'm not sure if this gem is working for others, but for me it only worked after modifying the jquery.remotipart.js file to change all instances of '.js' to 'js'. Otherwise rails controllers wouldn't recognize the format as a valid mime type and hence no rendering occurred, just a 406 response.

Form Post Format when submit button is disabled

My script works with firefox, which the form is posted to js.
In rails log, I got Processing by ReviewsController#create as JS

But when I use chrome or IE8, I got Processing by ReviewsController#create as HTML. it is requesting an HTML, but not a JS.

This happens when I disabled the button when it is clicked.

Other forms of response

Is there any way to avoid wrapping the response in a textarea? I'd like to just return an empty 200 response.
Also, is there any way to request an HTML response?

(The rest of my app doesn't use RJS, so I'm hoping to maintain that convention throughout. Sorry if this is already covered in the docs, but I can't see it anywhere.)

Naked call to console.log

On line 22 of jquery.remotipart.js, there's a call to console.log. Calling console.log can cause serious errors in some browsers when it doesn't exist (try it in Firefox, for instance). I'd strongly recommend either removing the line altogether or wrapping it in if (console && console.log).

Don't truncate response if it includes </textarea>

If the AJAX response is HTML that contains the string </textarea>, remotipart seems to truncate the entire response from that point on. Presumably this is related to the fact that the entire response is wrapped in a <textarea> tag.

This makes it impossible to return HTML with a textarea tag.

I could look at it but if someone else knows exactly where the problem is, go for it.

Multiple uploaded files on same form

Hey, thanks for the great library!

I got it working just fine when uploading a single file via an ajax form, but it fails when multiple files are uploaded on the same form.

What happens is the form will "double submit". Once via ajax, and then immediately after it will also submit a regular POST which then redirects the page. Very strange.

I dug through your JS and I can't really see where this might be a problem, but admittedly a lot of the fancy footwork is happening in form.js.

Any ideas why this might be? I can provide code samples or debug output if it'd be helpful.

Thanks!

-Jerod

IE Problems

Hi,

Firstly thanks for the work on this gem. I have my form working without any issues on Chrome and FF but I'm having some problems with IE. When I try and upload the file I'm getting a "File download - security warning" dialog displayed.

Tracing into the server code it looks like when using IE I'm not getting the ActionDispatch::Http::UploadedFile object for the file_field_tag field, instead I'm only getting the name of the file for this field in the params.

Any ideas on why this is happening with IE?

Thanks,

Etienne.

Ajax Request Not Being Generated to Rails Server

I'm trying your gem to do AJAX based photo upload for Rails 3 project I'm working on.

I've tried getting it to work based on:

https://github.com/formasfunction/remotipart

Also tried it by trying this way:

https://github.com/formasfunction/remotipart/wiki/Getting-Remotipart-to-work-with-latest-jquery-ujs

I've gone back to using the first way, and it looks like the app uploads the file but my logs never
see a POST request.

Here aresome code fragments:

<% form_for(@entry, :html => {:multipart => true}, :remote => true ) do |f| %>

bundle list:

  • remotipart (0.3.1)

Questions & Answers

-What do you mean by, it looks like the file is uploaded?

Browser tab says "loading" with a spinner for about the time it take to upload a file.

-What does Firebug say?

hr is not defined
[Break On This Error] "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

-Is it actually doing the AJAX call at all?

It does not look like it.

-Does you app see a request, but just no file included?

No request in the logs.

Getting undefined method `remotipart_response'

I'm running into one problem I don't get... I have remotipart installed properly, it's in my gemfile and I ran bundle install, I also generated the js and have all the dependencies. When I use this in a form everything works fine until the app hits my "create.js.erb" file, at which point I get:

ActionView::Template::Error (undefined method `remotipart_response' for #<#Class:0x00000101a7e728:0x00000101a7bbe0>):

Any suggestions?

Thanks for the amazing gem, this is a life saver for me!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.