@@ -32,7 +32,7 @@ import Data.Time.Clock ( UTCTime )
3232import Data.Time.Format ( defaultTimeLocale , formatTime )
3333import Data.Maybe ( listToMaybe , fromMaybe )
3434import Distribution.Server.Util.Paging (PaginatedConfiguration (.. ), hasNext ,
35- hasPrev , nextURL , pageIndexRange , paginate , prevURL , toURL , allPagedURLs )
35+ hasPrev , nextURL , pageIndexRange , paginate , prevURL , toURL , allPagedURLs , pagingInfo )
3636
3737-- | Takes a list of package info, in reverse order by timestamp.
3838
@@ -67,11 +67,9 @@ pageSizeForm base =
6767
6868
6969paginator :: PaginatedConfiguration -> URL -> Html
70- paginator pc@ PaginatedConfiguration {currPage,totalAmount } baseUrl =
70+ paginator pc@ PaginatedConfiguration {currPage} baseUrl =
7171 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
7573
7674 next = XHtml. anchor ! [XHtml. href (fromMaybe " " (nextURL baseUrl pc)) | hasNext pc] << " Next"
7775 prev = XHtml. anchor ! [XHtml. href (fromMaybe " " (prevURL baseUrl pc)) | hasPrev pc] << " Previous"
@@ -93,9 +91,9 @@ noAttr = XHtml.theclass ""
9391-- | Generates a list of links of the current possible paging links, recreates the functionality of the paging links on the search page
9492reducePagedLinks :: PaginatedConfiguration -> [Html ] -> Html
9593reducePagedLinks 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
9894 | 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
9997 | otherwise = mconcat . keepMiddlePages . fillLast . fillFirst $ xs -- Begin and End ellipses
10098 where filler = XHtml. thespan << " ..."
10199 fillFirst x = insertAt 1 filler x
0 commit comments