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 a = Paginate {
- pgnDefaultCount :: Int
- pgnGetItems :: Int -> Int -> GHandler (Paginate master a) master [a]
- pgnItemCount :: GHandler (Paginate master a) master Int
- pgnDisplayItems :: Int -> Int -> [a] -> GHandler (Paginate master a) master RepHtml
- data PaginateRoute
- defaultPaginate :: (YesodPersist master, PersistBackend (YesodDB master (GHandler (Paginate master a) master)), PersistEntity a) => Int -> [Filter a] -> [Order a] -> (Int -> Int -> [a] -> GHandler (Paginate master a) master RepHtml) -> Paginate master a
- prevLink :: Paginate master a -> Int -> Int -> Maybe (Route (Paginate master a))
- nextLink :: Paginate master a -> Int -> Int -> GHandler (Paginate master a) master (Maybe (Route (Paginate master a)))
Documentation
Paginate | |
|
Yesod master => YesodSubSite (Paginate master a) master |
data PaginateRoute Source
:: (YesodPersist master, PersistBackend (YesodDB master (GHandler (Paginate master 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 a) master RepHtml) | Display function |
-> Paginate master a |