class Grapple::Components::KaminariPagination
Generates paging links using Kaminari.
@example
<%= table_for(columns, Post.page(2)) do |t| %> <%= t.footer do %> <%= t.pagination %> <% end %> <% end %>
Public Instance Methods
render(paginate_parameters = {})
click to toggle source
# File lib/grapple/components/kaminari_pagination.rb, line 17 def render(paginate_parameters = {}) td_class = "" if records.instance_of?(Array) html = ' ' elsif !params[:query].blank? and records.empty? html = h(t(no_results_message)) td_class = "class='text-left'" else begin # paginate helper will throw an error if without_count is being used html = template.paginate(records) rescue Exception => e html = template.link_to_prev_page(records, "Previous Page") || "" html += " " if html html += template.link_to_next_page(records, "Next Page") || "" end end builder.row "<td colspan=\"#{num_columns}\" #{td_class}>#{html}</td>" end