Closed (fixed)
Project:
Feeds
Version:
7.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Jul 2014 at 15:20 UTC
Updated:
2 Jul 2015 at 00:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
megachrizIt's looking fine with me. I tested in Safari, Opera and Firefox.
Which browser and OS are you using? Have you checked if other file upload fields on your website do work, for example: a file field on a node?
Comment #2
kruser commentedI'm using Win 7 and Chrome. If you look at the console in the screenshot the file upload div is empty. Regular file fields look okay (see attached).
I'm using the 3.x-Dev branch of Bootstrap.
Comment #3
megachrizI have reproduced the issue! Once I tried the latest dev of the Bootstrap theme (I tried in 7.x-3.0 previously), the issue was visible in any browser I tried.
Code examination
I have looked through bootstrap's code and I see it is messing a lot with form elements. I then looked at
theme_feeds_upload()in feeds.pages.inc where also some weird things seem to happen. The combination of those two causes the issue you have.Cause of the issue
theme_feeds_upload(), Feeds seems to render the field in a form attribute called #description. This is weird, as this attribute should solely be used as help text for the field.#descriptionattribute, but puts it contents in an other attribute earlier in the process, apparently beforetheme_feeds_upload()is called.Conclusion
So both Bootstrap and Feeds do things not right. The Bootstrap theme assumes the contents of
#descriptionwill not be altered in a theme function (though I have to say it is pretty rare that#descriptionis altered in a theme function) and Feeds abuses#description.Solution
#description.theme_feeds_upload()and make it so that#descriptiondoes not change.Comment #4
megachrizI found out that change to
#descriptionwas made in the following commit (I found this out using git bisect):http://cgit.drupalcode.org/feeds/commit/?id=a24e15b9ec82ecacef1a4ad43741...
Comment #5
twistor commentedComment #6
twistor commentedComment #7
megachrizThis looks good in all the core themes. It looks less good in the bootstrap theme, but at least the file upload field is shown.
Comment #8
twistor commentedI'm open to suggestions.
I just tried to fix the bug and make the intended CSS apply.
Is Bootstrap commonly used as an admin theme?
Comment #9
twistor commentedLet's see...
Comment #10
megachrizThat was fast!
Patch in #6 is better.
I don't know, I hadn't heard of it until I saw this issue. Maybe we shouldn't be too concerned about the Bootstrap theme. It looks better in the Bootstrap theme without the "float: left", but there is no issue with core's file upload field where also a "float: left" is used (though when a file is uploaded using core's file upload field a text field is shown instead of a upload field).
Comment #11
twistor commentedComment #12
kruser commentedI use Bootstrap as a base theme for frontend only - I usually use Shiny or Seven for admin. The feeds file import page uses the frontend theme.
Comment #13
twistor commented@kruser, Right, that makes sense. In the next version, and current dev version, the import pages use the admin theme.
Comment #14
twistor commentedThis should still get fixed though, because the current method is totally dumb.
Comment #15
megachrizI've tested the patch in #11. While it is looking good in Bootstrap theme, it is not in Seven or Bartik on the initial import form (when yet no file is uploaded). See also attached image 2308343-11.jpg. The description of the file upload field seems to be floating to the right.
I've taken a different approach at this:
I've tested the result of my changes in the following themes:
Attached are:
Comment #16
joelpittetThis is much better, this also fixes FormTips module https://drupal.org/project/formtips
Although the label is outside of a .form-item div so my admin theme "Adminimal Theme" looks a bit funky.
https://drupal.org/project/adminimal_theme
Doesn't treat it the same as the rest of the form elements.

After this tweak patch:

Comment #17
joelpittetBy
I meant
And curious your thoughts on the minor change I made in #16
Comment #18
megachriz@joelpittet
Thanks for your compliments! Unfortunately, I have no time to look at this in depth until after DrupalCon. Quick glance, your change seems to make sense.
Comment #19
joelpittet@MegaChriz come say hi at DrupalCon, I'll be in the coder's lounge most of the time:)
Comment #20
Håvard commentedThanks for the patch in #16! Works like a charm :)
Comment #21
megachrizI looked in depth at the patch in #16 and unfortunately it's still not right :(. This is what it looks like in Bootstrap 7.x-3.1-beta2:

I think the file upload input field and the description div should be grouped together. This is what I intended to do in #15. This is part of the HTML output when using the patch in #16 (using Seven theme):

I tried to group the upload field and description, which initially resulted into this HTML:

But that resulted into the following in Bootstrap 7.x-3.1-beta2:

I then checked the HTML output of the core image upload field and I saw the label is completely seperated from the image preview and the image widget data. So ideally, the "feeds-file-info" and the file upload field should be wrapped inside one div, seperately from the label.

In the attached patch I wrapped the upload input field and the description div in a div called "feeds-file-upload". I also wrapped "feeds-file-info" and "feeds-file-upload" in another div called "feeds-file". This results into the following HTML:

I checked a few themes (Bootstrap, Adminimal, Seven, Bartik, Shiny, Garland), it seems to look well now.
Comment #22
joelpittetAwesome, thanks @MegaChriz that change seems to work great! And nice to meet you in Amsterdam, hopefully you didn't get sick being near me, I was not well for most of it:(
Comment #24
twistor commentedLooks good to me.
I added a bit of a bottom margin to un-crowd things on 7, and check_plain'd the filename.
Comment #25
joelpittetSweet thank:)
Comment #27
jurgenhaasUnfortunately, this fix is not in the alpha-9 release. Any idea why?
Comment #28
megachriz@jurgenhaas
See the release notes of 7.x-2.0-alpha9.
Comment #29
jurgenhaasOh thanks. For the purpose of other users with the same issue I've re-rolled the commit to properly work with the alpha-9 release.
Comment #30
capfive commentedthe dev version fixed this for me, would be good to roll it into alpha asap as with the current security update things got a little messy but thanks for the patch!