Form-Identifiers introduced

This commit is contained in:
SJost 2017-11-17 16:59:48 +01:00
parent 52be9e3198
commit 1b272c6ee8
2 changed files with 12 additions and 2 deletions

View File

@ -233,8 +233,7 @@ courseToForm cEntity = CourseForm
course = entityVal cEntity
newCourseForm :: Maybe CourseForm -> Form CourseForm
newCourseForm template = -- identifyForm "newCourseForm" $
\html -> do
newCourseForm template = identForm FIDcourse $ \html -> do
-- mopt hiddenField
-- cidKey <- getsYesod appCryptoIDKey
-- courseId <- runMaybeT $ do

View File

@ -24,6 +24,17 @@ import Yesod.Form.Bootstrap3
import Web.PathPieces (showToPathPiece, readFromPathPiece)
------------------------------------------------
-- Unique Form Identifiers to avoid accidents --
------------------------------------------------
data FormIdentifier = FIDcourse
deriving (Enum, Eq, Ord, Bounded, Read, Show)
identForm :: FormIdentifier -> Form a -> Form a
identForm fid = identifyForm (T.pack $ show fid)
----------------------------
-- Buttons (new version ) --