From 787cf0d7cc9d389381aa6e2bd6043c0094ca2018 Mon Sep 17 00:00:00 2001 From: SJost Date: Sat, 23 Feb 2019 08:15:05 +0100 Subject: [PATCH] =?UTF-8?q?Datumsformate=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Handler/Utils/DateTime.hs | 5 +++++ src/Handler/Utils/Table/Cells.hs | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Handler/Utils/DateTime.hs b/src/Handler/Utils/DateTime.hs index f67850fe2..de2b0705a 100644 --- a/src/Handler/Utils/DateTime.hs +++ b/src/Handler/Utils/DateTime.hs @@ -111,6 +111,7 @@ validDateTimeFormats _ SelFormatDateTime = Set.fromList , DateTimeFormat "%A, %B %d %Y %T" , DateTimeFormat "%d.%m.%Y %R" , DateTimeFormat "%d.%m.%Y %T" + , DateTimeFormat "%a %d.%m.%y %R" , DateTimeFormat "%R %d.%m.%Y" , DateTimeFormat "%T %d.%m.%Y" , DateTimeFormat "%Y-%m-%d %R" @@ -122,8 +123,12 @@ validDateTimeFormats _ SelFormatDate = Set.fromList , DateTimeFormat "%a %b %d %Y" , DateTimeFormat "%A, %d %B %Y" , DateTimeFormat "%A, %B %d %Y" + , DateTimeFormat "%d.%m.%y" , DateTimeFormat "%d.%m.%Y" + , DateTimeFormat "%a %d.%m.%y" + , DateTimeFormat "%a %d.%m.%Y" , DateTimeFormat "%Y-%m-%d" + , DateTimeFormat "%y-%m-%d" ] validDateTimeFormats TimeLocale{..} SelFormatTime = Set.fromList . concat . catMaybes $ [ Just diff --git a/src/Handler/Utils/Table/Cells.hs b/src/Handler/Utils/Table/Cells.hs index 1d2e0b2b3..1ae5abadf 100644 --- a/src/Handler/Utils/Table/Cells.hs +++ b/src/Handler/Utils/Table/Cells.hs @@ -2,7 +2,7 @@ module Handler.Utils.Table.Cells where import Import --- import Data.CaseInsensitive (CI) +import Data.CaseInsensitive (CI) -- import qualified Data.CaseInsensitive as CI import Data.Monoid (Any(..)) @@ -58,6 +58,9 @@ timeCell t = cell $ formatTime SelFormatDateTime t >>= toWidget userCell :: IsDBTable m a => Text -> Text -> DBCell m a userCell displayName surname = cell $ nameWidget displayName surname +emailCell :: IsDBTable m a => CI Text -> DBCell m a +emailCell userEmail = cell $(widgetFile "widgets/link-email") + cellHasUser :: (IsDBTable m c, HasUser a) => a -> DBCell m c cellHasUser = liftA2 userCell (view _userDisplayName) (view _userSurname) @@ -72,14 +75,12 @@ 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 :: (IsDBTable m a, HasUser u) => u -> 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") +cellHasEMail :: (IsDBTable m a, HasUser u) => u -> DBCell m a +cellHasEMail = emailCell . view _userEmail + -- Just for documentation purposes; inline this code instead: