Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ToDiscuss] Using $.widget ? #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

lacco
Copy link

@lacco lacco commented Dec 15, 2012

I started today using this awesome gem, it is much nicer than copying the Railscast code into each project. Additionally, the provided Javascript callbacks make it easy to adjust the plugin to some special needs.

Nevertheless, I felt that the callbacks were quite difficult to use (e.g. before_add in options while others using bind, and they have different names than the events from fileupload widget), so I started refactoring the client code into a $.widget. Do you have any thoughts on this? Of course it isn't backwards-compatible, but I think the API is much easier to use.

List of changes:

  • Plugin is initialized thorugh $("#myS3Uploader").s3upload instead of $("#myS3Uploader").S3Uploader
  • Renamed events: s3_upload_complete => s3uploaddone, s3_upload_failed => s3uploadfail
  • Introduce progress event that passes loaded, total and percentage properties
  • Pass additional filekey property to done callback

@waynehoover
Copy link
Owner

I generally like this idea a lot. It makes things more modular and using the $.widget syntax is what the jquery file upload ui uses so it provides a more consistant syntax in this small eco-system.

Have you tested this code on all browsers?

@lacco
Copy link
Author

lacco commented Dec 19, 2012

I only tested the code on IE9, FF and Chrome, but we will do some more testing as soon we ship our code to production (I don't expect any problems since fileupload is also based on $.widget).

@lacco
Copy link
Author

lacco commented Mar 16, 2013

Okay, tI encountered no bugs on my refactoring. Shall I start working on rebasing my code on your current master so that we can merge it very soon, are you still interested in my changes?

@waynehoover
Copy link
Owner

Yes, that sounds great, I will merge it in when you rebase on master.

@uberllama
Copy link
Contributor

Out of curiosity, will this change facilitate usage of the standard jquery file upload UI? I actually prefer the load then start style UI with completion indicators.

@DanielHeath
Copy link

I had a quick look at rebasing this but it's diverged pretty far from master by now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants