feat(course-teaser): incomplete course teaser for course list
Unfinished version of the course teaser. TODO: define lens to access lecturer list for each course, fix js for displaying description
This commit is contained in:
parent
40f382d74c
commit
9a9792578d
6569
package-lock.json
generated
6569
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,7 @@
|
||||
"@babel/plugin-proposal-class-properties": "^7.4.4",
|
||||
"@babel/plugin-proposal-decorators": "^7.4.4",
|
||||
"@babel/preset-env": "^7.4.5",
|
||||
"@commitlint/cli": "^8.0.0",
|
||||
"@commitlint/cli": "^8.1.0",
|
||||
"@commitlint/config-conventional": "^8.0.0",
|
||||
"autoprefixer": "^9.6.0",
|
||||
"babel-core": "^6.26.3",
|
||||
@ -88,6 +88,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"flatpickr": "^4.5.7",
|
||||
"npm": "^6.9.2"
|
||||
"npm": "^6.10.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ import Handler.Utils.Delete
|
||||
import Handler.Utils.Database
|
||||
import Handler.Utils.Table.Cells
|
||||
import Handler.Utils.Table.Columns
|
||||
import Handler.Utils.Table.Pagination (DBSTemplateMode(..))
|
||||
import Handler.Utils.Invitations
|
||||
import Database.Persist.Sql (deleteWhereCount)
|
||||
import qualified Database.Esqueleto.Utils as E
|
||||
@ -205,7 +206,8 @@ makeCourseTable whereClause colChoices psValidator = do
|
||||
, dbtStyle = def
|
||||
{ dbsFilterLayout = defaultDBSFilterLayout
|
||||
-- DBSTCourse :: Lens' r (Entity Course) -> Traversal' r (Entity User) -> Lens' r Bool -> DBSTemplateMode r
|
||||
-- , dbsCellTemplate = DBSTCourse undefined undefined undefined
|
||||
, dbsCellTemplate = DBSTCourse (_dbrOutput . _1) ignored (_dbrOutput . _3)
|
||||
-- ^ course lens ^ lecturers traversal ^ isRegistered lens
|
||||
}
|
||||
, dbtParams = def
|
||||
, dbtIdent = "courses" :: Text
|
||||
|
||||
@ -31,6 +31,7 @@ module Handler.Utils.Table.Pagination
|
||||
, (&)
|
||||
, module Control.Monad.Trans.Maybe
|
||||
, module Colonnade
|
||||
, DBSTemplateMode(..)
|
||||
) where
|
||||
|
||||
import Handler.Utils.Table.Pagination.Types
|
||||
@ -849,24 +850,16 @@ dbTable PSValidator{..} dbtable@DBTable{ dbtIdent = dbtIdent'@(toPathPiece -> db
|
||||
let
|
||||
columnCount :: Int64
|
||||
columnCount = olength64 $ getColonnade dbtColonnade
|
||||
|
||||
-- TODO: better name
|
||||
htmlToCourseDescriptionText :: Maybe Html -> Html
|
||||
htmlToCourseDescriptionText (Just html) = html
|
||||
htmlToCourseDescriptionText Nothing = "No description available."
|
||||
|
||||
utcTimeToWidget :: Maybe UTCTime -> Widget
|
||||
utcTimeToWidget (Just t) = formatTimeW SelFormatDateTime t
|
||||
utcTimeToWidget Nothing = mempty -- TODO: Fallunterscheidung in hamlet (andere Darstellung)
|
||||
wRows <- forM rows $ \row' -> forM (oneColonnadeEncode <$> getColonnade dbtColonnade) $ \(($ row') -> _cell') -> let
|
||||
|
||||
wRows <- forM rows $ \row' -> let
|
||||
Course{..} = row' ^. c . _entityVal
|
||||
lecturers = toListOf l row'
|
||||
courseLecturers = intercalate ", " $ userSurname . entityVal <$> lecturers
|
||||
isRegistered = row' ^. r
|
||||
courseSchoolName = unSchoolKey courseSchool
|
||||
in return $(widgetFile "table/cell/course-teaser")
|
||||
in return $(widgetFile "table/course/course-teaser")
|
||||
|
||||
return $(widgetFile "table/colonnade-course")
|
||||
return $(widgetFile "table/course/colonnade")
|
||||
DBSTDefault -> do
|
||||
let
|
||||
genHeaders SortableP{..} = forM (toSortable . oneColonnadeHead <$> getColonnade dbtColonnade) $ \Sortable{..} -> do
|
||||
|
||||
@ -9,5 +9,4 @@ $newline never
|
||||
$else
|
||||
$forall row <- wRows
|
||||
<tr .table__row>
|
||||
$forall widget <- row
|
||||
^{widget}
|
||||
^{row}
|
||||
@ -7,7 +7,13 @@
|
||||
<div .course-teaser__lecturer-label>_{MsgLecturerFor}
|
||||
<div .course-teaser__lecturer-value>_{courseLecturers}
|
||||
<div .course-teaser__duedate-label>_{MsgRegisterTo}
|
||||
<div .course-teaser__duedate-value>^{utcTimeToWidget courseRegisterTo}
|
||||
$maybe regTo <- courseRegisterTo
|
||||
<div .course-teaser__duedate-value>^{formatTimeW SelFormatDateTime regTo}
|
||||
$nothing
|
||||
<div .course-teaser__school-label>_{MsgCourseSchool}
|
||||
<div .course-teaser__school-value>_{courseSchoolName}
|
||||
<div .course-teaser__description>#{htmlToCourseDescriptionText courseDescription}
|
||||
<div .course-teaser__description>
|
||||
$maybe desc <- courseDescription
|
||||
#{desc}
|
||||
$nothing
|
||||
No description available.
|
||||
Loading…
Reference in New Issue
Block a user