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

deform2: fix up file_upload.pt #184

Closed
wants to merge 9 commits into from
Closed

Conversation

dairiki
Copy link
Contributor

@dairiki dairiki commented Sep 26, 2013

This makes the FileUploadWidget look a bit nicer (and more legible).

More work is probably in order on this front. I believe javscript is necessary to make the file upload control
match the other form controls. A quick search has found two projects which might be useful, though neither
looks necessarily ideal:

Are there better choices?

@dairiki
Copy link
Contributor Author

dairiki commented Sep 27, 2013

I've just pushed what I think is a nicer solution for the file upload widget. (5c7b5dd)

I pretty much ripped this off from this blog post:
http://www.abeautifulsite.net/blog/2013/08/whipping-file-inputs-into-shape-with-bootstrap-3/

I haven't yet tested it on many browsers, but the author of the blog post claims “This method was tested to work in IE8–IE10 and fairly recent versions of Chrome, Safari, Firefox, and Opera.”

@stevepiercy
Copy link
Member

I like this one but it may be too much for deform2, and it does not use bootstrap:
http://blueimp.github.io/jQuery-File-Upload/

@dairiki
Copy link
Contributor Author

dairiki commented Sep 27, 2013

@stevepiercy Thanks, Steve. I did find that too, and it does look nice… but it does seem pretty heavy. My guess is that it belongs in its own widget; probably in a separate extension package, rather than in deform itself.

(TIL: I didn't realize it was possible to get the upload progress information completely client-side — I always thought that some back-channel communication with the server was required. The jQuery File Uploader seems to do it though.)

@mcdonc
Copy link
Member

mcdonc commented Sep 27, 2013

This is an inappropriate place to put this comment but I just wanted to say thanks for all the pull requests! I'm participating in "WSGI War" this weekend so I likely won't get a chance to review them, but hopefully next week.

@dairiki
Copy link
Contributor Author

dairiki commented Sep 27, 2013

@mcdonc (more inappropriately located comments) WSGI war sounds like a blast!

Since I'm currently working on a bootstrap 3 based project, I was happy to see deform2 gathering momentum. I'm working on switching the project from deform 0.x + deform_bootstrap + a pile of custom templates to deform2. (Expect more pull requests as that progresses.)

@mcdonc
Copy link
Member

mcdonc commented Oct 4, 2013

This does look much better!

Currently it looks fine in Chrome but the button text looks strange in Firefox. Images attached.

Also, this breaks the deformdemo tests involving file upload widgets on the deform2 branch of the deformdemo package.

fileupload-empty

fileupload-filled

@dairiki
Copy link
Contributor Author

dairiki commented Oct 4, 2013

I will look into that further (and figure out — again — how to run selenium...)

(I'll probably get to it this weekend.)

Very clever ideas blantantly ripped-off from
http://www.abeautifulsite.net/blog/2013/08/whipping-file-inputs-into-shape-with-bootstrap-3/

Issues:

I've not tested this with many browsers.

I'm not sure where to put the id="${oid}".  (Is it really even necessary?)
Putting on the file input element causes deform.js to focus it (if it's
the first field on the page) which, I guess because it is not visible,
results in unwanted scrolling.
@dairiki
Copy link
Contributor Author

dairiki commented Oct 4, 2013

Rebased onto current tip. I haven't yet looked into the firefox rendering issues or selenium.

@dairiki
Copy link
Contributor Author

dairiki commented Oct 5, 2013

Just tested this with Firefox 24.0 (linux) and it looks fine. What Firefox were you using?

@dairiki
Copy link
Contributor Author

dairiki commented Oct 5, 2013

Seems to work fine (with the latest commit) in IE9.

Almost works in IE8. It looks fine and is usable, but when you select a file, javascript errors prevent the display
of the selected file name. (I suspect it would work with jquery 1.x instead of jquery 2, though I didn't try that)

Illegible in IE7 (but usable, barely if you can guess how to use it.)

Move what's left of the custom CSS into form.css.
The .input-group has display: table.  This appears to cause Firefox to
ignore the overflow: hidden.  This results in the file select dialog being
triggered by clicks anywhere in a large region above and/or to the left
of the file widget.
@dairiki
Copy link
Contributor Author

dairiki commented Oct 7, 2013

I’ve now converted this to a jquery plugin. This simplifies file_upload.pt, and makes it so that browsers without js (or that are unsupported by jquery 2) degrade gracefully.

If you want to dink with the plugin, you can demo it at http://jsbin.com/OxOQoDa/latest

@mcdonc I still haven’t been able to reproduce the ff manglings you screenshotted. Firefox 24.0 works fine for me. (Iceweasel 3.5.16 works, too, if jquery 1.X is used.)

@tseaver tseaver closed this Sep 15, 2015
@tisdall
Copy link
Contributor

tisdall commented Sep 15, 2015

sorry, guys.. I submitted an issue about the deform2 branch being dead and confusing so @tseaver deleted it. Can you resubmit this on the master branch?

@dairiki
Copy link
Contributor Author

dairiki commented Sep 16, 2015

This has been rebased and resubmitted as PR #280.

dairiki added a commit to dairiki/deformdemo that referenced this pull request Sep 16, 2015
dairiki added a commit to dairiki/deformdemo that referenced this pull request Sep 16, 2015
@stevepiercy stevepiercy modified the milestone: 3.0.0 Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants