Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #537 from Kajabi/BUILD-381_update-pagination-name
Browse files Browse the repository at this point in the history
Pagination, use collection name if available
  • Loading branch information
AndrwM authored Nov 12, 2020
2 parents 2034a08 + 321e8ad commit 249ac08
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/sage_rails/app/sage_components/sage_pagination.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ def next_text
end

def page_count(collection)
entry_name = collection.entry_name
entry_name = entry_name.pluralize unless collection.total_count == 1
entry_name = (collection.entry_name || "Record").pluralize(collection.total_count)

if collection.total_pages < 2
"<strong>#{collection.total_count}</strong> Records"
"<strong>#{collection.total_count}</strong> #{entry_name}"
else
first = collection.offset_value + 1
last = collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value
"<strong>#{first}</strong> - <strong>#{last}</strong> of <strong>#{collection.total_count}</strong> Records"
"<strong>#{first}</strong> - <strong>#{last}</strong> of <strong>#{collection.total_count}</strong> #{entry_name}"
end.html_safe
end

end

0 comments on commit 249ac08

Please sign in to comment.