From fbbe6a48846f7c24f5ddef52fa3d405709bf7a7a Mon Sep 17 00:00:00 2001 From: Joel McCracken Date: Sun, 28 Oct 2018 00:49:07 -0400 Subject: [PATCH 1/2] implement editing of AbstractType --- src/Handler/Admin.hs | 77 +++++++++++++++++++++++++++++++++++++++++--- src/Model/API.hs | 16 +++++++++ src/Routes.hs | 1 + 3 files changed, 89 insertions(+), 5 deletions(-) diff --git a/src/Handler/Admin.hs b/src/Handler/Admin.hs index 8142753..3c0d4a9 100644 --- a/src/Handler/Admin.hs +++ b/src/Handler/Admin.hs @@ -49,14 +49,21 @@ data AbstractTypeForm = , abstractTypeFormDuration :: Word64 } deriving Show -abstractTypeForm :: Form AbstractTypeForm -abstractTypeForm = +mkAbstractTypeForm' :: AbstractType -> Form AbstractTypeForm +mkAbstractTypeForm' at = mkAbstractTypeForm (Just $ abstractTypeName at) (Just $ (unpackTalkDuration . abstractTypeDuration) at) + +mkAbstractTypeForm :: Maybe Text -> Maybe Word64 -> Form AbstractTypeForm +mkAbstractTypeForm atName atDuration = renderDivs $ AbstractTypeForm <$> areq textField (named "talk-type-name" - (placeheld "Talk type name: ")) Nothing + (placeheld "Talk type name: ")) + atName <*> areq intField (named "talk-duration" - (placeheld "Talk type duration in minutes: ")) Nothing + (placeheld "Talk type duration in minutes: ")) + atDuration + +abstractTypeForm = mkAbstractTypeForm Nothing Nothing renderConferenceAbstractTypes :: Entity Conference @@ -84,7 +91,28 @@ renderConferenceAbstractTypes conf@(Entity conferenceId _) $else