Basic short-circuit support for mass-input
This commit is contained in:
parent
2fde26b68e
commit
ea38ee422f
@ -36,6 +36,8 @@ import qualified Data.Foldable as Fold
|
|||||||
|
|
||||||
import Control.Monad.Reader.Class (MonadReader(local))
|
import Control.Monad.Reader.Class (MonadReader(local))
|
||||||
|
|
||||||
|
import Text.Hamlet (hamletFile)
|
||||||
|
|
||||||
|
|
||||||
$(mapM tupleBoxCoord [2..4])
|
$(mapM tupleBoxCoord [2..4])
|
||||||
|
|
||||||
@ -409,6 +411,12 @@ massInput MassInput{..} FieldSettings{..} fvRequired initialResult csrf = do
|
|||||||
|
|
||||||
MsgRenderer mr <- getMsgRenderer
|
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
|
let
|
||||||
fvLabel = toHtml $ mr fsLabel
|
fvLabel = toHtml $ mr fsLabel
|
||||||
fvTooltip = toHtml . mr <$> fsTooltip
|
fvTooltip = toHtml . mr <$> fsTooltip
|
||||||
|
|||||||
@ -645,7 +645,7 @@ takeSessionJson key = lookupSessionJson key <* deleteSession (toPathPiece key)
|
|||||||
-- Custom HTTP Request-Headers --
|
-- Custom HTTP Request-Headers --
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
data CustomHeader = HeaderIsModal | HeaderDBTableShortcircuit
|
data CustomHeader = HeaderIsModal | HeaderDBTableShortcircuit | HeaderMassInputShortcircuit
|
||||||
deriving (Eq, Ord, Enum, Bounded, Read, Show, Generic)
|
deriving (Eq, Ord, Enum, Bounded, Read, Show, Generic)
|
||||||
|
|
||||||
instance Universe CustomHeader
|
instance Universe CustomHeader
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
$newline never
|
||||||
|
$# Wrapper around massinput-standalone
|
||||||
|
$# pageTitle :: Html
|
||||||
|
$# pageHead :: HtmlUrl url
|
||||||
|
$# pageBody :: HtmlUrl url
|
||||||
|
$#
|
||||||
|
$# Probably only `pageBody` is relevant
|
||||||
|
^{pageBody}
|
||||||
6
templates/widgets/massinput/massinput-standalone.hamlet
Normal file
6
templates/widgets/massinput/massinput-standalone.hamlet
Normal 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}
|
||||||
Loading…
Reference in New Issue
Block a user