mirror of
https://code.sup39.dev/repos/Wqawg
synced 2025-03-20 04:46:22 +09:00
Pagination widget: Display prev and next pages' links
This commit is contained in:
parent
be458d3689
commit
d500b85c57
2 changed files with 28 additions and 7 deletions
src/Data/Paginate
|
@ -109,10 +109,10 @@ data NavModel = NavModel
|
|||
{
|
||||
nmFirst :: Bool
|
||||
, nmPrevJumps :: [Int]
|
||||
, nmPrev :: [Int]
|
||||
, nmPrev :: Maybe ([Int], Int)
|
||||
, nmCurrent :: Int
|
||||
, nmTotal :: Int
|
||||
, nmNext :: [Int]
|
||||
, nmNext :: Maybe (Int, [Int])
|
||||
, nmNextJumps :: [Int]
|
||||
, nmLast :: Bool
|
||||
}
|
||||
|
@ -131,14 +131,14 @@ navModel ns curr total = NavModel
|
|||
, nmPrevJumps = [] --TODO
|
||||
, nmPrev =
|
||||
if curr == 1 || navNext ns < 1
|
||||
then []
|
||||
else [max 1 (curr - navNext ns) .. curr - 1]
|
||||
then Nothing
|
||||
else Just ([max 1 (curr - navNext ns) .. curr - 2], curr - 1)
|
||||
, nmCurrent = curr
|
||||
, nmTotal = total
|
||||
, nmNext =
|
||||
if curr >= total || navNext ns < 1
|
||||
then []
|
||||
else [curr + 1 .. min total (curr + navNext ns)]
|
||||
then Nothing
|
||||
else Just (curr + 1, [curr + 2 .. min total (curr + navNext ns)])
|
||||
, nmNextJumps = [] --TODO
|
||||
, nmLast = navEdges ns
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue