diff --git a/app/assets/images/chevron-left.svg b/app/assets/images/chevron-left.svg new file mode 100644 index 000000000000..11c1cf3cdfc0 --- /dev/null +++ b/app/assets/images/chevron-left.svg @@ -0,0 +1,3 @@ + + + diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index 4615d885234b..5a01524355e9 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -22,6 +22,18 @@ label { padding: 8px; } } +// New pagination styles as added in Admin Member Index view. As we roll out these styles to other admin views, the above CSS will eventually be removed. +.admin-pagination { + color: var(--link-color-secondary); + + &--link { + padding: var(--su-1); + } + + &--inactive { + color: var(--base-30); + } +} .bg-featured { background: #bbffd2; diff --git a/app/views/admin/users/_member_index.html.erb b/app/views/admin/users/_member_index.html.erb index 95122f495a26..f62361fec050 100644 --- a/app/views/admin/users/_member_index.html.erb +++ b/app/views/admin/users/_member_index.html.erb @@ -4,9 +4,10 @@ <%= render "admin/users/index/tabs" %> - <%= render "admin/users/index/controls" %> - - <%= paginate @users, theme: "internal" %> +
+ <%= render "admin/users/index/controls" %> + <%= paginate @users, theme: "admin", scope: @users, label: "Paginate users" %> +
@@ -26,5 +27,7 @@
- <%= paginate @users, theme: "internal" %> +
+ <%= paginate @users, theme: "admin", scope: @users, label: "Paginate users" %> +
diff --git a/app/views/kaminari/admin/_next_page.html.erb b/app/views/kaminari/admin/_next_page.html.erb new file mode 100644 index 000000000000..6b70d7b5ba15 --- /dev/null +++ b/app/views/kaminari/admin/_next_page.html.erb @@ -0,0 +1,4 @@ +
  • + <%= link_to_unless current_page.last?, crayons_icon_tag("chevron-right", aria_hidden: true, class: ("admin-pagination--inactive mx-1" if current_page.last?).to_s), url, rel: "next", remote: remote, class: "admin-pagination--link c-link c-link--icon-alone c-link--block", + aria: { label: t("views.pagination.aria_next"), describedby: "pagination-description" } %> +
  • diff --git a/app/views/kaminari/admin/_paginator.html.erb b/app/views/kaminari/admin/_paginator.html.erb new file mode 100644 index 000000000000..5fabf19bb1be --- /dev/null +++ b/app/views/kaminari/admin/_paginator.html.erb @@ -0,0 +1,12 @@ +<%= paginator.render do %> + +<% end %> diff --git a/app/views/kaminari/admin/_prev_page.html.erb b/app/views/kaminari/admin/_prev_page.html.erb new file mode 100644 index 000000000000..edc5994b6841 --- /dev/null +++ b/app/views/kaminari/admin/_prev_page.html.erb @@ -0,0 +1,4 @@ +
  • + <%= link_to_unless current_page.first?, crayons_icon_tag("chevron-left", aria_hidden: true, class: ("admin-pagination--inactive mx-1" if current_page.first?).to_s), url, rel: "prev", remote: remote, class: "admin-pagination--link c-link c-link--icon-alone c-link--block", + aria: { label: t("views.pagination.aria_previous"), describedby: "pagination-description" } %> +
  • diff --git a/config/locales/kaminari.en.yml b/config/locales/kaminari.en.yml new file mode 100644 index 000000000000..1c619cf08b81 --- /dev/null +++ b/config/locales/kaminari.en.yml @@ -0,0 +1,10 @@ +--- +en: + views: + pagination: + aria_next: "Next page" + aria_previous: "Previous page" + helpers: + page_entries_info: + more_pages: + display_entries: "%{first} - %{last} of %{total}" diff --git a/config/locales/kaminari.fr.yml b/config/locales/kaminari.fr.yml index 04b182d71735..33f929d4f68e 100644 --- a/config/locales/kaminari.fr.yml +++ b/config/locales/kaminari.fr.yml @@ -2,8 +2,14 @@ fr: views: pagination: + aria_next: "Next page" + aria_previous: "Previous page" first: "« Premier" last: Dernier » next: Suivant › previous: "‹ Précédent" truncate: "…" + helpers: + page_entries_info: + more_pages: + display_entries: "%{first} - %{last} of %{total}"