Browse Source

Generisize pagination links

pull/619/head
baarkerlounger 3 years ago
parent
commit
cb1c136c98
  1. 7
      app/views/pagy/_nav.html.erb

7
app/views/pagy/_nav.html.erb

@ -1,11 +1,10 @@
<% link = pagy_link_proc(pagy) -%> <% link = pagy_link_proc(pagy) -%>
<% if pagy.pages > 1 %> <% if pagy.pages > 1 %>
<nav class="app-pagination" id="pagination-label" aria-label="results navigation"> <nav class="app-pagination" id="pagination-label" aria-label="results navigation">
<ul class="app-pagination__list"> <ul class="app-pagination__list">
<li class="app-pagination__item app-pagination__item--prev"> <li class="app-pagination__item app-pagination__item--prev">
<% if pagy.prev %> <% if pagy.prev %>
<a class="app-pagination__link" href="<%= "/logs?page=#{pagy.prev}" %>"> <a class="app-pagination__link" href="<%= "#{request.path}?page=#{pagy.prev}" %>">
<% end %> <% end %>
<span class="app-pagination__link-title"> <span class="app-pagination__link-title">
<svg class="app-pagination__icon" xmlns="http://www.w3.org/2000/svg" height="13" width="17"> <svg class="app-pagination__icon" xmlns="http://www.w3.org/2000/svg" height="13" width="17">
@ -20,12 +19,12 @@
<% elsif item.is_a?(String) %> <% elsif item.is_a?(String) %>
<li class="app-pagination__item app-pagination__item--current"><span class="govuk-visually-hidden">Page </span><%= item %><span class="govuk-visually-hidden"> (current page) </span></li> <li class="app-pagination__item app-pagination__item--current"><span class="govuk-visually-hidden">Page </span><%= item %><span class="govuk-visually-hidden"> (current page) </span></li>
<% else %> <% else %>
<li class="app-pagination__item"><a class="app-pagination__link" href="<%= "/logs?page=#{item}" %>"><span class="govuk-visually-hidden">Page </span><%= item %></a></li> <li class="app-pagination__item"><a class="app-pagination__link" href="<%= "#{request.path}?page=#{item}" %>"><span class="govuk-visually-hidden">Page </span><%= item %></a></li>
<% end %> <% end %>
<% end %> <% end %>
<li class="app-pagination__item app-pagination__item--next"> <li class="app-pagination__item app-pagination__item--next">
<% if pagy.next %> <% if pagy.next %>
<a class="app-pagination__link" href="<%= "/logs?page=#{pagy.next}" %>"> <a class="app-pagination__link" href="<%= "#{request.path}?page=#{pagy.next}" %>">
<% end %> <% end %>
Next <span class="govuk-visually-hidden">page</span> Next <span class="govuk-visually-hidden">page</span>
<span class="app-pagination__link-title"> <span class="app-pagination__link-title">

Loading…
Cancel
Save