diff --git a/src/Handler/Admin/Avs.hs b/src/Handler/Admin/Avs.hs index 6376f8727..b8283650b 100644 --- a/src/Handler/Admin/Avs.hs +++ b/src/Handler/Admin/Avs.hs @@ -654,21 +654,30 @@ getAdminAvsUserR uuid = do Es erfolgte damit aber noch kein Update der FRADrive Daten.
+ Generisch formatierte Ansicht, die zeigt, in welche Richtung die Endansicht gehen könnte. + In der Endansicht wären nur ausgewählte Felder mit besserer Bennenung in einer manuell gewählten Reihenfolge sichtbar. +
+ ^{foldMap jsonWidget mbContact} +
+ ^{foldMap jsonWidget mbDataPerson} |] let heading = [whamlet|_{MsgAvsPersonNo} #{userAvsNoPerson}|] siteLayout heading $ do diff --git a/src/Handler/Utils/Widgets.hs b/src/Handler/Utils/Widgets.hs index 6f70a5d57..0d50aaa20 100644 --- a/src/Handler/Utils/Widgets.hs +++ b/src/Handler/Utils/Widgets.hs @@ -13,7 +13,7 @@ import Text.Hamlet (shamletFile) import Handler.Utils.DateTime import qualified Data.Char as Char - +import qualified Data.HashMap.Strict as Aeson -- ON UPDATE replace with: import qualified Data.Aeson.KeyMap as Aeson --------- -- Simple utilities for consistent display @@ -198,3 +198,36 @@ roomReferenceWidget RoomReferenceLink{..} = $(widgetFile "widgets/room-reference where linkText = uriToString id roomRefLink mempty instrModal = modal (i18n MsgRoomReferenceLinkInstructions) $ Right $(widgetFile "widgets/room-reference/link-instructions-modal") + + +---------- +-- JSON -- +---------- + +-- Data.Aeson.Encode.Pretty.encodePretty did not render in Html properly, hence jsonWidget +jsonWidget :: ToJSON a => a -> Widget +jsonWidget x = jsonWidgetAux $ toJSON x + where + jsonWidgetAux :: Value -> Widget + jsonWidgetAux Null = [whamlet|Null|] + jsonWidgetAux (Bool b) = toWidget $ boolSymbol b + jsonWidgetAux (String s) = [whamlet|#{s}|] + jsonWidgetAux (Number n) = [whamlet|#{show n}|] + jsonWidgetAux (Array l) + | 1 >= length l = foldMap jsonWidgetAux l -- empty arrays don't show + | otherwise = + [whamlet| +