Hi, I''m using standard rails pagination (I know it''s not perfect but it suits me humble needs). I want to add an anchor to the url. Like making article/2?page=5 to article/2?page=5#content I haven''t found an option in the paginator. Can someone help me please? Thanks very much. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ernst Beiglböck wrote:> Hi, > I''m using standard rails pagination (I know it''s not perfect but it > suits me humble needs). > I want to add an anchor to the url. > Like making > article/2?page=5 > to > article/2?page=5#content > > I haven''t found an option in the paginator. Can someone help me please? > > Thanks very much.<a name="content"></a> Use this one above to navigate down to where you want the scroll to go :D -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sorry, but you misunderstood me. I want that a command like <%= pagination_links(@slide_pages) %> appends #content to all URLs it generates. So that you have <a href="article/2?page=5#content"> for example. On 2/14/07, Jamal Soueidan <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Ernst Beiglböck wrote: > > Hi, > > I''m using standard rails pagination (I know it''s not perfect but it > > suits me humble needs). > > I want to add an anchor to the url. > > Like making > > article/2?page=5 > > to > > article/2?page=5#content > > > > I haven''t found an option in the paginator. Can someone help me please? > > > > Thanks very much. > > <a name="content"></a> > > Use this one above to navigate down to where you want the scroll to go > :D > > -- > Posted via http://www.ruby-forum.com/. > > > >-- wer viel lest ist viel gebildet. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 2/13/07, Ernst Beiglböck <ernst.beiglboeck-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Sorry, but you misunderstood me. > I want that a command like > <%= pagination_links(@slide_pages) %> > appends #content to all URLs it generates. > So that you have > <a href="article/2?page=5#content"> > for example. >Just add something like this in your application_helper.rb: (modify the next and previous to add #content.) So in your view you would call <%=pagination(@slide_pages)%>. def pagination(pages) rvalue = "<span id=\"pagination\">" if pages.current.previous rvalue << link_to(''Previous page'', { :action => ''list'', :page => pages.current.previous}) rvalue << " | " if pages.current.next end if pages.current.next next_page = pages.current.next page_no = next_page.to_i - 1 rvalue << %(pg. #{page_no} of #{pages.length}) rvalue << " | " rvalue << link_to(''Next page'', { :action => ''list'', :page => next_page}) end rvalue << "</span>" rvalue end -- Andrew Stone --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks, it works On 2/14/07, Andrew Stone <stonelists-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 2/13/07, Ernst Beiglböck <ernst.beiglboeck-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Sorry, but you misunderstood me. > > I want that a command like > > <%= pagination_links(@slide_pages) %> > > appends #content to all URLs it generates. > > So that you have > > <a href="article/2?page=5#content"> > > for example. > > > > > Just add something like this in your application_helper.rb: (modify the next > and previous to add #content.) So in your view you would call > <%=pagination(@slide_pages)%>. > > def pagination(pages) > rvalue = "<span id=\"pagination\">" > if pages.current.previous > rvalue << link_to(''Previous page'', { :action => ''list'', :page => > pages.current.previous}) > rvalue << " | " if pages.current.next > end > > > if pages.current.next > next_page = pages.current.next > page_no = next_page.to_i - 1 > rvalue << %(pg. #{page_no} of #{pages.length}) > rvalue << " | " > rvalue << link_to(''Next page'', { :action => ''list'', :page => > next_page}) > end > rvalue << "</span>" > rvalue > end > > > -- > Andrew Stone > > > >-- wer viel lest ist viel gebildet. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---