Basic short-circuit support for mass-input

This commit is contained in:
Gregor Kleen 2019-04-22 12:48:40 +02:00
parent 2fde26b68e
commit ea38ee422f
4 changed files with 23 additions and 1 deletions

View File

@ -36,6 +36,8 @@ import qualified Data.Foldable as Fold
import Control.Monad.Reader.Class (MonadReader(local))
import Text.Hamlet (hamletFile)
$(mapM tupleBoxCoord [2..4])
@ -409,6 +411,12 @@ massInput MassInput{..} FieldSettings{..} fvRequired initialResult csrf = do
MsgRenderer mr <- getMsgRenderer
whenM (hasCustomHeader HeaderMassInputShortcircuit) . liftHandlerT $ do
PageContent{..} <- widgetToPageContent $(widgetFile "widgets/massinput/massinput-standalone")
ur <- getUrlRenderParams
sendResponse $ $(hamletFile "templates/widgets/massinput/massinput-standalone-wrapper.hamlet") ur
let
fvLabel = toHtml $ mr fsLabel
fvTooltip = toHtml . mr <$> fsTooltip

View File

@ -645,7 +645,7 @@ takeSessionJson key = lookupSessionJson key <* deleteSession (toPathPiece key)
-- Custom HTTP Request-Headers --
---------------------------------
data CustomHeader = HeaderIsModal | HeaderDBTableShortcircuit
data CustomHeader = HeaderIsModal | HeaderDBTableShortcircuit | HeaderMassInputShortcircuit
deriving (Eq, Ord, Enum, Bounded, Read, Show, Generic)
instance Universe CustomHeader

View File

@ -0,0 +1,8 @@
$newline never
$# Wrapper around massinput-standalone
$# pageTitle :: Html
$# pageHead :: HtmlUrl url
$# pageBody :: HtmlUrl url
$#
$# Probably only `pageBody` is relevant
^{pageBody}

View File

@ -0,0 +1,6 @@
$newline never
$# Version of `widgets/massinput/massinput` for when short-circuiting happens
$# i.e. the response is only this widget wrapped in `massinput-standalone-wrapper.hamlet`
#{csrf}
^{shapeInput}
^{miWidget}