Don't show 'next page' or 'previous page' where not applicable

This commit is contained in:
Omar Roth 2018-08-14 19:15:33 -05:00
parent c5bd5e6c6d
commit 2cedac8c58
3 changed files with 8 additions and 10 deletions

View file

@ -41,14 +41,14 @@
<div class="pure-g h-box"> <div class="pure-g h-box">
<div class="pure-u-1 pure-u-md-1-5"> <div class="pure-u-1 pure-u-md-1-5">
<% if page > 2 %> <% if page >= 2 %>
<a href="/channel/<%= ucid %>?page=<%= page - 1 %>">Previous page</a> <a href="/channel/<%= ucid %>?page=<%= page - 1 %>">Previous page</a>
<% else %>
<a href="/channel/<%= ucid %>">Previous page</a>
<% end %> <% end %>
</div> </div>
<div class="pure-u-1 pure-u-md-3-5"></div> <div class="pure-u-1 pure-u-md-3-5"></div>
<div style="text-align:right;" class="pure-u-1 pure-u-md-1-5"> <div style="text-align:right;" class="pure-u-1 pure-u-md-1-5">
<% if videos.size == 100 %>
<a href="/channel/<%= ucid %>?page=<%= page + 1 %>">Next page</a> <a href="/channel/<%= ucid %>?page=<%= page + 1 %>">Next page</a>
<% end %>
</div> </div>
</div> </div>

View file

@ -12,10 +12,8 @@
<div class="pure-g h-box"> <div class="pure-g h-box">
<div class="pure-u-1 pure-u-md-1-5"> <div class="pure-u-1 pure-u-md-1-5">
<% if page > 2 %> <% if page >= 2 %>
<a href="/search?q=<%= query %>&page=<%= page - 1 %>">Previous page</a> <a href="/search?q=<%= query %>&page=<%= page - 1 %>">Previous page</a>
<% else %>
<a href="/search?q=<%= query %>">Previous page</a>
<% end %> <% end %>
</div> </div>
<div class="pure-u-1 pure-u-md-3-5"></div> <div class="pure-u-1 pure-u-md-3-5"></div>

View file

@ -38,14 +38,14 @@
<div class="pure-g"> <div class="pure-g">
<div class="pure-u-1 pure-u-md-1-5"> <div class="pure-u-1 pure-u-md-1-5">
<% if page > 2 %> <% if page >= 2 %>
<a href="/feed/subscriptions?max_results=<%= max_results %>&page=<%= page - 1 %>">Previous page</a> <a href="/feed/subscriptions?max_results=<%= max_results %>&page=<%= page - 1 %>">Previous page</a>
<% else %>
<a href="/feed/subscriptions?max_results=<%= max_results %>">Previous page</a>
<% end %> <% end %>
</div> </div>
<div class="pure-u-1 pure-u-md-3-5"></div> <div class="pure-u-1 pure-u-md-3-5"></div>
<div style="text-align:right;" class="pure-u-1 pure-u-md-1-5"> <div style="text-align:right;" class="pure-u-1 pure-u-md-1-5">
<% if (videos.size + notifications.size) == max_results %>
<a href="/feed/subscriptions?max_results=<%= max_results %>&page=<%= page + 1 %>">Next page</a> <a href="/feed/subscriptions?max_results=<%= max_results %>&page=<%= page + 1 %>">Next page</a>
<% end %>
</div> </div>
</div> </div>