comments = DiaryComment.where(:users => @user)
comments = comments.visible unless can? :unhidecomment, DiaryEntry
- @params = params.permit(:display_name)
+ @params = params.permit(:display_name, :before, :after)
@comments, @newer_comments_id, @older_comments_id = get_page_items(comments, [:user])
end
<% end -%>
</table>
- <%= render "pagination", :newer_key => "diary_entries.comments.newer_comments",
- :older_key => "diary_entries.comments.older_comments",
- :newer_id => @newer_comments_id,
- :older_id => @older_comments_id %>
+ <%= render "shared/pagination",
+ :newer_key => "diary_entries.comments.newer_comments",
+ :older_key => "diary_entries.comments.older_comments",
+ :newer_id => @newer_comments_id,
+ :older_id => @older_comments_id %>
<% end -%>
<%= render @entries %>
- <%= render "pagination", :newer_key => "diary_entries.index.newer_entries",
- :older_key => "diary_entries.index.older_entries",
- :newer_id => @newer_entries_id,
- :older_id => @older_entries_id %>
+ <%= render "shared/pagination",
+ :newer_key => "diary_entries.index.newer_entries",
+ :older_key => "diary_entries.index.older_entries",
+ :newer_id => @newer_entries_id,
+ :older_id => @older_entries_id %>
<% end %>
<% unless params[:friends] or params[:nearby] -%>
<ul class="pagination">
<% if newer_id -%>
<li class="page-item">
- <%= link_to t(newer_key), @params.merge(:after => newer_id), :class => "page-link" %>
+ <%= link_to t(newer_key), @params.merge(:before => nil, :after => newer_id), :class => "page-link" %>
</li>
<% else -%>
<li class="page-item disabled">
<% if older_id -%>
<li class="page-item">
- <%= link_to t(older_key), @params.merge(:before => older_id), :class => "page-link" %>
+ <%= link_to t(older_key), @params.merge(:before => older_id, :after => nil), :class => "page-link" %>
</li>
<% else -%>
<li class="page-item disabled">
+++ /dev/null
-<nav>
- <ul class="pagination">
- <% if newer_traces %>
- <li class="page-item">
- <%= link_to t(".newer"), params.merge(:before => nil, :after => traces.first.id), :class => "page-link" %>
- </li>
- <% else %>
- <li class="page-item disabled">
- <span class="page-link"><%= t(".newer") %></span>
- </li>
- <% end %>
-
- <% if older_traces %>
- <li class="page-item">
- <%= link_to t(".older"), params.merge(:before => traces.last.id, :after => nil), :class => "page-link" %>
- </li>
- <% else %>
- <li class="page-item disabled">
- <span class="page-link"><%= t(".older") %></span>
- </li>
- <% end %>
- </ul>
-</nav>
<% end %>
<% if @traces.size > 0 %>
- <%= render "trace_paging_nav", :older_traces => @older_traces, :newer_traces => @newer_traces, :traces => @traces, :params => @params %>
+ <%= render "shared/pagination",
+ :newer_key => "traces.trace_paging_nav.newer",
+ :older_key => "traces.trace_paging_nav.older",
+ :newer_id => @newer_traces && @traces.first.id,
+ :older_id => @older_traces && @traces.last.id %>
<table id="trace_list" class="table table-borderless table-striped">
<tbody>
</tbody>
</table>
- <%= render "trace_paging_nav", :older_traces => @older_traces, :newer_traces => @newer_traces, :traces => @traces, :params => @params %>
+ <%= render "shared/pagination",
+ :newer_key => "traces.trace_paging_nav.newer",
+ :older_key => "traces.trace_paging_nav.older",
+ :newer_id => @newer_traces && @traces.first.id,
+ :older_id => @older_traces && @traces.last.id %>
<% else %>
<h2><%= t ".empty_title" %></h2>
<p><%= t ".empty_upload_html", :upload_link => link_to(t(".upload_new"), new_trace_path),