#18590: Hiding pager if only one page

Work Item: 18590

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-06-22 14:08:46 -07:00
parent 9d72797e04
commit bcdf16cb38

View File

@@ -412,7 +412,7 @@ namespace Orchard.Core.Shapes {
if (Quantity == null || Quantity < 0)
numberOfPagesToShow = 7;
var totalPageCount = Math.Ceiling(TotalItemCount / pageSize);
var totalPageCount = (int)Math.Ceiling(TotalItemCount / pageSize);
var firstText = FirstText ?? T("<<");
var previousText = PreviousText ?? T("<");
@@ -455,8 +455,8 @@ namespace Orchard.Core.Shapes {
routeData.Remove(key);
}
var firstPage = Math.Max(1, Page - (numberOfPagesToShow / 2));
var lastPage = Math.Min(totalPageCount, Page + (numberOfPagesToShow / 2));
int firstPage = Math.Max(1, Page - (numberOfPagesToShow / 2));
int lastPage = Math.Min(totalPageCount, Page + (int)(numberOfPagesToShow / 2));
var pageKey = String.IsNullOrEmpty(PagerId) ? "page" : PagerId;
@@ -485,7 +485,7 @@ namespace Orchard.Core.Shapes {
}
// page numbers
if (numberOfPagesToShow > 0) {
if (numberOfPagesToShow > 0 && firstPage != lastPage) {
for (var p = firstPage; p <= lastPage; p++) {
if (p == currentPage) {
Shape.Add(Display.Pager_CurrentPage(Value: p, RouteValues: routeData, Pager: Shape));