templates/widgets/form-section-title.shamlet created for @hamannf

This commit is contained in:
SJost 2019-02-16 17:04:13 +01:00
parent c42f951d89
commit e4f37a1bcc
2 changed files with 15 additions and 10 deletions

View File

@ -39,7 +39,8 @@ import Control.Monad.Writer.Class
import Data.Scientific (Scientific)
import Data.Ratio
import Text.Read (readMaybe)
import Text.Blaze (ToMarkup,preEscapedText)
import Text.Blaze (ToMarkup)
import Text.Hamlet (shamletFile)
import Utils.Lens
@ -640,19 +641,21 @@ infoField txt = Field { fieldEnctype = UrlEncoded
, fieldView = \_theId _name _attrs _val _isReq ->
[whamlet|#{txt}|]
}
aformSection :: (Monad m) => Text -> AForm m ()
aformSection = formToAForm . formSection
aformSection :: (Monad m, ToMarkup t) => t -> AForm m ()
aformSection = formToAForm . fmap (second pure) . formSection
formSection :: (Monad m) => Text -> MForm m (FormResult (), [FieldView site]) -- TODO: WIP, delete
formSection infoText = return (FormSuccess (), [infoView])
formSection :: (Monad m, ToMarkup t) => t -> MForm m (FormResult (), FieldView site) -- TODO: WIP, delete
formSection formSectionTitle = return (FormSuccess (), infoView)
where
flabel :: Html
flabel = $(shamletFile "./templates/widgets/form-section-title.shamlet") -- TODO: Why must this be fully qualified?
infoView = FieldView
{ fvLabel = preEscapedText $ "<h3 class=form-group-title>" <> infoText <> "</h3>"
, fvTooltip = Nothing
, fvId = "formSection"
, fvErrors = Nothing
{ fvLabel = flabel
, fvTooltip = Nothing
, fvId = "formSection"
, fvErrors = Nothing
, fvRequired = False
, fvInput = mempty -- [whamlet|<h3 .form-group-title>#{infoText}|]
, fvInput = mempty
}
infoForm :: Text -> Form () -- TODO: WIP, delete

View File

@ -0,0 +1,2 @@
<h3 class=form-section-title>
#{formSectionTitle}