Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
views.module
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Jul 2015 at 03:35 UTC
Updated:
10 Oct 2015 at 15:44 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #1
jhodgdonComment #2
jhodgdonThis vanished. ??
Comment #3
mpotter commentedI'm having this same issue. Fresh install of beta12. Created a Grid view. Displays an image field using an image style. Set to 4 columns.
The nodes (images) each show on separate lines, rather than all in a row. This worked fine in beta9 (yeah I know, it's been a while since I've been able to do D8 testing).
Looking at the markup, the columns are set to 25%, but have "display: block". Changing this to "display: inline-block" fixes the problem. But not sure where to apply this change in D8.
Comment #4
cilefen commentedI tried it too.
Comment #5
cilefen commentedI am looking for the commit that may have done this. It could be #2329917: Move views classes from preprocess to templates but that is just an early guess.
Comment #6
cilefen commentedComment #7
cilefen commentedI have looked back as far as beta8 and the regression is there.
Comment #8
dawehnerMeh, I hate if things randomly breaks. Let's ensure that this doesn't happen in the future.
Comment #9
dpiGrids were working on page displays in beta11, but not in admin preview
Comment #10
dawehnerDoes that mean we also somehow miss to add CSS files in preview?
Comment #11
dpiThe earliest version of D8 I have on this machine is beta2, page views work, preview does not work.
An up to date version of D7 + Views have both operating correctly.
Perhaps the admin preview was not ported completely for D8? The page view issue is recent as I generated the image on the Avatars project page with grid view on beta11.
Comment #12
davidhernandezIt looks like we're getting the right classes.
views-view-grid horizontal cols-4 clearfixDid we lose some CSS at some point?
Should this be critical? I don't think we want to ship with broken displays.
Comment #13
davidhernandezviews.module.css is not being loaded.
Comment #14
cilefen commentedOn beta 7, Bartik works but not Seven.
Comment #15
cilefen commentedThis has been broken a while - I am back to beta 5 and it is the same thing as beta 7: Bartik works but not Seven
Comment #16
davidhernandezThe code to attach the library is in ViewExecutable.php
Is this not executing?
The library itself is registered fine. I can force it to be added directly in a theme info file.
Comment #17
cilefen commentedBeta 1 is the same thing as beta 7 - I am not looking back any more.
Comment #18
cilefen commentedMaybe DisplayPluginBase::buildBasicRenderable() should be attaching the library from the element in ViewExecutable.
Comment #19
cilefen commentedThis is a test to see if I am in the right place. This fixes it for Bartik. This is not how one would really fix it.
Comment #21
cilefen commentedThis fixes it in Seven and Bartik. Again, this is not an elegant solution.
Comment #23
chernous_dn commentedI think need to attached styles in
views.theme.incin functiontemplate_preprocess_views_view_gridComment #24
chernous_dn commentedAnd screenshot in preview.
Comment #25
davidhernandezI don't think this is actually a grid problem. Views is not attaching the views.module library. It is manifesting itself with the grid, because the only CSS in that file is for table and grid displays.
Comment #26
cilefen commentedComment #27
chernous_dn commentedUpdate patch #23 add attached for table.
Comment #28
chernous_dn commentedAdd screenshot.
Comment #29
dawehnerI'm a bit confused, should not the actual preprocess_views_view add the library?
Comment #30
chernous_dn commented@dawehner may be styles added once in
template_preprocess_views_view? Or intemplate_preprocess_views_view_tableandtemplate_preprocess_views_view_gridattached twice them when they are needed.Comment #31
davidhernandezYeah, what I was trying to get across in #25 is that this isn't just about the grid. Attaching the library in that construct() doesn't work. I don't know enough about Views to know if it should work, or we should be moving it elsewhere. Maybe the theme system could once process attachments at that level, but now can't? I don't know. But if the attachment line is moved, it should be someplace general, like preprocess_views_view.
I suppose it could live in _view_grid and _view_table if we are ok with saying that this css only matters for those two and don't want it getting include for others. But, in that case, we should probably change the name of the library.
Comment #32
chernous_dn commented@davidhernandez I tested and add to
template_preprocess_views_viewand it works fine. But it is necessary to do it?Comment #33
dawehnerYeah exactly. Maybe someone adds some generic CSS and then we basically end up with the same bug as this issue again.
Comment #34
chernous_dn commented@dawehner update patch #27 attached style in
template_preprocess_views_viewtested works fine. Probably it would be more correct.Comment #35
chernous_dn commentedAdd screenshot.
Comment #37
chernous_dn commentedUpdate patch #34.
Comment #38
dpiThis is a different path, much simpler.
Turns out
$view->elementwas being assigned a new value. This path simply merges in defaults.Cause #2381277: Make Views use render caching and remove Views' own "output caching" (15c848bd6)
Comment #39
cilefen commented@dpi That is the problem I was trying to overcome in #21. #38 is simpler.
Comment #42
davidhernandezThe fail is because the json response data is now missing the add_css command.
...but this is ok, right? Since the css is actually already in the page, it doesn't need to get added again. If so, we just need to update the ViewAjaxTest test.
To actually test this change we can put an assert looking for the css file, instead of creating a new test, if there is some place generic to do it. Look for a plain "Does this View display" web test.
Comment #43
chernous_dn commentedTested patch #38 it does not work for view (add screenshot). So may be patch #27 is correct?
Comment #44
dpiIt works, clear your cache.
Comment #45
chernous_dn commented@dpi I clear cache, but still not work for edit views.
Comment #46
dpiThree issues that need an answer:
Comment #47
dpi@Chernous_dn patch does not fix admin previews. That issue existed before the regression and seems unrelated. See #46 1:1
Comment #48
chernous_dn commented@dpi I'm talking about the patch #27 it works for page, edit views and ajax rebuild views.
Comment #49
dpiI understand it works, but I would like to get a Views maintainer to take a look at the issue to see if it is the correct resolution.
I would like to know why adding the CSS into Element/View::getInfo() is not a better fix, and why that also does not work.
#27 would not be a final fix as you would have to remove existing code from ViewExecutable.
Comment #50
chernous_dn commented@dpi I understand, thanks for the explanation.
Comment #51
dawehnerMh did anyone tried to research why #38 fails for ajax? If the proper defaults are merged it, it sounds like a good change.
Comment #52
davidhernandezSee #42.
Comment #53
dawehnerWell right, but why does that break the admin preview, according to @dpi on IRC.
Comment #54
dpiTurns out AJAX test is getting a different response to what my browser receives.
Firefox views preview
ViewAjaxTest JSON response
Thats why tests are OK in head I guess
Comment #55
davidhernandezDunno, but I can confirm the preview is not working. I guess the construct in ViewExecutable was a better place to put it initially, and that's why it was there. Does the ajax request then not hit any pre-rendering?
Comment #56
olli commented$executable->destroy();in ViewUI::renderPreview() seems to reset$executable->elementand lose the attached default library that is set in __construct, see #16.Comment #57
olli commentedWould this work?
Comment #59
davidhernandezNot sure of the fix, but it works. The CSS is there for the page and preview. Obviously, attaching the library for all Views will make it work, I'm just not entirely clear of the original intention.
The add_css would not be in the response because the CSS is already there, so I removed that from the test. Makes sense?
Comment #60
mpotter commentedWhat's the status of this one? Is the patch in #59 the current recommended solution? #59 works for me on both the admin preview and main page showing the view. But don't know enough about the other issues in this thread to mark it RTBC yet.
Comment #61
webchickLooks like we're still missing some test coverage here.
Comment #62
jhedstromIt should be ok to add the CSS on all views (
views.module.cssis quite small).This adds a test to check for that file on grid views (I picked the grid test since that prompted this issue initially).
Comment #65
davidhernandezWe have test coverage now. Any takers to review?
Comment #66
pixeliteI applied the patch in #62 and the grid CSS now works in preview and in the Bartik theme.
Comment #67
pixeliteBefore patch in #62

After patch in #62

Comment #68
espurnespatch #62 works perfect. Thank you jhedstrom
Comment #69
alexpottCommitted 3d0a938 and pushed to 8.0.x. Thanks!