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