Rather than submitting a patch, I'm attaching a full module (since there currently isn't one on the front page).
All modifications are done to the module file only. What i've done (using hook_form_alter) is add an 'infinite pager' option to views pager. So, instead of needing to set your view to 'mini pager' you now set it to 'infinite pager'. This makes it so we no longer are overriding the behavior of mini pagers and have a proper way to pick infinite pager for a view.
Also, I added code to views_infinite_pager_preprocess_views_view that removes the header, footer, and admin links on all pages other than the first one. If you don't do this and have a header, footer, admin links, etc in your view, it'll display each time you load an infinite page. Showing the header, footer, etc is unnecessary I could imagine 95+% of the time and so I believe this code should be implemented permanently.
Lastly, I've also added a class 'infinite-page' to all 'infinite pages' (all but the first page). This allows you to style the 'break' between infinite pages. Sites (like twitter) make a line between infinite pages and this 'infinite-page' class will let you do the same if you choose.
Please test this and let's see if we can get a stable version 1 released.
Comment | File | Size | Author |
---|---|---|---|
#55 | views_infinite_pager.zip | 6.63 KB | cerup |
#53 | views_infinite_pager.zip | 6.62 KB | cerup |
#18 | views_infinite_pager.zip | 6.74 KB | cerup |
#5 | views_infinite_pager.zip | 6.75 KB | cerup |
#1 | views_infinite_pager.zip | 6.61 KB | cerup |
Comments
Comment #1
cerup CreditAttribution: cerup commentedNewer one that addresses this issue #826702: More link through t function. Please review.
Comment #2
meatbag CreditAttribution: meatbag commentedNo major bugs but some minor issues
1. It's better categorized as a views plugin.
2. I have a bottom border of every item.
On the first page, the border is displayed normally.
On the following pages, the border of the last item on each page disappears.
Also, we may need to add some option form to customize the infinite pager's behavior.
Like auto loading, limit of maximum pages etc.
Comment #3
cerup CreditAttribution: cerup commentedThanks meatbag.
I'm not the module maintainer, I'm just trying to kick-start this since it's been dead for a while. So in terms of categorizing, I think that has to be done by the developers.
If you can post a screenshot about what you mean in terms of the border, that would help. As I mentioned, I remove the header and footer from all but the first page. So if your border is applied to one of those, it will not show. However you can add this border to the new class I implemented 'infinite page' possibly.
If you're doing something like:
which adds a border to each row bottom, that works for me.
In terms of extra features, those are out of my personal expertise and should probably be made into another issue. I agree though, those are things I'm sure everyone would like.
My goal is to just get the initial infinite pager working that has at least the bare minimum working so we can release at RC1 at minimal since right now there isn't anything to download on the main page and therefore hard to get others to contribute.
Comment #4
cerup CreditAttribution: cerup commentedFound one 'bug'. Currently if there are two ajax pagers on a page, the java-script is applied to all of them (therefore ajax pagers that aren't infinite also get their next page appended rather than replaced). Anyone have thoughts on how to fix that? We could check for a 'infinite view' class and only apply the java-script if it's found, but I don't know if that's the most elegant solution.
Comment #5
cerup CreditAttribution: cerup commentedHere's another round to fix the multiple ajax pagers on a page problem.
I added a class 'infinite-pager' to the pages and modified the js file to check if the view has this class. If it does, then it appends the view and if it doesn't, it works like a normal view (replaces the view).
Not sure if this is the best way, but it fixes the above issue.
Comment #6
meatbag CreditAttribution: meatbag commentedMy pager setting is 10 elements per page.
On pages other than the first one, "11" elements are displayed.
The extra element is located in the "More>>" div and can't be found in the page source.
Comment #7
cerup CreditAttribution: cerup commentedCan you provide some more information? What type of row style is it (unformated, table, html list, etc)? Is it a page view or block? So far I'm unable to reproduce this.
Comment #8
meatbag CreditAttribution: meatbag commentedSorry, my own issue.
The module works great.
I think we can release a rc1. No major issues found in my testing.
Comment #9
cerup CreditAttribution: cerup commentedGreat to hear meatbag.
It's only been out for a few hours, so let's give it a day for people to try at least :) and then the module developers will have to sign-off and commit this if it's found to be stable (which hopefully it is).
Comment #10
meatbag CreditAttribution: meatbag commentedSome issues here
1.
When i click the more link, the previous page will automatically scroll down a bit which will make users lose focus on where they were.
When tested on a more link in a view which is not located in the bottom of a page, everything's ok.
Seems to be an issue caused by the behaviour of removing footer text?
2. Occasionally, when i click the more link, all the page content will disappear for a second or two, and then reappear during the loading of the next page.
3. If you click the more link multiple times, multiple pages will be attached to the current one.
If you click three times, the next three pages will be loaded.
Comment #11
meatbag CreditAttribution: meatbag commented4. If i choose back to Full pager, the actual settings will be No pager. If i choose No pager, the actual one will be Full pager.
Seems that this module interferes the views' config form.
Comment #12
cerup CreditAttribution: cerup commented1. Not completely sure what you mean. Do you have anything you can show? This shouldn't be related to removing footer as it only removed the footer of following pages (not the original).
2. Sounds like maybe it's being pressed when javascript isn't fully loaded and therefore it's doing a full page load. I could be wrong - nothing in the code has something to remove all page content during load.
3. Yeah, we'll have to figure a way to avoid this. I noticed facebook has the same issue so apparently it must not happen to users that often (continuing to click before content loads).
4. I've fixed this one and will post an update once I get a chance to look at the other ones. In the meantime if you want to change it yourself you can change the line in .module:
to
Comment #13
thebuckst0p CreditAttribution: thebuckst0p commentedcerup, THANK YOU for taking this on. I haven't had any time to work on this module since releasing it (by request at DrupalCon), so I wasn't sure if I should have released it at all, but with you taking it on I'm glad I did.
I'd like to make you a full maintainer of the module, but when I try to give you access it says you don't have a CVS account. If you apply for one I'll vouch for you and you can officially take over the module from that point.
I also have my copy of the module in Git, at http://github.com/newleafdigital/views_infinite_pager, if you want I can give you access to that too.
I'll spend an hour or two on your module and the other issues in the queue today and hopefully will release it until you get a CVS account.
Thanks,
Ben
Comment #14
cerup CreditAttribution: cerup commentedNo problem thebuckst0p. I've wanted this for a while and recently saw another module implement the pluggable pager (which we thought wasn't possible in views 2). So that gave me a boost to make the small changes.
I'm not completely sure that I'm capable of being maintainer of this either since 1) I don't know that I have the time (like yourself), 2) I don't know that I have the know-how to implement all the other things people are going to want (I don't know how to add other UI settings to allow user control), etc. I could possibly be co-maintainer with someone else; it's hard to say.
If we can get a version 1 release out, I think we should then create a new issue and post it on the front page that says looking for either maintainer or co-maintainer. What do you think?
Comment #15
cerup CreditAttribution: cerup commentedIn terms of the bugs above:
Does this happen when there's a footer only? I see that the way I implemented footer is wrong.
I've fixed the footer issue (not sure if it's same as this) by adding
in the javascript file after $newView.hide().insertAfter($view).slideDown(1000);
This will be included in the next release I post. This moves the footer to the end of the page when more pages are loaded.
Not sure about this - need more information. Sounds like javascript isn't loading fully.
Need to be able to disable the button while it's loading?? This is a common problem with drupal in general and people hitting submit more than once.
As mentioned this is fixed, see #12.
Comment #16
meatbag CreditAttribution: meatbag commented1. The fix doesn't work for me.
After the loading and attaching process, the whole page goes down like 30 pixels.
2. The js is fully loaded.
Normally, the browser loads the next page in the background and then attach the page.
But when i have this issue, the whole page content disappears in the loading process, and shows up after the browser finishes loading and attaching next page.
Comment #17
YK85 CreditAttribution: YK85 commentedFor #3, I came across #751208: ajax.module: An unknown error has occurred - when someone clicks 'submit' twice or more which allows "disabling the submit button when it's first click and enabling it back again when it has finished the request". I don't know anything about programming but posting just hoping that it is an idea that may apply.
I also use http://drupal.org/project/hide_submit module to disable submit buttons on forms.
I would like to help test when the next version is posted with the fixes mentioned above.
Thanks
Comment #18
cerup CreditAttribution: cerup commentedHere's a new one that fixes:
- the problem with full pager = no pager problem.
- a page footer not loading in the right position. Now it's always placed at the bottom.
You can see an example of infinite pager here: http://techsparked.com/framework/squidy Click the left or right sidebar 'more' links.
Comment #19
cerup CreditAttribution: cerup commentedComment #20
freelylw CreditAttribution: freelylw commentedtable view with labels, every time when click the 'more' the label will show again.
Comment #21
cerup CreditAttribution: cerup commentedThanks freelylw, we'll have to come up with a javascript way to hide it.
Meanwhile, you can hide this in CSS by doing
That'll hide the labels for all tables other than the first loaded one. Please confirm if that works for you.
Comment #22
apadernoFYI, I made cerup maintainer of this project.
Comment #23
youkho CreditAttribution: youkho commentedDunno if someone faced same problem as me but when the module is activated i can't disable paging anymore when i choose "no pager" it won't change and the full paging is activated maybe it's not related to this module but still that happens only when i activate views_infinite_pager
Comment #24
cerup CreditAttribution: cerup commentedWhich version did you download? I believe that was fixed in the latest one.
Comment #25
youkho CreditAttribution: youkho commentedThe one attached in #18 and i assume it's the latest one.
Comment #26
cerup CreditAttribution: cerup commentedOk, i'll take a look at it again.
#18 was supposed to fix:
- the problem with full pager = no pager problem and 'no pager' = full pager
Comment #27
youkho CreditAttribution: youkho commentedThanks
Comment #28
j4 CreditAttribution: j4 commentedHi,
I used the zipped version in #18 also. While i get the infinite pager option in the pager selection in views, it doesnt work, for this option also the full pager gets switched on. Any help you can offer on this?
Thanks
Jaya
Comment #29
j4 CreditAttribution: j4 commentedSorry! My fault. Had not switched on Ajax. Now the more button works, but instead of the next 3 items coming below the first three like how it does in your squidy site, it replaces the first three. Could this be something in my sites css?
Thanks
Jaya
Comment #30
carvalhar CreditAttribution: carvalhar commentedhi,
i installed this version of this module but i can't see it listed at my views...
how can i setup this module? views pager only shows full and mini.
thanks
Comment #31
carvalhar CreditAttribution: carvalhar commentedHi, i could install it trougth #18.
I have ajax and i see the more button, but it doesn't load with ajax, it sends a new request and the page refresh.
can someone helpe me?
thanks.
*edit*
I noticed that views_infinite_pager.js wasn't appearing at source code, so i manually add it and other views JS files, but it didn't worked it ajax. Although, no error was given.
Comment #32
carvalhar CreditAttribution: carvalhar commentedHum............i'm really not understaning this code...
where are you defining to use "alternateAjaxViewResponse" ??
and i don't know why even in the views ui admin area i can't see the js from this module been added...
Any clue?
Comment #33
carvalhar CreditAttribution: carvalhar commentedi noticied that with garland theme this module is working properly.
But with my theme it isn't...i don't know what am i missing with my theme.
i saw some themefucntions in this .module file
what should be wrong? does anyone have an idea?
*EDIT: I found a solution, i had to use template php and a preproces page function where i embed the view*
Comment #34
YK85 CreditAttribution: YK85 commentedCould you kindly share the code necessary. Thank you very much!
Comment #35
carvalhar CreditAttribution: carvalhar commented@yaz085: sure, here goes:
template.php :
then at your page.tpl you print the var:
<?php print $embedded_view; ?>
Comment #36
cerup CreditAttribution: cerup commentedSo it's working now carvalhar?
Comment #37
marcvangendHi , it seems as if the most development activity is going on in this issue. I just wanted to let you know that I posted a patch for a new feature in #968626: Automatically load next 'page'. I hope it can be included in the first stable version.
Comment #38
pribeh CreditAttribution: pribeh commentedHi, I don't get why the js is being attached in garland but not in my custom themes. I can't use the code in #35 because I'm not embedding views. Help.
Comment #39
pribeh CreditAttribution: pribeh commentedConsidering that this version is not in CVS yet I thought I'd file a bug report here. I'm not sure if this is an issue with Views Flag Refresh (project/views_flag_refresh) or this module yet however in combination the two produce some weird results. Views Flag refresh lets you ajax refresh a view upon hitting a flag link. If you have the two modules in use and hit a flag the view will refresh but with a huge gap (say 1000px) between the top of the view and the view content.
Comment #40
pribeh CreditAttribution: pribeh commentedHey, so I've run some more tests on this and it works great except I can't get it to work in any other theme than garland and I'm really not sure why. I've tried loading the javascript in on my page template or in my .info files but I'm still getting an "array" printout where the more button should be. Any help would be super appreciated.
Comment #41
pribeh CreditAttribution: pribeh commentedAlso, the js file shows up in the firebug but the view just ain't picking it up. Themes I'm using are based off of the tao or zen themes.
Comment #42
pribeh CreditAttribution: pribeh commentedOk, so I figured out that my custom themes were overriding the Views pager in a way that conflicted with this module.
But I have confirmed that there lies some sort of compatibility issues with the Views Flag Refresh module (http://drupal.org/project/views_flag_refresh). It appears as if the javascript breaks. I will investigate further and see if I can debug it but my skills are limited in this regard.
Comment #43
carvalhar CreditAttribution: carvalhar commentedi'm not sue about your case, but just to remember, all js need to be added at template php file or page tpl.
Comment #44
chuckbar77 CreditAttribution: chuckbar77 commentedsubscribing
Comment #45
arithok CreditAttribution: arithok commentedHi, I try this module (#18) n have problem with image hover (hover preview modules). Image hover in next page same with image hover in page 1.
- http://drupal.org/project/hover_preview
- http://gochicorgohome.com/shop/15975,242,49668 (sites with hover image)
Any solutions?
Thx
Comment #46
Milosavlevski CreditAttribution: Milosavlevski commentedViews Infinite Pager has issues with Calendar block (patched for AJAX support). When I click on next/previous buttons in the calendar, new block renders bellow the existing, instead of replacing the existing one.
Update:
I fixed it by changing the following code in views_infinite_pager.js:
Drupal.attachBehaviors($view.parent());
to:
Drupal.attachBehaviors($view);
Comment #47
pribeh CreditAttribution: pribeh commented@milosavlevski, thanks for sharing the solution to your problem.
I'm experiencing a similar problem whereby if a module needs to refresh a view (with Views Infinite Pager enabled) using ajax the refreshed view will be rendered below the current view. I tried your code alteration but this did not seem to help in my case.
I'm using three modules - Facebook-style Statuses, Views Flag Refresh and Views Display Tabs - that all use ajax to refresh the view.
Comment #48
pribeh CreditAttribution: pribeh commentedI'm willing to put up a $60 bounty for anyone that can fix this conflict (the one I mention in comment #47) as I'm on a time-line here and require some assistance.
Comment #49
cerup CreditAttribution: cerup commented@milosavlevski, is the calendar set to 'inifinite pager'? If so, the behavior sounds correct. Infinite pager adds next pages below the previous. Otherwise, this is a bug.
@pribeh, can you explain the issue a bit more. It sounds like the behavior is acting correcting and maybe you're wanting a feature request. Views infinite pager should load a new page below the current page. For example, when you click 'next', instead of going to a new page, the next page is loaded below the current one which is the 'infinite' aspect. Are you looking for a different behavior?
Comment #50
pribeh CreditAttribution: pribeh commented@cerup. You could consider my issue a feature request but it depends on how you look at the issue. I believe the expected behavior of using the views infinite pager is for the next view to be loaded underneath the current view. However, in my case and I assume in others' as well, I require the current view to be refreshed (not paged) by other means in a more typical fashion.
So let me describe my setup. I have a viewpage setup with tabs (for switching between displays via ajax); I then also use the Facebook-style status form at the top of the page (which upon submission refreshes the view); i the also use views flag refresh to allow users to flag content (which then refreshes the view to reflect changes). In each of these cases the expected behavior from the end user is to see the view in front of them refresh (be replaced not paged or loaded below the current view). Finally, views infinite pager is being employed to load the next page below the current view and so only in this instance should the expected behavior be to load the new view display below the current view. Just to be clear, I really am essentially replicating Facebook news feed like behavior with all these functions.
So, I believe what's happening (however I may be totally off since I'm not a good programmer but a themer) is that views infinite pager is overriding Ajax behavior of the view and hence preventing other calls to refresh the page via Ajax from simply refreshing the current view. What I require is for views infinite pager to only override the behavior of the paging aspect of te view and not every other attempt at refreshingita display. Does this make sense?
If you need any more help understanding this just check out: dev.londonfuse.ca. Make an account an try submitting a status or flagging content. I currenty do not have views infinite pager setup because of the overriding behavior.
Thanks
Comment #51
cerup CreditAttribution: cerup commentedThanks pribeh, that makes more sense now.
Comment #52
Milosavlevski CreditAttribution: Milosavlevski commented@cerup: the Calendar module doesn't provide an option to choose pager for a block view, because probably it uses it's own pager, instead of using the Views pager.
The version from #18 fixes the issues with Calendar, but it has problems with exposed filters. The fix you provided doesn't work. Continuing the discussion in #930754: view with exposed filters and infinite pager has a bug.
Comment #53
cerup CreditAttribution: cerup commentedI'm attaching a new version with several fixes.
Please test and let me know if this one works for all the issues above. If it does, i'll commit and put it as RC1.
Comment #54
Milosavlevski CreditAttribution: Milosavlevski commentedOk, here we go:
There is a minor issue, as the module now renders just div.view-content, instead of div.infinite-page container, the fix you suggested in #21 doesn't work.
Comment #55
cerup CreditAttribution: cerup commentedThanks milosavlevski.
I added back the 'infinite-page' class, so now #21 will work. I'm going to commit and release this attached version as RC1. It sounds like most, if not all, current bugs are fixed.
Comment #56
pribeh CreditAttribution: pribeh commentedGreat work cerup!
Comment #57
cerup CreditAttribution: cerup commentedI've committed and made a 'first' release. It'll be up to download in about 10 minutes.
I'm marking this as fixed. If you have new bugs/issues, please create a new issue for them.