From ad5741e4aefa5a9743b10c46408bdf8bd951a335 Mon Sep 17 00:00:00 2001 From: SJost Date: Sun, 17 Feb 2019 15:25:36 +0100 Subject: [PATCH] minor refactor --- src/Utils/Form.hs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Utils/Form.hs b/src/Utils/Form.hs index 17a0f362f..0391faea1 100644 --- a/src/Utils/Form.hs +++ b/src/Utils/Form.hs @@ -430,20 +430,18 @@ optionsFinite = do -- Special Forms -- ------------------- -aformSection' :: (MonadHandler m, site ~ HandlerSite m, RenderMessage site FormMessage) => SomeMessage site -> AForm m () +-- | Alternative implementation for 'aformSection' in a more standard that +-- allows tooltips and arbitrary attributs. Section header must be given through `fsLabel` +aformSection' :: (MonadHandler m, site ~ HandlerSite m, RenderMessage site FormMessage) => FieldSettings site -> AForm m () aformSection' = formToAForm . fmap (second pure) . formSection' --- | Alternative implementation for 'formSection' in a more standard that shows how allows tooltips and attributs -formSection' :: (MonadHandler m, site ~ HandlerSite m, RenderMessage site FormMessage) => SomeMessage site -> MForm m (FormResult (), FieldView site) -- TODO: WIP, delete -formSection' formSectionTitle = mreq noinputField sectionSettings Nothing +-- | Alternative implementation for 'formSection' in a more standard that +-- allows tooltips and arbitrary attributs. Section header must be given through `fsLabel` +formSection' :: (MonadHandler m, site ~ HandlerSite m, RenderMessage site FormMessage) => + FieldSettings site -> MForm m (FormResult (), FieldView site) -- TODO: WIP, delete +formSection' formSectionTitleSettings = mreq noinputField sectionSettings Nothing where - sectionSettings = FieldSettings - { fsLabel = formSectionTitle - , fsTooltip = Nothing - , fsId = Just idFormSectionNoinput - , fsName = Nothing - , fsAttrs = [("class",idFormSectionNoinput)] -- TODO: check if this it useful at all - } + sectionSettings = formSectionTitleSettings { fsId = Just idFormSectionNoinput }