From 0ab81d3fc128b815b2fdf4c5c118e19290782090 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 27 Jun 2018 11:41:53 +0200 Subject: [PATCH] Show note if table is empty --- src/Handler/Utils/Table/Pagination.hs | 3 +++ templates/table/colonnade.hamlet | 15 ++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Handler/Utils/Table/Pagination.hs b/src/Handler/Utils/Table/Pagination.hs index cf649e8c1..f0b683dce 100644 --- a/src/Handler/Utils/Table/Pagination.hs +++ b/src/Handler/Utils/Table/Pagination.hs @@ -289,6 +289,9 @@ dbTable PSValidator{..} dbtable@(DBTable{ dbtIdent = (toPathPiece -> dbtIdent), attrs = sortableContent ^. cellAttrs return $(widgetFile "table/cell/header") + columnCount :: Int64 + columnCount = olength64 $ getColonnade dbtColonnade + wHeaders <- maybe (return Nothing) (fmap Just . genHeaders) pSortable wRows <- forM rows $ \row -> forM (oneColonnadeEncode <$> getColonnade dbtColonnade) $ \(($ row) -> cell) -> do diff --git a/templates/table/colonnade.hamlet b/templates/table/colonnade.hamlet index e9877a5cd..dc27d91ce 100644 --- a/templates/table/colonnade.hamlet +++ b/templates/table/colonnade.hamlet @@ -4,10 +4,15 @@ $newline never $forall widget <- wHeaders' - ^{widget} + ^{widget} $# cell/header.hamlet $nothing - $forall row <- wRows - - $forall widget <- row - ^{widget} + $if null wRows + + + Kein Inhalt. + $else + $forall row <- wRows + + $forall widget <- row + ^{widget} $# cell/body.hamlet