yesod-paginate-0.0: Pagination for Yesod sites.

Yesod.Paginate

Description

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.)

Synopsis

Documentation

data Paginate master a Source

Constructors

Paginate 

Fields

pgnDefaultCount :: Int

How many items to show per page by default

pgnGetItems :: Int -> Int -> GHandler (Paginate master a) master [a]

Get a certain count of items at a certain offset

pgnItemCount :: GHandler (Paginate master a) master Int

How many items there are in all

pgnDisplayItems :: Int -> Int -> [a] -> GHandler (Paginate master a) master RepHtml

Render the items on a page given the count and offset

Instances

Yesod master => YesodSubSite (Paginate master a) master 

defaultPaginateSource

Arguments

:: (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 

prevLink :: Paginate master a -> Int -> Int -> Maybe (Route (Paginate master a))Source

Link to the previous page.

nextLink :: Paginate master a -> Int -> Int -> GHandler (Paginate master a) master (Maybe (Route (Paginate master a)))Source

Link to the next page.