wip: Kaminari pagination
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
class PartiesController < ApplicationController
|
||||
# Display all events
|
||||
def index
|
||||
@parties = Party.includes(:user).upcoming.page(params[:page]).per(12)
|
||||
@parties = Party.includes(:user).upcoming.page(params[:page]).per(1)
|
||||
# @parties = Party.page(params[:page]).per(12)
|
||||
end
|
||||
|
||||
# Display desired event
|
||||
|
||||
25
app/views/kaminari/twitter_bootstrap/_paginator.html.erb
Normal file
25
app/views/kaminari/twitter_bootstrap/_paginator.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<nav aria-label="Page navigation">
|
||||
<ul class="pagination">
|
||||
<% if paginator.prev_page %>
|
||||
<li class="page-item">
|
||||
<%= link_to 'Previous', url_for(page: paginator.prev_page), class: 'page-link' %>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="page-item disabled"><span class="page-link">Previous</span></li>
|
||||
<% end %>
|
||||
|
||||
<% paginator.page_range.each do |page| %>
|
||||
<li class="page-item <%= 'active' if page == paginator.current_page %>">
|
||||
<%= link_to page, url_for(page: page), class: 'page-link' %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if paginator.next_page %>
|
||||
<li class="page-item">
|
||||
<%= link_to 'Next', url_for(page: paginator.next_page), class: 'page-link' %>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="page-item disabled"><span class="page-link">Next</span></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</nav>
|
||||
@@ -39,7 +39,8 @@
|
||||
</div>
|
||||
|
||||
<div class="mt-8">
|
||||
<%= paginate @parties, theme: 'twitter_bootstrap' %>
|
||||
<%# paginate @parties, theme: 'twitter_bootstrap' %>
|
||||
<%= paginate @parties %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="text-center py-12">
|
||||
|
||||
Reference in New Issue
Block a user