Skip to content

Commit

Permalink
Add missing pagination links to index pages
Browse files Browse the repository at this point in the history
  • Loading branch information
westonganger committed Oct 14, 2023
1 parent efad36e commit 4cf7c50
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions app/views/rails_i18n_manager/kaminari/_first_page.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<li class="page-item">
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote, class: 'page-link' %>
</li>
3 changes: 3 additions & 0 deletions app/views/rails_i18n_manager/kaminari/_gap.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<li class='page-item disabled'>
<%= link_to raw(t 'views.pagination.truncate'), '#', class: 'page-link' %>
</li>
3 changes: 3 additions & 0 deletions app/views/rails_i18n_manager/kaminari/_last_page.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<li class="page-item">
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, remote: remote, class: 'page-link' %>
</li>
3 changes: 3 additions & 0 deletions app/views/rails_i18n_manager/kaminari/_next_page.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<li class="page-item">
<%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote, class: 'page-link' %>
</li>
9 changes: 9 additions & 0 deletions app/views/rails_i18n_manager/kaminari/_page.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<% if page.current? %>
<li class="page-item active">
<%= content_tag :a, page, data: { remote: remote }, rel: page.rel, class: 'page-link' %>
</li>
<% else %>
<li class="page-item">
<%= link_to page, url, remote: remote, rel: page.rel, class: 'page-link' %>
</li>
<% end %>
17 changes: 17 additions & 0 deletions app/views/rails_i18n_manager/kaminari/_paginator.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<%= paginator.render do %>
<nav>
<ul class="pagination">
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| %>
<% if page.left_outer? || page.right_outer? || page.inside_window? %>
<%= page_tag page %>
<% elsif !page.was_truncated? -%>
<%= gap_tag %>
<% end %>
<% end %>
<%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %>
</ul>
</nav>
<% end %>
3 changes: 3 additions & 0 deletions app/views/rails_i18n_manager/kaminari/_prev_page.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<li class="page-item">
<%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote, class: 'page-link' %>
</li>
2 changes: 2 additions & 0 deletions app/views/rails_i18n_manager/translation_apps/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 2 additions & 0 deletions app/views/rails_i18n_manager/translations/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 4cf7c50

Please sign in to comment.