I have an array of posts, which could be list of all posts, or posts of certain user, or posts from a tag search. I present it as a paginated list, with title and brief summary. when the user selects a post, I show the whole thing on next page. Right now, I just have a back link to the list, but I''d like to implement go to next / prev post in list. This is tricky because the list is gone, of course, and it wouldn''t be easy to save it, and not easy to calculate for each post b/c it''s not just "find the next/prev one in the posts table" I''m using the google interface and they don''t have this implemented either. the nexy/prev actually goes to the next/prev article in the entire group and not, for example, in the search result. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> I have an array of posts, which could be list of all posts, or posts > of certain user, or posts from a tag search. I present it as a > paginated list, with title and brief summary. when the user selects a > post, I show the whole thing on next page. > > Right now, I just have a back link to the list, but I''d like to > implement go to next / prev post in list. This is tricky because the > list is gone, of course, and it wouldn''t be easy to save it, and not > easy to calculate for each post b/c it''s not just "find the next/prev > one in the posts table" > > I''m using the google interface and they don''t have this implemented > either. the nexy/prev actually goes to the next/prev article in the > entire group and not, for example, in the search result.On the initial list page setup a global javascript array (or put it in a cookie or something else persistent) that contains a list of all the id''s of the posts themselves (in the right order). Then on an individual post page you can get the prev/next posts by finding the current id in that array and looking at the array element just before and just after it. -philip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
you should know the ID of the object so can you run a query to get the next or previous post? Just a though WW On Nov 30, 4:13 pm, Philip Hallstrom <ra...-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote:> > I have an array of posts, which could be list of all posts, or posts > > of certain user, or posts from a tag search. I present it as a > > paginated list, with title and brief summary. when the user selects a > > post, I show the whole thing on next page. > > > Right now, I just have a back link to the list, but I''d like to > > implement go to next / prev post in list. This is tricky because the > > list is gone, of course, and it wouldn''t be easy to save it, and not > > easy to calculate for each post b/c it''s not just "find the next/prev > > one in the posts table" > > > I''m using the google interface and they don''t have this implemented > > either. the nexy/prev actually goes to the next/prev article in the > > entire group and not, for example, in the search result. > > On the initial list page setup a global javascript array (or put it in a > cookie or something else persistent) that contains a list of all the id''s > of the posts themselves (in the right order). > > Then on an individual post page you can get the prev/next posts by finding > the current id in that array and looking at the array element just before > and just after it. > > -philip--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---