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