From 4cf7c504d6016fe83d4ffc0ee3b5ac0dd3bf3c1d Mon Sep 17 00:00:00 2001 From: Weston Ganger Date: Sat, 14 Oct 2023 11:51:13 -0700 Subject: [PATCH] Add missing pagination links to index pages --- CHANGELOG.md | 5 ++++- .../kaminari/_first_page.html.erb | 3 +++ .../rails_i18n_manager/kaminari/_gap.html.erb | 3 +++ .../kaminari/_last_page.html.erb | 3 +++ .../kaminari/_next_page.html.erb | 3 +++ .../rails_i18n_manager/kaminari/_page.html.erb | 9 +++++++++ .../kaminari/_paginator.html.erb | 17 +++++++++++++++++ .../kaminari/_prev_page.html.erb | 3 +++ .../translation_apps/index.html.slim | 2 ++ .../translations/index.html.slim | 2 ++ 10 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 app/views/rails_i18n_manager/kaminari/_first_page.html.erb create mode 100644 app/views/rails_i18n_manager/kaminari/_gap.html.erb create mode 100644 app/views/rails_i18n_manager/kaminari/_last_page.html.erb create mode 100644 app/views/rails_i18n_manager/kaminari/_next_page.html.erb create mode 100644 app/views/rails_i18n_manager/kaminari/_page.html.erb create mode 100644 app/views/rails_i18n_manager/kaminari/_paginator.html.erb create mode 100644 app/views/rails_i18n_manager/kaminari/_prev_page.html.erb diff --git a/CHANGELOG.md b/CHANGELOG.md index 2591a4a..92d7377 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # CHANGELOG -### v1.0.0 +### Unreleased - [View Diff](https://github.com/westonganger/rails_i18n_manager/compare/v1.0.0...master) +- [#9](https://github.com/westonganger/rails_i18n_manager/pull/9) - Add missing pagination links to index pages + +### v1.0.0 - [View Diff](https://github.com/westonganger/rails_i18n_manager/compare/9c8305c...v1.0.0) - Release to rubygems ### April 17, 2023 diff --git a/app/views/rails_i18n_manager/kaminari/_first_page.html.erb b/app/views/rails_i18n_manager/kaminari/_first_page.html.erb new file mode 100644 index 0000000..cc107ec --- /dev/null +++ b/app/views/rails_i18n_manager/kaminari/_first_page.html.erb @@ -0,0 +1,3 @@ +
  • + <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote, class: 'page-link' %> +
  • diff --git a/app/views/rails_i18n_manager/kaminari/_gap.html.erb b/app/views/rails_i18n_manager/kaminari/_gap.html.erb new file mode 100644 index 0000000..d241fc4 --- /dev/null +++ b/app/views/rails_i18n_manager/kaminari/_gap.html.erb @@ -0,0 +1,3 @@ +
  • + <%= link_to raw(t 'views.pagination.truncate'), '#', class: 'page-link' %> +
  • diff --git a/app/views/rails_i18n_manager/kaminari/_last_page.html.erb b/app/views/rails_i18n_manager/kaminari/_last_page.html.erb new file mode 100644 index 0000000..9a7584e --- /dev/null +++ b/app/views/rails_i18n_manager/kaminari/_last_page.html.erb @@ -0,0 +1,3 @@ +
  • + <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, remote: remote, class: 'page-link' %> +
  • diff --git a/app/views/rails_i18n_manager/kaminari/_next_page.html.erb b/app/views/rails_i18n_manager/kaminari/_next_page.html.erb new file mode 100644 index 0000000..7ca72a8 --- /dev/null +++ b/app/views/rails_i18n_manager/kaminari/_next_page.html.erb @@ -0,0 +1,3 @@ +
  • + <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote, class: 'page-link' %> +
  • diff --git a/app/views/rails_i18n_manager/kaminari/_page.html.erb b/app/views/rails_i18n_manager/kaminari/_page.html.erb new file mode 100644 index 0000000..3b752b8 --- /dev/null +++ b/app/views/rails_i18n_manager/kaminari/_page.html.erb @@ -0,0 +1,9 @@ +<% if page.current? %> +
  • + <%= content_tag :a, page, data: { remote: remote }, rel: page.rel, class: 'page-link' %> +
  • +<% else %> +
  • + <%= link_to page, url, remote: remote, rel: page.rel, class: 'page-link' %> +
  • +<% end %> diff --git a/app/views/rails_i18n_manager/kaminari/_paginator.html.erb b/app/views/rails_i18n_manager/kaminari/_paginator.html.erb new file mode 100644 index 0000000..bb5ed0f --- /dev/null +++ b/app/views/rails_i18n_manager/kaminari/_paginator.html.erb @@ -0,0 +1,17 @@ +<%= paginator.render do %> + +<% end %> diff --git a/app/views/rails_i18n_manager/kaminari/_prev_page.html.erb b/app/views/rails_i18n_manager/kaminari/_prev_page.html.erb new file mode 100644 index 0000000..c7803fa --- /dev/null +++ b/app/views/rails_i18n_manager/kaminari/_prev_page.html.erb @@ -0,0 +1,3 @@ +
  • + <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote, class: 'page-link' %> +
  • diff --git a/app/views/rails_i18n_manager/translation_apps/index.html.slim b/app/views/rails_i18n_manager/translation_apps/index.html.slim index 14298df..dcf8cae 100644 --- a/app/views/rails_i18n_manager/translation_apps/index.html.slim +++ b/app/views/rails_i18n_manager/translation_apps/index.html.slim @@ -25,3 +25,5 @@ table.table.table-striped.table-hover.space-above3.list-table td = x.additional_locales_array.join(", ") td = link_to "Edit", {action: :edit, id: x.id} + += paginate @translation_apps, views_prefix: "rails_i18n_manager" diff --git a/app/views/rails_i18n_manager/translations/index.html.slim b/app/views/rails_i18n_manager/translations/index.html.slim index bf57eae..d696f62 100644 --- a/app/views/rails_i18n_manager/translations/index.html.slim +++ b/app/views/rails_i18n_manager/translations/index.html.slim @@ -48,3 +48,5 @@ table.table.table-striped.table-hover.space-above3.list-table - if x.any_missing_translations? span.space-left2 = link_to "Translate with Google", translate_missing_translations_path(id: x.id), method: :post, "data-confirm" => "Are you sure you want to proceed with translating the missing translations for this entry?" + += paginate @translation_keys, views_prefix: "rails_i18n_manager"