Numbering for colonnade tables provided.

This commit is contained in:
SJost 2017-10-08 21:05:55 +02:00
parent 930a478ee3
commit 98c945b443
3 changed files with 15 additions and 2 deletions

View File

@ -50,6 +50,7 @@ dependencies:
- base64-bytestring
- memory
- http-api-data
- profunctors
- colonnade >=1.1.1
- yesod-colonnade >=1.1.0
- blaze-markup

View File

@ -28,6 +28,7 @@ getShowTermsR = do
, headed "Beginn Vorlesungen" $ fromString.formatTimeGerWD.termLectureStart
, headed "Ende Vorlesungen" $ fromString.formatTimeGerWD.termLectureEnd
, headed "Aktiv" (\t -> if termActive t then tickmark else "")
-- , Colonnade.bool (Headed "Aktiv") termActive (const tickmark) (const "")
, headed "Semesteranfang" $ fromString.formatTimeGerWD.termStart
, headed "Semesterende" $ fromString.formatTimeGerWD.termEnd
, headed "Feiertage im Semester" $

View File

@ -4,11 +4,22 @@
module Handler.Utils.Table where
-- General Utilities for Tables
-- import Import hiding ((<>))
import Import hiding ((<>))
import Data.Monoid ((<>))
import Data.Profunctor
import Text.Blaze as B
import Colonnade
import Yesod.Colonnade
-- Table design
tableDefault :: Attribute
tableDefault = customAttribute "class" "table table-striped"
tableDefault = customAttribute "class" "table table-striped table-hover"
-- modifiy tables
encodeHeadedWidgetTableNumbered :: Attribute -> Colonnade Headed a (WidgetT site IO ()) -> [a] -> WidgetT site IO ()
encodeHeadedWidgetTableNumbered attrs colo tdata =
encodeHeadedWidgetTable attrs (mconcat [headed "Nr" (fromString.show.fst), lmap snd colo]) (zip [1..] tdata)