yesod-paginate-0.1: 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 rep a Source

Constructors

Paginate 

Fields

pgnDefaultCount :: Int

How many items to show per page by default

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

Get a certain count of items at a certain offset

pgnItemCount :: GHandler (Paginate master rep a) master Int

How many items there are in all

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

Render the items on a page given the count and offset

Instances

(Yesod master, HasReps rep) => YesodSubSite (Paginate master rep a) master 

defaultPaginateSource

Arguments

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

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

Link to the previous page.

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

Link to the next page.