generate correct Bootstrap forms

This commit is contained in:
Filip Gralinski 2016-02-15 20:36:01 +01:00
parent 4e3523e3db
commit e4dafcd5c6
2 changed files with 8 additions and 8 deletions

View File

@ -2,7 +2,7 @@ module Handler.ShowChallenge where
import Import
import Yesod.Form.Bootstrap3 (BootstrapFormLayout (..), renderBootstrap3,
withSmallInput)
withSmallInput, bfs)
import Data.Monoid
@ -241,9 +241,9 @@ challengeSubmissionWidget formWidget formEnctype challenge = $(widgetFile "chall
submissionForm :: Maybe Text -> Form (Text, Text, Text)
submissionForm defaultUrl = renderBootstrap3 BootstrapBasicForm $ (,,)
<$> areq textField (fieldSettingsLabel MsgSubmissionDescription) Nothing
<*> areq textField (fieldSettingsLabel MsgSubmissionUrl) defaultUrl
<*> areq textField (fieldSettingsLabel MsgSubmissionBranch) (Just "master")
<$> areq textField (bfs MsgSubmissionDescription) Nothing
<*> areq textField (bfs MsgSubmissionUrl) defaultUrl
<*> areq textField (bfs MsgSubmissionBranch) (Just "master")
getChallengeMySubmissionsR :: Text -> Handler Html
getChallengeMySubmissionsR name = do

View File

@ -2,7 +2,7 @@ module Handler.YourAccount where
import Import
import Yesod.Form.Bootstrap3 (BootstrapFormLayout (..), renderBootstrap3,
withSmallInput)
withSmallInput, bfs)
import Handler.Shared
import Handler.Extract
@ -41,9 +41,9 @@ postYourAccountR = do
yourAccountForm :: Maybe Text -> Maybe Text -> Maybe Text -> Form (Maybe Text, Maybe Text, Maybe Text)
yourAccountForm maybeName maybeLocalId maybeSshPubKey = renderBootstrap3 BootstrapBasicForm $ (,,)
<$> aopt textField (fieldSettingsLabel MsgAccountName) (Just maybeName)
<*> aopt textField (fieldSettingsLabel MsgId) (Just maybeLocalId)
<*> aopt textField (fieldSettingsLabel MsgSshPubKey) (Just maybeSshPubKey)
<$> aopt textField (bfs MsgAccountName) (Just maybeName)
<*> aopt textField (bfs MsgId) (Just maybeLocalId)
<*> aopt textField (bfs MsgSshPubKey) (Just maybeSshPubKey)
localIdRegexp = makeRegexOpts defaultCompOpt{newSyntax=True} defaultExecOpt ("\\`[a-z][-a-z0-9]{0,31}\\'" ::String)