Is anyone has tried to use this module for Drupal 8 with the masonry views module ?
I'm starting with D8 and I can't even detect when the ajax do the magic to patch the module
| Comment | File | Size | Author |
|---|---|---|---|
| #53 | infinite-scroll-images-first-2770773-53.patch | 2.04 KB | majid.ali |
| #52 | infinite-scroll-images-first-2770773.patch | 2.05 KB | majid.ali |
| #51 | support-masonry-2770773-51.patch | 1.02 KB | diogo_plta |
| #3 | vis-reverse-adding-logic-2770773-3.patch | 2.19 KB | nod_ |
| #7 | vis-reverse-adding-logic-2770773-5.patch | 3.02 KB | nod_ |
Comments
Comment #1
Anonymous (not verified) commentedAnansi_boy created an issue. See original summary.
Comment #2
Anonymous (not verified) commentedComment #3
nod_This patch reverse the process of adding items to the view by adding new ones instead.
This patch combined with #2771287: Fix initialization code makes masonry and VIS play nice.
Comment #4
nod_Ok no that doesn't work, paging is broken and click to load only reload the same page all the time.
Comment #5
sam152 commentedLets see if the tests work :)
Comment #6
sam152 commentedWell.. if the patch is broken, clearly these tests suck! :)
Edit: after manual testing, this actually seems to work fine for me? Using 8.2.x HEAD.
Edit: Nope, same issue as you describe.
Comment #7
nod_Ok now it works.
Comment #8
sam152 commentedThanks for working on this.
I've opened #2771483: Make tests assert the correct order of content being loaded. to make the tests better and #2771485: Adhere to JavaScript coding standards. to fix the JS coding standards (reverted the camel case to be consistent with the rest of the file).
This broke click to load, updated the selector and it seems to work now. I also experimented using Drupal.detachBehaviors instead of removeOnce, but no luck. This is unfortunately a touch more complex, but hopefully provides the most compatibility with other libraries and views JS.
Comment #9
sam152 commentedComment #10
sam152 commentedComment #12
sam152 commentedTagged 8.1: https://www.drupal.org/project/views_infinite_scroll/releases/8.x-1.1
Thanks again.
Comment #13
abaier commentedHey, I just followed the discussion about integrating/re-initiating istope/masonry with VIS, but could not find an answer to my problem.
I am just trying to integrate Isotope with Views Infinite Scroll, but manually, without an extra module. I can initiate Isotope from my custom js file, calling the specific selectors of my view, but after triggering the button to append more items, the view breaks. So I am searching for a way to use isotope's append method to layout the new items of $newRows. Any advice here?
Drupal 8.1.7
VIS 8.x-1.2
Comment #14
sam152 commentedAny reason not to use masonry? Don't they do practically the same thing?
Comment #15
abaier commentedThe main reason is that I would like to benefit from Isotope's filtering/sorting options. On the other hand I will be using the Packery layout mode to achieve a grid which is able to fill the empty gaps between items with varying dimensions.
Comment #16
abaier commentedWell, I managed to do it, but am not sure if this is best practice though. On the other hand some functions are still called twice.
I used a variable to specify that the initiation of isotope only fires once. Then I added a custom class to the already processed items. For the part after the VIS ajax call I used $(document).ajaxComplete for now, because I do not know how to target the specific one, to append the newly loaded items.
What do you think? Bulky or doable?
Comment #17
jo.st commentedThanks for this great module!
I am using Views Infinite Scroll with the Masonry Views module and the Masonry .grid-sizer approach for a responsive layout.
Views's Style Options: "Add views row classes" is checked, Column width in percentage. Also added my own CSS for Masonry.
Everything works fine except that new rows get an extra masonry container instead of just being appended to the existing masonry container.
Comment #18
jo.st commentedAfter looking at attar_eweev's patch for views-infinite-scroll.js I was able to find a working solution for my project.
var $newRows = $newView.find(contentWrapperSelector).children();The masonry container .masonry-layout is the direct child of contentWrapperSelector, not the new rows
view.$view.find(contentWrapperSelector).append($newRows);New rows should be appended to the masonry container instead of contentWrapperSelector
Comment #19
jo.st commentedI used existing classes in Masonry Views's views-view-masonry.html.twig to
check if masonry is involved and replaced children() with find()
Before the Patch:
There is a gap between the old and the new rows caused by the extra masonry container
After the Patch:
Everything works fine, all rows are placed in a single masonry container.
I use this patch in my current project, but I had no time to consider other use cases, configuration options etc.
Comment #20
jo.st commentedApart from the gap, the Masonry layout works fine, before and after the patch.
Comment #22
ahmad abbad commentedPatch #19 worked fine for me on version 8.x-1.3.
we need to commit this patch please.
Comment #23
tomasbarej commentedPatched #19 worked for me but only if all ajax views rendered on page has masonry plugin applied. I had combination of standard row display view and masonry on same page and to regular view new rows wasn't appended after ajax call.
Submitting patch that fixing this behaviour.
Comment #24
handkerchiefthe patches did not work for me. I create a new one with this change:
views_infinite_scroll: 8.x-1.5
masonry: 8.x-1.0-rc2
masonry_views: 8.x-1.0-rc1
drupal core: 8.3.7-dev
Comment #25
w01f commentedhandkerchief's patch works great - the only issue i can see is when an image is included in one of the new masonry fields that appears. normally you can set to "load images first" in the masonry settings in a view, but when using infinite scrolls it doesn't apply that setting to the new fields that appear.
any idea how to resolve this so it also loads images first for new masonry fields? current working example with images not loading first here - www.kobejet.com/speakraku
Comment #26
ion.macaria commentedUpdated patch from @handkerchief to get "images_first" functionality.
@W0LF please test. If you can't apply it, try manually.
Comment #27
ion.macaria commentedSorry, I forgot condition if images_first it's not selected.
New pach here.
Comment #28
w01f commented@ion.macaria
Hi ion, thanks so much for your quick response. I tried both of your patches, applying manually, but both left the images set apart from the rest of their masonry item content. If it would help to troubleshoot let me know and I can leave and link the test code on my site page.
Comment #29
ion.macaria commented@W0LF do you check images_first option in view?
After patching try view in incognito tab in your browser and rebuild drupal cache, or clear cache in your browser after cache rebuild.
If you want more help, you can write me on macaria_ion[at]yahoo.com.
Comment #30
handkerchief@ion.macaria
Thanks for the patch in #27. It works well. But there's a think: For a fraction of a second, when the view infinite scroll loads the new items, some of the already displayed items moved/reordered. It's not so smooth like here: https://masonry.desandro.com/v2/demos/infinite-scroll.html
Do you know what i mean? Can you see the same effect?
Comment #31
ion.macaria commented@handkerchief i think this is masonry version issue, not Infinite Scroll.
Comment #32
handkerchief@ion.macaria
You're right: https://www.drupal.org/node/2894069
Comment #33
handkerchiefbut is that correct that the new rows (page 2) are not added in the same container (class = views-infinite-scroll-content-wrapper)
Comment #34
handkerchiefbecause this issue is closed, i created a new one: https://www.drupal.org/node/2917271
Comment #35
ion.macaria commented@handkerchief i think the best way is to reopen this task, not duplicate.
Comment #36
handkerchief@ion.macaria
oho too late :) sorry about that. Hm... what now?
Comment #37
ion.macaria commented@Sam152 or @nod_ please reopen this issue.
@handkerchief please relate your issue with that and close it like duplicate.
Comment #38
handkerchiefI have done it days ago. But nothing has happened here so far. That's really sad. Is this not maintained?
Comment #39
pavelculacov commentedHere some help
after this worked.
Comment #40
handkerchief@Regnoy
Thanks for your input. I tried it with your code, but with the same result as in #33.
Or what do you mean with "after this worked"? :)
Comment #41
ion.macaria commentedThank you @Regnoy. I updated my patch.
Comment #42
handkerchief@ion.macaria You were faster than me ;) Because it's working, I changed the wrong line. thanks @Regnoy.
And the moved/reordered-effect appears now only the first time when I load new rows. afterwards not more, only the first time new rows are loaded... strange.
Comment #43
pavelculacov commented@ion.macaria thanks for creating so quick patch.
Comment #44
handkerchiefCan somebody apply this patch to the dev verison of this module? The bugfix workflow should not stop in this stage.
Comment #45
rgeerolfI would be great if it would be a setting of this module. Like you can choose between 'Append to existing container' or 'Create a new container'.
Because the behaviour to append could also be usable in non-masonry situations, eg. when you are building a CSS pattern with nth-of-type.
Comment #46
aveach.bfr commentedI just ran into a problem with the patch at #41: the replace method called on the view_name is .replace('_','-'), but that only replaces the first dash. Should it instead be .replace(/_/g,'-')? The selector was broken for a view name that had multiple underscores.
Comment #47
gemalmI needed to recreate the patch because I could not apply.
Comment #48
matthiasm11 commentedUsing the latest dev version of views_infinite_scroll and masonry, everything worked without installing an extra patch to let those 2 modules work together. Masonry uses Drupal.behaviours which are automatically reloaded when adding new view-rows, so there is no need to do an extra
$(object).masonry( 'appended', $newRows, true );.Remark: using a correct div-structure and class-naming in view-view.html.twig is important. The view-view.html.twig from the classy theme works.
Comment #49
steveoriolHello, here is the patch that I use for the lines added by "infinite_scroll" is well taken into account jute after their addition to the DOM.
used with:
"drupal/masonry_views": "1.x-dev" + "different_item_count-2852080-36.patch"
"drupal/views_infinite_scroll": "1.x-dev"
and the "view-view.html.twig" from the classy theme
Comment #50
diogo_plta commentedI´ve tried #49 but after load the content masonry can´t organize the items well, overlaying the new items by column. Maybe masonry is not getting items height. I´m starting to try a solution, do you have some tip?
Comment #51
diogo_plta commentedThis is an update of the patch #49, changing only one line for append new rows to masonry using imagesloaded.
Modified...
view.$view.find('.masonry-layout').masonry( 'appended', $newRows );
to
view.$view.find('.masonry-layout').imagesLoaded( function(){ view.$view.find('.masonry-layout').masonry( 'appended', $newRows ); } );
I don´t think it´s a good way to write this, but is working.
Used with:
"drupal/masonry_views": "1.x-dev" + "different_item_count-2852080-36.patch"
"drupal/views_infinite_scroll": "1.x-dev"
and the "view-view.html.twig" from the classy theme OR the bootstrap default template
This integration is very powerful, please, who have more experience, take a look. Let's conclude these dev versions. Thank you for all.
Comment #52
majid.ali commented#51 did not solve the problem mentioned in #33 for me. I used patch in #41 with suggestion in #46 and some minor changes.
Use the following versions:
"drupal/views_infinite_scroll": "1.x-dev"
"drupal/masonry_views": "1.x-dev"
You need to apply two patches in the following order in composer.json:
"https://www.drupal.org/files/issues/2020-01-24/13433832-60%2B2852080-40...." from issue https://www.drupal.org/project/views_infinite_scroll/issues/2852080
Then my patch. Copy the "view-view.html.twig" from the classy theme OR the bootstrap default template.
Comment #53
majid.ali commentedRe rolling patch as patch in issue https://www.drupal.org/project/views_infinite_scroll/issues/2852080#comm... got updated. Now using https://www.drupal.org/files/issues/2020-04-21/different_item_count-2852... along with re rolled patch.