Skip to content

Instantly share code, notes, and snippets.

@clausti
Last active September 18, 2020 18:09
Show Gist options
  • Save clausti/7aea1e8616cdbe56bf165c533dd8e3dd to your computer and use it in GitHub Desktop.
Save clausti/7aea1e8616cdbe56bf165c533dd8e3dd to your computer and use it in GitHub Desktop.
<%# app/views/pageable/_widget.erb %>
<nav class='pageable-widget' aria-label="pagination widget">
<%= if prev_page
link_to "prev", {controller: controller_name, action: action_name, page: prev_page}.merge(pageable_params), aria: { label: 'previous page'}
end %>
<%= if total_pages > 0
"Page #{page} of #{total_pages}"
end %>
<%= if next_page
link_to "next", {controller: controller_name, action: action_name, page: next_page}.merge(pageable_params), aria: { label: 'next page'}
end %>
</nav>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment