Skip to content

Commit

Permalink
Merge pull request #1991 from projectblacklight/add-missing-paginatio…
Browse files Browse the repository at this point in the history
…n-keys

Adds missing pagination a11y translations
Use of region role for navigation following https://www.w3.org/WAI/GL/wiki/Using_the_region_role_to_identify_a_region_of_the_page
  • Loading branch information
barmintor committed Oct 25, 2018
2 parents 59321d3 + 68256e1 commit df7e862
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/views/catalog/_results_pagination.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<% if show_pagination? and @response.total_pages > 1 %>
<div class="row record-padding">
<div class="col-md-12">
<div class="pagination">
<nav class="pagination" role="region" aria-label="<%= t('views.pagination.aria.container_label') %>">
<%= paginate @response, :outer_window => 2, :theme => 'blacklight' %>
</div>
</nav>
</div>
</div>
<% end %>
2 changes: 1 addition & 1 deletion app/views/kaminari/blacklight/_first_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
remote: data-remote
-%>
<li class="page-item <%= 'disabled' if current_page.first? %>">
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote, class: 'page-link' %>
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote, class: 'page-link', aria: { label: t('views.pagination.aria.go_to_first_page') } %>
</li>
2 changes: 1 addition & 1 deletion app/views/kaminari/blacklight/_last_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
remote: data-remote
-%>
<li class="page-item <%= 'disabled' if current_page.last? %>">
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, :remote => remote, class: 'page-link' %>
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, :remote => remote, class: 'page-link', aria: { label: t('views.pagination.aria.go_to_last_page') } %>
</li>
6 changes: 3 additions & 3 deletions app/views/kaminari/blacklight/_next_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
-%>
<% if current_page.last? %>
<li class="page-item disabled">
<%= link_to raw(t 'views.pagination.next'), '#', :rel => 'next', :onclick=>'return false;', class: 'page-link' %>
<%= link_to raw(t 'views.pagination.next'), '#', :rel => 'next', :onclick=>'return false;', class: 'page-link', aria: { label: t('views.pagination.aria.go_to_next_page') } %>
</li>
<% else %>
<li class="page-item">
<%= link_to raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote, class: 'page-link' %>
<%= link_to raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote, class: 'page-link', aria: { label: t('views.pagination.aria.go_to_next_page') } %>
</li>
<% end %>
<% end %>
6 changes: 4 additions & 2 deletions app/views/kaminari/blacklight/_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
per_page: number of items to fetch per page
remote: data-remote
-%>
<% page_display = number_with_delimiter(page.to_s) %>

<li class="page-item <%= 'active' if page.current? %>">
<% if page.current? %>
<span class="page-link"><%= number_with_delimiter(page.to_s) %></span>
<span class="page-link" aria-label="<%= t('views.pagination.aria.current_page', page: page_display) %>" aria-current="true"><%= page_display %></span>
<% else %>
<%= link_to number_with_delimiter(page.to_s), url, :remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil, class: 'page-link' %>
<%= link_to page_display, url, :remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil, class: 'page-link', aria: { label: t('views.pagination.aria.go_to_page', page: page_display) } %>
<% end %>
</li>

4 changes: 2 additions & 2 deletions app/views/kaminari/blacklight/_prev_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
-%>
<% if current_page.first? %>
<li class="page-item disabled">
<%= link_to raw(t 'views.pagination.previous'), '#', :rel => 'prev', :onclick=>'return false;', class: 'page-link' %>
<%= link_to raw(t 'views.pagination.previous'), '#', :rel => 'prev', :onclick=>'return false;', class: 'page-link', aria: { label: t('views.pagination.aria.go_to_previous_page') } %>
</li>
<% else %>
<li class="page-item">
<%= link_to raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote, class: 'page-link' %>
<%= link_to raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote, class: 'page-link', aria: { label: t('views.pagination.aria.go_to_previous_page') } %>
</li>
<% end %>

8 changes: 8 additions & 0 deletions config/locales/blacklight.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ de:
previous: '&laquo; Voherige'
next: 'Nächste &raquo;'
truncate: ''
aria:
container_label: Paginierungslinks
current_page: Aktuelle Seite, Seite %{page}
go_to_first_page: Gehe zur ersten Seite
go_to_last_page: Gehe zur letzten Seite
go_to_next_page: Gehe zur nächsten Seite
go_to_page: Gehe zur Seite %{page}
go_to_previous_page: Zurück zur letzten Seite

pagination_compact:
previous: '&laquo; Voherige'
Expand Down
8 changes: 8 additions & 0 deletions config/locales/blacklight.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ en:
previous: '&laquo; Previous'
next: 'Next &raquo;'
truncate: ''
aria:
container_label: 'pagination links'
current_page: 'Current Page, Page %{page}'
go_to_page: 'Go to page %{page}'
go_to_previous_page: 'Go to previous page'
go_to_next_page: 'Go to next page'
go_to_first_page: 'Go to first page'
go_to_last_page: 'Go to last page'

pagination_compact:
previous: '&laquo; Previous'
Expand Down
8 changes: 8 additions & 0 deletions config/locales/blacklight.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ es:
previous: '&laquo; Anterior'
next: 'Siguiente &raquo;'
truncate: ''
aria:
container_label: enlaces de paginación
current_page: Página actual, página %{page}
go_to_first_page: Ir a la primera pagina
go_to_last_page: Ir a la última página
go_to_next_page: Ir a la página siguiente
go_to_page: Ir a la página %{page}
go_to_previous_page: Regresar a la pagina anterior

pagination_compact:
previous: '&laquo; Anterior'
Expand Down
8 changes: 8 additions & 0 deletions config/locales/blacklight.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ fr:
previous: '&laquo; Précédente'
next: 'Suivante &raquo;'
truncate: ''
aria:
container_label: liens de pagination
current_page: Page actuelle, Page %{page}
go_to_first_page: Aller à la première page
go_to_last_page: Aller à la dernière page
go_to_next_page: Aller à la page suivante
go_to_page: Aller à la page %{page}
go_to_previous_page: Aller à la page précédente

pagination_compact:
previous: '&laquo; Précédente'
Expand Down
8 changes: 8 additions & 0 deletions config/locales/blacklight.it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ it:
previous: '&laquo; Pagina precedente'
next: 'Pagina successiva &raquo;'
truncate: ''
aria:
container_label: collegamenti di paginazione
current_page: Pagina corrente, Pagina %{page}
go_to_first_page: Vai alla prima pagina
go_to_last_page: Vai all'ultima pagina
go_to_next_page: Vai alla pagina successiva
go_to_page: Vai alla pagina %{page}
go_to_previous_page: Vai alla pagina precedente

pagination_compact:
previous: '&laquo; Pagina precedente'
Expand Down
9 changes: 9 additions & 0 deletions config/locales/blacklight.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ pt-BR:
previous: '&laquo; anterior'
next: 'próximo &raquo;'
truncate: ''
aria:
container_label: links de paginação
current_page: Página atual, Página %{page}
go_to_first_page: Ir para a primeira página
go_to_last_page: Ir para a última página
go_to_next_page: Ir para a próxima página
go_to_page: Ir para a página %{page}
go_to_previous_page: Ir para a página anterior


pagination_compact:
previous: '&laquo; ant'
Expand Down

0 comments on commit df7e862

Please sign in to comment.