parent
7da8d89a5c
commit
d0fcf2e9e3
@ -187,4 +187,7 @@ RatingFilesUpdated: Korrigierte Dateien überschrieben
|
|||||||
|
|
||||||
CourseMembers: Teilnehmer
|
CourseMembers: Teilnehmer
|
||||||
CourseMembersCount num@Int64: #{display num}
|
CourseMembersCount num@Int64: #{display num}
|
||||||
CourseMembersCountLimited num@Int64 max@Int64: #{display num}/#{display max}
|
CourseMembersCountLimited num@Int64 max@Int64: #{display num}/#{display max}
|
||||||
|
|
||||||
|
NoTableContent: Kein Tabelleninhalt
|
||||||
|
NoUpcomingSheetDeadlines: Keine anstehenden Übungsblätter
|
||||||
@ -170,7 +170,7 @@ makeCorrectionsTable whereClause colChoices psValidator = do
|
|||||||
E.||. (if Nothing `Set.member` emails then E.isNothing (corrector E.?. UserEmail) else E.val False)
|
E.||. (if Nothing `Set.member` emails then E.isNothing (corrector E.?. UserEmail) else E.val False)
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
, dbtAttrs = tableDefault
|
, dbtStyle = def
|
||||||
, dbtIdent = "corrections" :: Text
|
, dbtIdent = "corrections" :: Text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -85,7 +85,7 @@ getTermCourseListR tid = do
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
, dbtFilter = mempty
|
, dbtFilter = mempty
|
||||||
, dbtAttrs = tableDefault
|
, dbtStyle = def
|
||||||
, dbtIdent = "courses" :: Text
|
, dbtIdent = "courses" :: Text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -99,7 +99,7 @@ homeAnonymous = do
|
|||||||
| otherwise -> course E.^. CourseTerm `E.in_` E.valList (Set.toList tids)
|
| otherwise -> course E.^. CourseTerm `E.in_` E.valList (Set.toList tids)
|
||||||
)
|
)
|
||||||
] -}
|
] -}
|
||||||
, dbtAttrs = tableDefault
|
, dbtStyle = def
|
||||||
, dbtIdent = "upcomingdeadlines" :: Text
|
, dbtIdent = "upcomingdeadlines" :: Text
|
||||||
}
|
}
|
||||||
let features = $(widgetFile "featureList")
|
let features = $(widgetFile "featureList")
|
||||||
@ -188,7 +188,7 @@ homeUser uid = do
|
|||||||
| otherwise -> course E.^. CourseTerm `E.in_` E.valList (Set.toList tids)
|
| otherwise -> course E.^. CourseTerm `E.in_` E.valList (Set.toList tids)
|
||||||
)
|
)
|
||||||
] -}
|
] -}
|
||||||
, dbtAttrs = tableDefault
|
, dbtStyle = def { dbsEmptyStyle = DBESNoHeading, dbsEmptyMessage = MsgNoUpcomingSheetDeadlines }
|
||||||
, dbtIdent = "upcomingdeadlines" :: Text
|
, dbtIdent = "upcomingdeadlines" :: Text
|
||||||
}
|
}
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
|||||||
@ -227,7 +227,7 @@ getSShowR tid csh shn = do
|
|||||||
fileTable <- dbTable def $ DBTable
|
fileTable <- dbTable def $ DBTable
|
||||||
{ dbtSQLQuery = fileData
|
{ dbtSQLQuery = fileData
|
||||||
, dbtColonnade = colonnadeFiles
|
, dbtColonnade = colonnadeFiles
|
||||||
, dbtAttrs = tableDefault
|
, dbtStyle = def
|
||||||
, dbtFilter = Map.empty
|
, dbtFilter = Map.empty
|
||||||
, dbtIdent = "files" :: Text
|
, dbtIdent = "files" :: Text
|
||||||
-- TODO: Add column for and visibility date
|
-- TODO: Add column for and visibility date
|
||||||
|
|||||||
@ -288,7 +288,7 @@ submissionHelper tid csh shn (SubmissionMode mcid) = do
|
|||||||
smid2ArchiveTable (smid,cid) = DBTable
|
smid2ArchiveTable (smid,cid) = DBTable
|
||||||
{ dbtSQLQuery = submissionFiles smid
|
{ dbtSQLQuery = submissionFiles smid
|
||||||
, dbtColonnade = colonnadeFiles cid
|
, dbtColonnade = colonnadeFiles cid
|
||||||
, dbtAttrs = tableDefault
|
, dbtStyle = def
|
||||||
, dbtIdent = "files" :: Text
|
, dbtIdent = "files" :: Text
|
||||||
, dbtSorting = [ ( "path"
|
, dbtSorting = [ ( "path"
|
||||||
, SortColumn $ \((sf1 `E.InnerJoin` f1) `E.FullOuterJoin` (sf2 `E.InnerJoin` f2)) -> E.coalesce [f1 E.?. FileTitle, f2 E.?. FileTitle]
|
, SortColumn $ \((sf1 `E.InnerJoin` f1) `E.FullOuterJoin` (sf2 `E.InnerJoin` f2)) -> E.coalesce [f1 E.?. FileTitle, f2 E.?. FileTitle]
|
||||||
|
|||||||
@ -99,7 +99,7 @@ getTermShowR = do
|
|||||||
E.&&. course E.^. CourseShorthand `E.in_` E.valList cshs
|
E.&&. course E.^. CourseShorthand `E.in_` E.valList cshs
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
, dbtAttrs = tableDefault
|
, dbtStyle = def
|
||||||
, dbtIdent = "terms" :: Text
|
, dbtIdent = "terms" :: Text
|
||||||
}
|
}
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
|||||||
@ -21,6 +21,7 @@ module Handler.Utils.Table.Pagination
|
|||||||
( SortColumn(..), SortDirection(..)
|
( SortColumn(..), SortDirection(..)
|
||||||
, FilterColumn(..), IsFilterColumn
|
, FilterColumn(..), IsFilterColumn
|
||||||
, DBRow(..), DBOutput
|
, DBRow(..), DBOutput
|
||||||
|
, DBStyle(..), DBEmptyStyle(..)
|
||||||
, DBTable(..), IsDBTable(..)
|
, DBTable(..), IsDBTable(..)
|
||||||
, PaginationSettings(..), PaginationInput(..), piIsUnset
|
, PaginationSettings(..), PaginationInput(..), piIsUnset
|
||||||
, PSValidator(..)
|
, PSValidator(..)
|
||||||
@ -128,6 +129,25 @@ instance DBOutput (DBRow r) r where
|
|||||||
instance DBOutput (DBRow r) (Int64, r) where
|
instance DBOutput (DBRow r) (Int64, r) where
|
||||||
dbProj = (,) <$> dbrIndex <*> dbrOutput
|
dbProj = (,) <$> dbrIndex <*> dbrOutput
|
||||||
|
|
||||||
|
data DBEmptyStyle = DBESNoHeading | DBESHeading
|
||||||
|
deriving (Enum, Bounded, Ord, Eq, Show, Read)
|
||||||
|
|
||||||
|
instance Default DBEmptyStyle where
|
||||||
|
def = DBESHeading
|
||||||
|
|
||||||
|
data DBStyle = DBStyle
|
||||||
|
{ dbsEmptyStyle :: DBEmptyStyle
|
||||||
|
, dbsEmptyMessage :: UniWorXMessage
|
||||||
|
, dbsAttrs :: [(Text, Text)]
|
||||||
|
}
|
||||||
|
|
||||||
|
instance Default DBStyle where
|
||||||
|
def = DBStyle
|
||||||
|
{ dbsEmptyStyle = def
|
||||||
|
, dbsEmptyMessage = MsgNoTableContent
|
||||||
|
, dbsAttrs = [ ("class", "table table-striped table-hover table-sortable") ]
|
||||||
|
}
|
||||||
|
|
||||||
data DBTable m x = forall a r r' h i t.
|
data DBTable m x = forall a r r' h i t.
|
||||||
( ToSortable h, Functor h
|
( ToSortable h, Functor h
|
||||||
, E.SqlSelect a r, DBOutput (DBRow r) r'
|
, E.SqlSelect a r, DBOutput (DBRow r) r'
|
||||||
@ -138,7 +158,7 @@ data DBTable m x = forall a r r' h i t.
|
|||||||
, dbtColonnade :: Colonnade h r' (DBCell m x)
|
, dbtColonnade :: Colonnade h r' (DBCell m x)
|
||||||
, dbtSorting :: Map (CI Text) (SortColumn t)
|
, dbtSorting :: Map (CI Text) (SortColumn t)
|
||||||
, dbtFilter :: Map (CI Text) (FilterColumn t)
|
, dbtFilter :: Map (CI Text) (FilterColumn t)
|
||||||
, dbtAttrs :: Attribute -- FIXME: currently unused
|
, dbtStyle :: DBStyle
|
||||||
, dbtIdent :: i
|
, dbtIdent :: i
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +305,7 @@ instance IsDBTable m a => IsString (DBCell m a) where
|
|||||||
|
|
||||||
|
|
||||||
dbTable :: forall m x. IsDBTable m x => PSValidator m x -> DBTable m x -> Handler (DBResult m x)
|
dbTable :: forall m x. IsDBTable m x => PSValidator m x -> DBTable m x -> Handler (DBResult m x)
|
||||||
dbTable PSValidator{..} dbtable@(DBTable{ dbtIdent = (toPathPiece -> dbtIdent), dbtColonnade = (lmap dbProj -> dbtColonnade), .. }) = do
|
dbTable PSValidator{..} dbtable@(DBTable{ dbtIdent = (toPathPiece -> dbtIdent), dbtColonnade = (lmap dbProj -> dbtColonnade), dbtStyle = DBStyle{..}, .. }) = do
|
||||||
let
|
let
|
||||||
sortingOptions = mkOptionList
|
sortingOptions = mkOptionList
|
||||||
[ Option t' (t, d) t'
|
[ Option t' (t, d) t'
|
||||||
@ -297,9 +317,9 @@ dbTable PSValidator{..} dbtable@(DBTable{ dbtIdent = (toPathPiece -> dbtIdent),
|
|||||||
wIdent n
|
wIdent n
|
||||||
| not $ null dbtIdent = dbtIdent <> "-" <> n
|
| not $ null dbtIdent = dbtIdent <> "-" <> n
|
||||||
| otherwise = n
|
| otherwise = n
|
||||||
dbtAttrs'
|
dbsAttrs'
|
||||||
| not $ null dbtIdent = Html5.id (fromString $ unpack dbtIdent) <> dbtAttrs
|
| not $ null dbtIdent = ("id", dbtIdent) : dbsAttrs
|
||||||
| otherwise = dbtAttrs
|
| otherwise = dbsAttrs
|
||||||
multiTextField = Field
|
multiTextField = Field
|
||||||
{ fieldParse = \ts _ -> return . Right $ Just ts
|
{ fieldParse = \ts _ -> return . Right $ Just ts
|
||||||
, fieldView = undefined
|
, fieldView = undefined
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
$newline never
|
$newline never
|
||||||
<table id="#{dbtIdent}" .table.table--striped.table--hover>
|
<table *{dbsAttrs'}>
|
||||||
$maybe wHeaders' <- wHeaders
|
$maybe wHeaders' <- wHeaders
|
||||||
<thead>
|
<thead>
|
||||||
<tr .table__row.table__row--head>
|
<tr .table__row.table__row--head>
|
||||||
@ -8,10 +8,10 @@ $newline never
|
|||||||
^{widget}
|
^{widget}
|
||||||
$nothing
|
$nothing
|
||||||
<tbody>
|
<tbody>
|
||||||
$if null wRows
|
$if null wRows && (dbsEmptyStyle == DBESHeading)
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=#{show columnCount}>
|
<td colspan=#{show columnCount}>
|
||||||
Kein Inhalt.
|
_{dbsEmptyMessage}
|
||||||
$else
|
$else
|
||||||
$forall row <- wRows
|
$forall row <- wRows
|
||||||
<tr .table__row>
|
<tr .table__row>
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
$newline never
|
$newline never
|
||||||
<div ##{dbtIdent}-table-wrapper>
|
$if null wRows && (dbsEmptyStyle == DBESNoHeading)
|
||||||
<div .scrolltable>
|
_{dbsEmptyMessage}
|
||||||
^{table}
|
$else
|
||||||
$if pageCount > 1
|
<div ##{wIdent "table-wrapper"}>
|
||||||
<ul ##{dbtIdent}-pagination .pagination>
|
<div .scrolltable>
|
||||||
$forall p <- pageNumbers
|
^{table}
|
||||||
<li .pagination-link :p == psPage:.current>
|
$if pageCount > 1
|
||||||
<a href=#{tblLink $ setParam (wIdent "page") (Just $ tshow p)}>
|
<ul ##{wIdent "pagination"} .pagination>
|
||||||
_{MsgPage (succ p)}
|
$forall p <- pageNumbers
|
||||||
|
<li .pagination-link :p == psPage:.current>
|
||||||
|
<a href=#{tblLink $ setParam (wIdent "page") (Just $ tshow p)}>
|
||||||
|
_{MsgPage (succ p)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user