Fix page indicator
This commit is contained in:
parent
2cfd87de87
commit
170442cff0
@ -25,6 +25,8 @@ import Yesod.Colonnade
|
|||||||
|
|
||||||
import Text.Hamlet (hamletFile)
|
import Text.Hamlet (hamletFile)
|
||||||
|
|
||||||
|
import Data.Ratio ((%))
|
||||||
|
|
||||||
|
|
||||||
data SortColumn = forall a. PersistField a => SortColumn { getSortColumn :: E.SqlExpr (E.Value a) }
|
data SortColumn = forall a. PersistField a => SortColumn { getSortColumn :: E.SqlExpr (E.Value a) }
|
||||||
data SortDirection = SortAsc | SortDesc
|
data SortDirection = SortAsc | SortDesc
|
||||||
@ -121,6 +123,7 @@ dbTable PSValidator{..} DBTable{ dbtIdent = (toPathPiece -> dbtIdent), .. } = do
|
|||||||
|
|
||||||
bool return (sendResponse <=< tblLayout) psShortcircuit $ do
|
bool return (sendResponse <=< tblLayout) psShortcircuit $ do
|
||||||
let table = encodeCellTable dbtAttrs' dbtColonnade rows
|
let table = encodeCellTable dbtAttrs' dbtColonnade rows
|
||||||
|
pageCount = max 1 . ceiling $ rowCount % psLimit
|
||||||
$(widgetFile "table-layout")
|
$(widgetFile "table-layout")
|
||||||
where
|
where
|
||||||
tblLayout :: Widget -> Handler Html
|
tblLayout :: Widget -> Handler Html
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<div .table>
|
<div .table>
|
||||||
^{table}
|
^{table}
|
||||||
<p style="text-align:center">
|
<p style="text-align:center">
|
||||||
_{MsgPage (succ psPage) (succ $ div rowCount psLimit)}
|
_{MsgPage (succ psPage) pageCount}
|
||||||
|
|||||||
Reference in New Issue
Block a user