app/views/tr8n/common/_paginator.html.erb in tr8n-3.1.1 vs app/views/tr8n/common/_paginator.html.erb in tr8n-3.1.2
- old
+ new
@@ -1,14 +1,32 @@
<div style="padding-bottom:10px;padding-top:5px;">
<table style="width:100%;">
<tr>
<td style="text-align:left; vertical-align:top;font-size:11px; font-family:arial;">
- <% if objects.total_count > 0 %>
- Showing <%= objects.offset_value + 1 %> - <%= objects.offset_value + objects.length %> of <%= objects.total_count %>
- <% else %>
- No results found
- <% end %>
+ <%
+ entry_name = options[:subject] || (collection.empty? ? 'entry' : collection.first.class.name.underscore.gsub('_', ' '))
+ output = ""
+ if collection.num_pages < 2
+ case collection.size
+ when 0
+ output = tr("None found", "Paginator message", {}, options)
+ when 1
+ output = tr("Displaying [bold: 1] #{entry_name}", "Paginator message", {}, options)
+ else
+ output = tr("Displaying [bold: all {count}] #{entry_name.pluralize}", "Paginator message", {:count => collection.size}, options)
+ end
+ else
+ output = tr("Displaying #{entry_name.pluralize} [bold: {start_num} - {end_num}] of [bold: {total_count}] in total",
+ "Paginator message", {
+ :start_num => collection.offset_value + 1,
+ :end_num => collection.offset_value + collection.length,
+ :total_count => collection.total_count
+ }, options
+ )
+ end
+ %>
+ <%= output %>
</td>
- <td style="text-align:right; vertical-align:top; font-size:11px; font-family:arial;"><%= paginate(objects) %></td>
+ <td style="text-align:right; vertical-align:top; font-size:11px; font-family:arial;"><%= paginate(collection) %></td>
</tr>
</table>
</div>