26 lines
707 B
Haskell
26 lines
707 B
Haskell
{-# LANGUAGE NoImplicitPrelude #-}
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Handler.Utils.Table where
|
|
-- General Utilities for Tables
|
|
|
|
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 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)
|