@@ -32,7 +32,7 @@ import Data.Time.Clock ( UTCTime )
32
32
import Data.Time.Format ( defaultTimeLocale , formatTime )
33
33
import Data.Maybe ( listToMaybe , fromMaybe )
34
34
import Distribution.Server.Util.Paging (PaginatedConfiguration (.. ), hasNext ,
35
- hasPrev , nextURL , pageIndexRange , paginate , prevURL , toURL , allPagedURLs )
35
+ hasPrev , nextURL , pageIndexRange , paginate , prevURL , toURL , allPagedURLs , pagingInfo )
36
36
37
37
-- | Takes a list of package info, in reverse order by timestamp.
38
38
@@ -67,11 +67,9 @@ pageSizeForm base =
67
67
68
68
69
69
paginator :: PaginatedConfiguration -> URL -> Html
70
- paginator pc@ PaginatedConfiguration {currPage,totalAmount } baseUrl =
70
+ paginator pc@ PaginatedConfiguration {currPage} baseUrl =
71
71
let
72
- (start, end) = pageIndexRange pc
73
- infoText = " Showing " ++ show start ++ " to " ++ show end ++ " of " ++ show totalAmount ++ " entries"
74
- info = XHtml. thediv << infoText
72
+ info = XHtml. thediv << pagingInfo pc
75
73
76
74
next = XHtml. anchor ! [XHtml. href (fromMaybe " " (nextURL baseUrl pc)) | hasNext pc] << " Next"
77
75
prev = XHtml. anchor ! [XHtml. href (fromMaybe " " (prevURL baseUrl pc)) | hasPrev pc] << " Previous"
@@ -93,9 +91,9 @@ noAttr = XHtml.theclass ""
93
91
-- | Generates a list of links of the current possible paging links, recreates the functionality of the paging links on the search page
94
92
reducePagedLinks :: PaginatedConfiguration -> [Html ] -> Html
95
93
reducePagedLinks PaginatedConfiguration {currPage} xs
96
- | currPage >= (length xs - 3 ) = mconcat . keepLastPages . fillFirst $ xs -- Beginning ellipses
97
- | length xs > 5 && currPage < 5 = mconcat . keepFirstPages . fillLast $ xs -- Ending ellipses
98
94
| length xs <= 5 = mconcat xs -- Do Nothing
95
+ | currPage >= (length xs - 3 ) = mconcat . keepLastPages . fillFirst $ xs -- Beginning ellipses
96
+ | currPage < 5 = mconcat . keepFirstPages . fillLast $ xs -- Ending ellipses
99
97
| otherwise = mconcat . keepMiddlePages . fillLast . fillFirst $ xs -- Begin and End ellipses
100
98
where filler = XHtml. thespan << " ..."
101
99
fillFirst x = insertAt 1 filler x
0 commit comments