diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index f94c407b9..91f379b96 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -651,7 +651,6 @@ instance HasUser UserTableData where _userTableRegistration :: Lens' UserTableData UTCTime _userTableRegistration = _dbrOutput . _2 . _unValue --- FIXME: I am a prism due to maybe _userTableNote :: Lens' UserTableData (Maybe CourseUserNoteId) _userTableNote = _dbrOutput . _3 . _unValue @@ -660,7 +659,7 @@ courseIs :: CourseId -> UserTableWhere courseIs cid ((_user `E.InnerJoin` participant) `E.LeftOuterJoin` _note) = participant E.^. CourseParticipantCourse E.==. E.val cid -colUserComment :: IsDBTable m a => TermId -> SchoolId -> CourseShorthand -> Colonnade Sortable UserTableData (DBCell m a) +colUserComment :: IsDBTable m c => TermId -> SchoolId -> CourseShorthand -> Colonnade Sortable UserTableData (DBCell m c) colUserComment tid ssh csh = sortable (Just "course-user-note") (i18nCell MsgCourseUserNote) $ \DBRow{ dbrOutput=(Entity uid _, _, E.Value mbNoteKey) } -> @@ -704,8 +703,10 @@ getCUsersR tid ssh csh = do whereClause = courseIs cid colChoices = mconcat [ colUserParticipantLink tid ssh csh + , colUserEmail , colUserMatriclenr - -- ,colUserComment tid ssh csh + , sortable (Just "registration") (i18nCell MsgRegistered) (timeCell . (view _userTableRegistration)) + , colUserComment tid ssh csh ] psValidator = def tableWidget <- runDB $ makeCourseUserTable whereClause colChoices psValidator diff --git a/src/Handler/Utils/Table/Cells.hs b/src/Handler/Utils/Table/Cells.hs index c57adcdc3..1d2e0b2b3 100644 --- a/src/Handler/Utils/Table/Cells.hs +++ b/src/Handler/Utils/Table/Cells.hs @@ -2,6 +2,9 @@ module Handler.Utils.Table.Cells where import Import +-- import Data.CaseInsensitive (CI) +-- import qualified Data.CaseInsensitive as CI + import Data.Monoid (Any(..)) import Control.Monad.Writer.Class (MonadWriter(..)) import Control.Monad.Trans.Writer (WriterT) @@ -69,10 +72,16 @@ cellHasUserLink toLink user = nWdgt = nameWidget (userEntity ^. _entityVal . _userDisplayName) (userEntity ^. _entityVal . _userSurname) in anchorCellM (toLink <$> encrypt uid) nWdgt - cellHasMatrikelnummer :: (IsDBTable m a, HasUser c) => c -> DBCell m a cellHasMatrikelnummer = maybe mempty textCell . view _userMatrikelnummer +cellHasEMail :: (IsDBTable m a, HasUser c) => c -> DBCell m a +--cellHasEMail = textCell . CI.original . view _userEmail +cellHasEMail user = + let userEmail = user ^. _userEmail + in cell $(widgetFile "widgets/link-email") + + -- Just for documentation purposes; inline this code instead: maybeTimeCell :: IsDBTable m a => Maybe UTCTime -> DBCell m a maybeTimeCell = maybe mempty timeCell @@ -166,11 +175,14 @@ colUser msg = sortable (Just $ fromString $ show msg) (i18nCell msg) cellHasUser colUserParticipant :: (IsDBTable m c, HasUser a) => Colonnade Sortable a (DBCell m c) colUserParticipant = sortable (Just "participant") (i18nCell MsgCourseMembers) cellHasUser -colUserMatriclenr :: (IsDBTable m c, HasUser a) => Colonnade Sortable a (DBCell m c) -colUserMatriclenr = sortable (Just "matriclenumber") (i18nCell MsgMatrikelNr) cellHasMatrikelnummer - colUserParticipantLink :: (IsDBTable m c, HasEntity a User) => TermId -> SchoolId -> CourseShorthand -> Colonnade Sortable a (DBCell m c) colUserParticipantLink tid ssh csh = sortable (Just "participant") (i18nCell MsgCourseMembers) (cellHasUserLink courseLink) where -- courseLink :: CryptoUUIDUser -> Route UniWorX courseLink = CourseR tid ssh csh . CUserR + +colUserMatriclenr :: (IsDBTable m c, HasUser a) => Colonnade Sortable a (DBCell m c) +colUserMatriclenr = sortable (Just "matriclenumber") (i18nCell MsgMatrikelNr) cellHasMatrikelnummer + +colUserEmail :: (IsDBTable m c, HasUser a) => Colonnade Sortable a (DBCell m c) +colUserEmail = sortable (Just "email") (i18nCell MsgEMail) cellHasEMail diff --git a/templates/widgets/link-email.hamlet b/templates/widgets/link-email.hamlet new file mode 100644 index 000000000..bd19fef99 --- /dev/null +++ b/templates/widgets/link-email.hamlet @@ -0,0 +1,2 @@ + + #{userEmail} \ No newline at end of file