Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to add an anchor/param to links with Kaminari?

I'm using pagination with Kaminari. It's working awesome.

One thing that I want for now is, adding #comment_section behind the url that Kaminari generates.

For example, my views is just like this. I'd like it to goes to the top of this section when page is loaded by clicking the link that Kaminari generated.

Is it possible?

<a name="comment_section">
<span id="comment">
 <%= render 'users/comment' %>
</span>
<%= paginate @comments, :window => 4 %>
like image 257
Foo Avatar asked Jan 10 '13 16:01

Foo


1 Answers

From the Kaminari documentation:

<%= paginate @users, params: { controller: 'foo', action: 'bar'} %>

So I guess you can modify it to have an anchor param, in your case:

<%= paginate @users, params: { anchor: 'comment_section' } %>

Hope this helps!

like image 96
MrYoshiji Avatar answered Nov 17 '22 08:11

MrYoshiji