templates/widgets/form-section-title.shamlet created for @hamannf
This commit is contained in:
parent
c42f951d89
commit
e4f37a1bcc
@ -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
|
||||
|
||||
2
templates/widgets/form-section-title.shamlet
Normal file
2
templates/widgets/form-section-title.shamlet
Normal file
@ -0,0 +1,2 @@
|
||||
<h3 class=form-section-title>
|
||||
#{formSectionTitle}
|
||||
Loading…
Reference in New Issue
Block a user