Identify tables
This commit is contained in:
parent
96cdef2538
commit
d47fa717a3
@ -73,6 +73,7 @@ getTermShowR = do
|
||||
, dbtColonnade = colonnadeTerms
|
||||
, dbtSorting = mempty
|
||||
, dbtAttrs = tableDefault
|
||||
, dbtIdent = "terms" :: Text
|
||||
}
|
||||
defaultLayout $ do
|
||||
setTitle "Freigeschaltete Semester"
|
||||
|
||||
@ -31,14 +31,16 @@ sqlSortDirection :: (SortColumn, SortDirection) -> E.SqlExpr E.OrderBy
|
||||
sqlSortDirection (SortColumn e, SortAsc ) = E.asc e
|
||||
sqlSortDirection (SortColumn e, SortDesc) = E.desc e
|
||||
|
||||
data DBTable = forall a r h.
|
||||
data DBTable = forall a r h i.
|
||||
( Headedness h
|
||||
, E.SqlSelect a r
|
||||
, PathPiece i
|
||||
) => DBTable
|
||||
{ dbtSQLQuery :: E.SqlQuery a
|
||||
, dbtColonnade :: Colonnade h r (Cell UniWorX)
|
||||
, dbtSorting :: Map Text SortColumn
|
||||
, dbtAttrs :: Attribute
|
||||
, dbtIdent :: i
|
||||
}
|
||||
|
||||
data PaginationSettings = PaginationSettings
|
||||
@ -82,12 +84,13 @@ dbTable PSValidator{..} DBTable{..} = do
|
||||
Nothing -> return $ Left "Error parsing values"
|
||||
Just res -> return $ Right $ Just res
|
||||
(_, defPS) = runPSValidator Nothing
|
||||
wIdent n = toPathPiece dbtIdent <> "-" <> n
|
||||
|
||||
psResult <- runInputGetResult $ PaginationSettings
|
||||
<$> ireq sortingField "sorting"
|
||||
<*> (fromMaybe (psLimit defPS) <$> iopt intField "pagesize")
|
||||
<*> (fromMaybe (psPage defPS) <$> iopt intField "page")
|
||||
<*> ireq checkBoxField "table-only"
|
||||
<$> ireq sortingField (wIdent "sorting")
|
||||
<*> (fromMaybe (psLimit defPS) <$> iopt intField (wIdent "pagesize"))
|
||||
<*> (fromMaybe (psPage defPS) <$> iopt intField (wIdent "page"))
|
||||
<*> ireq checkBoxField (wIdent "table-only")
|
||||
|
||||
$(logDebug) . tshow $ (,,,) <$> (length . psSorting <$> psResult)
|
||||
<*> (psLimit <$> psResult)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user