Cleanup identified tables

This commit is contained in:
Gregor Kleen 2018-03-16 13:06:52 +01:00
parent d47fa717a3
commit 907958baf4

View File

@ -4,6 +4,7 @@
, OverloadedStrings
, TemplateHaskell
, LambdaCase
, ViewPatterns
#-}
module Handler.Utils.Table.Pagination where
@ -70,7 +71,7 @@ instance Default PSValidator where
tell . pure $ SomeMessage MsgPSLimitNonPositive
dbTable :: PSValidator -> DBTable -> Handler Widget
dbTable PSValidator{..} DBTable{..} = do
dbTable PSValidator{..} DBTable{ dbtIdent = (toPathPiece -> dbtIdent), .. } = do
let
sortingOptions = mkOptionList
[ Option t' (c, d) t'
@ -84,7 +85,9 @@ dbTable PSValidator{..} DBTable{..} = do
Nothing -> return $ Left "Error parsing values"
Just res -> return $ Right $ Just res
(_, defPS) = runPSValidator Nothing
wIdent n = toPathPiece dbtIdent <> "-" <> n
wIdent n
| not $ null dbtIdent = dbtIdent <> "-" <> n
| otherwise = n
psResult <- runInputGetResult $ PaginationSettings
<$> ireq sortingField (wIdent "sorting")