Provides a pagination subsite for Yesod.
Route layout:
/ PaginateHomeR GET /#Int PaginateStartR GET /#Int/#Int PaginateR GET
If no numbers are given, display the items starting from the beginning with the default count. If one number is given, display the items starting from that index with the default count. If two numbers are given, the first one is the count and the second is the starting index. (This is so the user can modify the end of the URL to move forward in the pagination.)
- data Paginate master rep a = Paginate {
- pgnDefaultCount :: Int
- pgnGetItems :: Int -> Int -> GHandler (Paginate master rep a) master [a]
- pgnItemCount :: GHandler (Paginate master rep a) master Int
- pgnDisplayItems :: Int -> Int -> [a] -> GHandler (Paginate master rep a) master rep
- data PaginateRoute
- defaultPaginate :: (YesodPersist master, PersistBackend (YesodDB master (GHandler (Paginate master rep a) master)), PersistEntity a) => Int -> [Filter a] -> [Order a] -> (Int -> Int -> [a] -> GHandler (Paginate master rep a) master rep) -> Paginate master rep a
- prevLink :: Paginate master rep a -> Int -> Int -> Maybe (Route (Paginate master rep a))
- nextLink :: Paginate master rep a -> Int -> Int -> GHandler (Paginate master rep a) master (Maybe (Route (Paginate master rep a)))
Documentation
data Paginate master rep a Source
Paginate | |
|
(Yesod master, HasReps rep) => YesodSubSite (Paginate master rep a) master |
data PaginateRoute Source
:: (YesodPersist master, PersistBackend (YesodDB master (GHandler (Paginate master rep a) master)), PersistEntity a) | |
=> Int | Default number of items to show |
-> [Filter a] | Filters to apply |
-> [Order a] | Ordering to apply |
-> (Int -> Int -> [a] -> GHandler (Paginate master rep a) master rep) | Display function |
-> Paginate master rep a |