S3 CORS upload widget doesn't appear to be compatible with the bootstrap theme.
Description:
On clicking upload, I don't see any POST requests to s3fs_cors when using the bootstrap theme. See attached console screenshots (Bootstrap and Seven)
This is on a fresh install as follows:
Drupal 7.39
Bootstrap 7.x-3.0 - running Jquery 1.9
jQuery Update 7.x-3.0-alpha2
S3 File System 7.x-2.2
S3 File System CORS Upload 7.x-1.4
When I change to Bootstrap 7.x-3.1-beta3, I get the same results, except I get an additional Error Notification:
Notice: Trying to get property of non-object in bootstrap_file_widget() (line 21 of /srv/bindings/1eed2f94f30243b5a152e2b0c8cda445/code/sites/all/themes/bootstrap/templates/file/file-widget.func.php).
Possible Cause:
I think this is could be caused by the fact that Bootstrap file input elements are themed with a 'button' instead of an 'input'. See these two similar issues on other projects:
- Element agnostic selection of submit button
- """Choose file"" button is missing in Bootstrap theme
Proposed solution:
If this is likely the reason, in order to deal with this and possible other themes, add a configurable selector in line with the solution proposed here: Link.
See also http://cgit.drupalcode.org/dragdropfile/diff/?id=d35b41e
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 2590221-bootstrap-compat.patch | 4.89 KB | fearlsgroove |
| #2 | Bootstrap.jpg | 198.79 KB | johnkareoke |
| #2 | Seven.jpg | 125.32 KB | johnkareoke |
Comments
Comment #2
johnkareoke commentedComment #3
coredumperror commentedShoot, I bet you're right. I wrote S3FS CORS based on another module, and what it did was take the existing file field render code, copy it, and tweak it into the CORS widget. With a different theme as the base file field code, I can totally see why it might have problems.
I'm afraid that I don't have the time to look into this right now, so I'd suggest sticking to the Seven theme, or not using S3FS CORS, for now.
Comment #4
fearlsgroove commentedIt doesn't work with bootstrap because it's too specific about the markup it targets in JS. Patch attached is more generic, lightly tested but it works fine with Seven as well as bootstrap-based themes.
Comment #5
fearlsgroove commentedComment #6
coredumperror commentedWhat are all those changes of "input" to ":input" all about? I've never seen a colon used in a selector in that way before.
Comment #7
fearlsgroove commented:inputis a pseudo selector in jquery that matches any form elements. Part of the issue is that bootstrap replacesinputs withbuttons. That means:inputstill matches butinputdoes not.https://api.jquery.com/input-selector/
Comment #8
coredumperror commentedAh, that makes perfect sense, then! I'll apply this patch forthwith.
Comment #10
johnkareoke commentedThanks @fearlsgroove. Have tested and this resolves my issue.