我不能在宝石'will_paginate_infinite'上使用无限滚动作为导轨4。
这应该可以进行无限滚动,但是它只显示页面“ 1,2,3,4 ...”,我必须单击以转到没有无限滚动的另一页。
<%= infinite_append ".historic-list ul", { partial: "show_sections/historic_section", collection: @historic } %>
这是宝石的仓库:will_paginate_infinite
我的代码:
_historic_section.html.erb
<div class="container" style="height: 400px;overflow: auto;">
<br>
<ul class="list-group historic-list">
<%
@historic = PaperTrail::Version.where(event_id: @event.id).order(:created_at).paginate(:page => params[:page], :per_page => 15)
@historic.each do |version|
%>
<li class="list-group-item">
<%= version.created_at.strftime("%d de %B del %Y a las %I:%M:%S %p") %>
-
<strong><%= !Employee.find_by(user_id: version.whodunnit.to_i).nil? ? Employee.find_by(user_id: version.whodunnit.to_i).full_name : 'N/A' %></strong>
<% case version.event
when 'create' %>
creó <%= get_name_class(version.item_type) %> <%= get_message_by_class(version).html_safe %>
<% when 'update' %>
actualizo <%= get_name_class(version.item_type) %> <%= get_message_by_class(version).html_safe %> <%= get_message_update(version).html_safe %>
<% when 'destroy' %>
elimino <%= get_name_class(version.item_type) %>
<strong>'<%= get_message_delete_by_class(version).html_safe %>'</strong>
<% end %>
</li>
<% end %>
</ul>
<%= will_paginate @historic, renderer: WillPaginateInfinite::InfinitePagination %>
</div>
show.js.erb
<%= infinite_append ".historic-list ul", { partial: "show_sections/historic_section", collection: @historic } %>