bootstrap3 forms
This commit is contained in:
parent
d2b42c30ad
commit
00c1cd0db1
35 changed files with 176 additions and 132 deletions
|
@ -68,8 +68,8 @@ s3InputAForm defcreds = AWSInput
|
|||
<$> accessKeyIDFieldWithHelp (T.pack . fst <$> defcreds)
|
||||
<*> secretAccessKeyField (T.pack . snd <$> defcreds)
|
||||
<*> datacenterField AWS.S3
|
||||
<*> areq (selectFieldList storageclasses) "Storage class" (Just StandardRedundancy)
|
||||
<*> areq textField "Repository name" (Just "S3")
|
||||
<*> areq (selectFieldList storageclasses) (bfs "Storage class") (Just StandardRedundancy)
|
||||
<*> areq textField (bfs "Repository name") (Just "S3")
|
||||
<*> enableEncryptionField
|
||||
where
|
||||
storageclasses :: [(Text, StorageClass)]
|
||||
|
@ -84,7 +84,7 @@ glacierInputAForm defcreds = AWSInput
|
|||
<*> secretAccessKeyField (T.pack . snd <$> defcreds)
|
||||
<*> datacenterField AWS.Glacier
|
||||
<*> pure StandardRedundancy
|
||||
<*> areq textField "Repository name" (Just "glacier")
|
||||
<*> areq textField (bfs "Repository name") (Just "glacier")
|
||||
<*> enableEncryptionField
|
||||
|
||||
awsCredsAForm :: Maybe CredPair -> MkAForm AWSCreds
|
||||
|
@ -93,7 +93,7 @@ awsCredsAForm defcreds = AWSCreds
|
|||
<*> secretAccessKeyField (T.pack . snd <$> defcreds)
|
||||
|
||||
accessKeyIDField :: Widget -> Maybe Text -> MkAForm Text
|
||||
accessKeyIDField help = areq (textField `withNote` help) "Access Key ID"
|
||||
accessKeyIDField help = areq (textField `withNote` help) (bfs "Access Key ID")
|
||||
|
||||
accessKeyIDFieldWithHelp :: Maybe Text -> MkAForm Text
|
||||
accessKeyIDFieldWithHelp = accessKeyIDField help
|
||||
|
@ -104,10 +104,10 @@ accessKeyIDFieldWithHelp = accessKeyIDField help
|
|||
|]
|
||||
|
||||
secretAccessKeyField :: Maybe Text -> MkAForm Text
|
||||
secretAccessKeyField = areq passwordField "Secret Access Key"
|
||||
secretAccessKeyField = areq passwordField (bfs "Secret Access Key")
|
||||
|
||||
datacenterField :: AWS.Service -> MkAForm Text
|
||||
datacenterField service = areq (selectFieldList list) "Datacenter" defregion
|
||||
datacenterField service = areq (selectFieldList list) (bfs "Datacenter") defregion
|
||||
where
|
||||
list = M.toList $ AWS.regionMap service
|
||||
defregion = Just $ AWS.defaultRegion service
|
||||
|
@ -120,7 +120,7 @@ postAddS3R :: Handler Html
|
|||
postAddS3R = awsConfigurator $ do
|
||||
defcreds <- liftAnnex previouslyUsedAWSCreds
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $ s3InputAForm defcreds
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ s3InputAForm defcreds
|
||||
case result of
|
||||
FormSuccess input -> liftH $ do
|
||||
let name = T.unpack $ repoName input
|
||||
|
@ -143,7 +143,7 @@ postAddGlacierR :: Handler Html
|
|||
postAddGlacierR = glacierConfigurator $ do
|
||||
defcreds <- liftAnnex previouslyUsedAWSCreds
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $ glacierInputAForm defcreds
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ glacierInputAForm defcreds
|
||||
case result of
|
||||
FormSuccess input -> liftH $ do
|
||||
let name = T.unpack $ repoName input
|
||||
|
@ -186,7 +186,7 @@ enableAWSRemote :: RemoteType -> UUID -> Widget
|
|||
enableAWSRemote remotetype uuid = do
|
||||
defcreds <- liftAnnex previouslyUsedAWSCreds
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $ awsCredsAForm defcreds
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ awsCredsAForm defcreds
|
||||
case result of
|
||||
FormSuccess creds -> liftH $ do
|
||||
m <- liftAnnex readRemoteLog
|
||||
|
|
|
@ -89,8 +89,8 @@ deleteCurrentRepository = dangerPage $ do
|
|||
havegitremotes <- haveremotes syncGitRemotes
|
||||
havedataremotes <- haveremotes syncDataRemotes
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $ sanityVerifierAForm $
|
||||
SanityVerifier magicphrase
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $
|
||||
sanityVerifierAForm $ SanityVerifier magicphrase
|
||||
case result of
|
||||
FormSuccess _ -> liftH $ do
|
||||
dir <- liftAnnex $ fromRepo Git.repoPath
|
||||
|
@ -122,7 +122,7 @@ data SanityVerifier = SanityVerifier T.Text
|
|||
|
||||
sanityVerifierAForm :: SanityVerifier -> MkAForm SanityVerifier
|
||||
sanityVerifierAForm template = SanityVerifier
|
||||
<$> areq checksanity "Confirm deletion?" Nothing
|
||||
<$> areq checksanity (bfs "Confirm deletion?") Nothing
|
||||
where
|
||||
checksanity = checkBool (\input -> SanityVerifier input == template)
|
||||
insane textField
|
||||
|
|
|
@ -142,9 +142,9 @@ setRepoConfig uuid mremote oldc newc = do
|
|||
editRepositoryAForm :: Maybe Remote -> RepoConfig -> MkAForm RepoConfig
|
||||
editRepositoryAForm mremote def = RepoConfig
|
||||
<$> areq (if ishere then readonlyTextField else textField)
|
||||
"Name" (Just $ repoName def)
|
||||
<*> aopt textField "Description" (Just $ repoDescription def)
|
||||
<*> areq (selectFieldList groups `withNote` help) "Repository group" (Just $ repoGroup def)
|
||||
(bfs "Name") (Just $ repoName def)
|
||||
<*> aopt textField (bfs "Description") (Just $ repoDescription def)
|
||||
<*> areq (selectFieldList groups `withNote` help) (bfs "Repository group") (Just $ repoGroup def)
|
||||
<*> associateddirectory
|
||||
<*> areq checkBoxField "Syncing enabled" (Just $ repoSyncable def)
|
||||
where
|
||||
|
@ -166,7 +166,7 @@ editRepositoryAForm mremote def = RepoConfig
|
|||
|
||||
associateddirectory = case repoAssociatedDirectory def of
|
||||
Nothing -> aopt hiddenField "" Nothing
|
||||
Just d -> aopt textField "Associated directory" (Just $ Just d)
|
||||
Just d -> aopt textField (bfs "Associated directory") (Just $ Just d)
|
||||
|
||||
getEditRepositoryR :: RepoId -> Handler Html
|
||||
getEditRepositoryR = postEditRepositoryR
|
||||
|
@ -195,7 +195,7 @@ editForm new (RepoUUID uuid) = page "Edit repository" (Just Configuration) $ do
|
|||
curr <- liftAnnex $ getRepoConfig uuid mremote
|
||||
liftAnnex $ checkAssociatedDirectory curr mremote
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $ editRepositoryAForm mremote curr
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ editRepositoryAForm mremote curr
|
||||
case result of
|
||||
FormSuccess input -> liftH $ do
|
||||
setRepoConfig uuid mremote curr input
|
||||
|
|
|
@ -64,10 +64,10 @@ runFsckForm new activity = case activity of
|
|||
u <- liftAnnex getUUID
|
||||
repolist <- liftAssistant (getrepolist ru)
|
||||
runFormPostNoToken $ \msg -> do
|
||||
(reposRes, reposView) <- mreq (selectFieldList repolist) "" (Just ru)
|
||||
(durationRes, durationView) <- mreq intField "" (Just $ durationSeconds d `quot` 60 )
|
||||
(timeRes, timeView) <- mreq (selectFieldList times) "" (Just t)
|
||||
(recurranceRes, recurranceView) <- mreq (selectFieldList recurrances) "" (Just r)
|
||||
(reposRes, reposView) <- mreq (selectFieldList repolist) (bfs "") (Just ru)
|
||||
(durationRes, durationView) <- mreq intField (bfs "") (Just $ durationSeconds d `quot` 60 )
|
||||
(timeRes, timeView) <- mreq (selectFieldList times) (bfs "") (Just t)
|
||||
(recurranceRes, recurranceView) <- mreq (selectFieldList recurrances) (bfs "") (Just r)
|
||||
let form = do
|
||||
webAppFormAuthToken
|
||||
$(widgetFile "configurators/fsck/formcontent")
|
||||
|
@ -175,7 +175,8 @@ fsckPreferencesAForm def = FsckPreferences
|
|||
runFsckPreferencesForm :: Handler ((FormResult FsckPreferences, Widget), Enctype)
|
||||
runFsckPreferencesForm = do
|
||||
prefs <- liftAnnex getFsckPreferences
|
||||
runFormPostNoToken $ renderBootstrap $ fsckPreferencesAForm prefs
|
||||
runFormPostNoToken $ renderBootstrap3 formLayout $ fsckPreferencesAForm prefs
|
||||
where formLayout = BootstrapHorizontalForm (ColSm 0) (ColSm 2) (ColSm 0) (ColSm 10)
|
||||
|
||||
showFsckPreferencesForm :: Widget
|
||||
showFsckPreferencesForm = do
|
||||
|
|
|
@ -83,8 +83,8 @@ iaInputAForm :: Maybe CredPair -> MkAForm IAInput
|
|||
iaInputAForm defcreds = IAInput
|
||||
<$> accessKeyIDFieldWithHelp (T.pack . fst <$> defcreds)
|
||||
<*> AWS.secretAccessKeyField (T.pack . snd <$> defcreds)
|
||||
<*> areq (selectFieldList mediatypes) "Media Type" (Just MediaOmitted)
|
||||
<*> areq (textField `withExpandableNote` ("Help", itemNameHelp)) "Item Name" Nothing
|
||||
<*> areq (selectFieldList mediatypes) (bfs "Media Type") (Just MediaOmitted)
|
||||
<*> areq (textField `withExpandableNote` ("Help", itemNameHelp)) (bfs "Item Name") Nothing
|
||||
where
|
||||
mediatypes :: [(Text, MediaType)]
|
||||
mediatypes = map (\t -> (T.pack $ showMediaType t, t)) [minBound..]
|
||||
|
@ -126,7 +126,7 @@ postAddIAR :: Handler Html
|
|||
postAddIAR = iaConfigurator $ do
|
||||
defcreds <- liftAnnex previouslyUsedIACreds
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $ iaInputAForm defcreds
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ iaInputAForm defcreds
|
||||
case result of
|
||||
FormSuccess input -> liftH $ do
|
||||
let name = escapeBucket $ T.unpack $ itemName input
|
||||
|
@ -165,7 +165,7 @@ enableIARemote :: UUID -> Widget
|
|||
enableIARemote uuid = do
|
||||
defcreds <- liftAnnex previouslyUsedIACreds
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $ iaCredsAForm defcreds
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ iaCredsAForm defcreds
|
||||
case result of
|
||||
FormSuccess creds -> liftH $ do
|
||||
m <- liftAnnex readRemoteLog
|
||||
|
|
|
@ -143,7 +143,7 @@ defaultRepositoryPath firstrun = do
|
|||
|
||||
newRepositoryForm :: FilePath -> Hamlet.Html -> MkMForm RepositoryPath
|
||||
newRepositoryForm defpath msg = do
|
||||
(pathRes, pathView) <- mreq (repositoryPathField True) ""
|
||||
(pathRes, pathView) <- mreq (repositoryPathField True) (bfs "")
|
||||
(Just $ T.pack $ addTrailingPathSeparator defpath)
|
||||
let (err, errmsg) = case pathRes of
|
||||
FormMissing -> (False, "")
|
||||
|
@ -217,10 +217,10 @@ getCombineRepositoryR newrepopath newrepouuid = do
|
|||
remotename = takeFileName newrepopath
|
||||
|
||||
selectDriveForm :: [RemovableDrive] -> Hamlet.Html -> MkMForm RemovableDrive
|
||||
selectDriveForm drives = renderBootstrap $ RemovableDrive
|
||||
selectDriveForm drives = renderBootstrap3 bootstrapFormLayout $ RemovableDrive
|
||||
<$> pure Nothing
|
||||
<*> areq (selectFieldList pairs `withNote` onlywritable) "Select drive:" Nothing
|
||||
<*> areq textField "Use this directory on the drive:"
|
||||
<*> areq (selectFieldList pairs `withNote` onlywritable) (bfs "Select drive:") Nothing
|
||||
<*> areq textField (bfs "Use this directory on the drive:")
|
||||
(Just $ T.pack gitAnnexAssistantDefaultDir)
|
||||
where
|
||||
pairs = zip (map describe drives) (map mountPoint drives)
|
||||
|
|
|
@ -265,8 +265,8 @@ data InputSecret = InputSecret { secretText :: Maybe Text }
|
|||
promptSecret :: Maybe PairMsg -> (Text -> Secret -> Widget) -> Handler Html
|
||||
promptSecret msg cont = pairPage $ do
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $
|
||||
InputSecret <$> aopt textField "Secret phrase" Nothing
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $
|
||||
InputSecret <$> aopt textField (bfs "Secret phrase") Nothing
|
||||
case result of
|
||||
FormSuccess v -> do
|
||||
let rawsecret = fromMaybe "" $ secretText v
|
||||
|
|
|
@ -36,13 +36,13 @@ data PrefsForm = PrefsForm
|
|||
prefsAForm :: PrefsForm -> MkAForm PrefsForm
|
||||
prefsAForm def = PrefsForm
|
||||
<$> areq (storageField `withNote` diskreservenote)
|
||||
"Disk reserve" (Just $ diskReserve def)
|
||||
(bfs "Disk reserve") (Just $ diskReserve def)
|
||||
<*> areq (positiveIntField `withNote` numcopiesnote)
|
||||
"Number of copies" (Just $ numCopies def)
|
||||
(bfs "Number of copies") (Just $ numCopies def)
|
||||
<*> areq (checkBoxField `withNote` autostartnote)
|
||||
"Auto start" (Just $ autoStart def)
|
||||
<*> areq (selectFieldList autoUpgradeChoices)
|
||||
autoUpgradeLabel (Just $ autoUpgrade def)
|
||||
(bfs autoUpgradeLabel) (Just $ autoUpgrade def)
|
||||
<*> areq (checkBoxField `withNote` debugnote)
|
||||
"Enable debug logging" (Just $ debugEnabled def)
|
||||
where
|
||||
|
@ -109,7 +109,7 @@ postPreferencesR :: Handler Html
|
|||
postPreferencesR = page "Preferences" (Just Configuration) $ do
|
||||
((result, form), enctype) <- liftH $ do
|
||||
current <- liftAnnex getPrefs
|
||||
runFormPostNoToken $ renderBootstrap $ prefsAForm current
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ prefsAForm current
|
||||
case result of
|
||||
FormSuccess new -> liftH $ do
|
||||
liftAnnex $ storePrefs new
|
||||
|
|
|
@ -76,10 +76,10 @@ sshInputAForm :: Field Handler Text -> SshInput -> AForm Handler SshInput
|
|||
sshInputAForm :: Field WebApp WebApp Text -> SshInput -> AForm WebApp WebApp SshInput
|
||||
#endif
|
||||
sshInputAForm hostnamefield def = SshInput
|
||||
<$> aopt check_hostname "Host name" (Just $ inputHostname def)
|
||||
<*> aopt check_username "User name" (Just $ inputUsername def)
|
||||
<*> aopt textField "Directory" (Just $ Just $ fromMaybe (T.pack gitAnnexAssistantDefaultDir) $ inputDirectory def)
|
||||
<*> areq intField "Port" (Just $ inputPort def)
|
||||
<$> aopt check_hostname (bfs "Host name") (Just $ inputHostname def)
|
||||
<*> aopt check_username (bfs "User name") (Just $ inputUsername def)
|
||||
<*> aopt textField (bfs "Directory") (Just $ Just $ fromMaybe (T.pack gitAnnexAssistantDefaultDir) $ inputDirectory def)
|
||||
<*> areq intField (bfs "Port") (Just $ inputPort def)
|
||||
where
|
||||
check_username = checkBool (all (`notElem` "/:@ \t") . T.unpack)
|
||||
bad_username textField
|
||||
|
@ -121,7 +121,7 @@ postAddSshR :: Handler Html
|
|||
postAddSshR = sshConfigurator $ do
|
||||
username <- liftIO $ T.pack <$> myUserName
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $ sshInputAForm textField $
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ sshInputAForm textField $
|
||||
SshInput Nothing (Just username) Nothing 22
|
||||
case result of
|
||||
FormSuccess sshinput -> do
|
||||
|
@ -173,7 +173,7 @@ enableSpecialSshRemote getsshinput rsyncnetsetup genericsetup u = do
|
|||
case (mkSshInput . unmangle <$> getsshinput m, M.lookup "name" m) of
|
||||
(Just sshinput, Just reponame) -> sshConfigurator $ do
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $ sshInputAForm textField sshinput
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ sshInputAForm textField sshinput
|
||||
case result of
|
||||
FormSuccess sshinput'
|
||||
| isRsyncNet (inputHostname sshinput') ->
|
||||
|
@ -450,7 +450,7 @@ getAddRsyncNetR = postAddRsyncNetR
|
|||
postAddRsyncNetR :: Handler Html
|
||||
postAddRsyncNetR = do
|
||||
((result, form), enctype) <- runFormPostNoToken $
|
||||
renderBootstrap $ sshInputAForm hostnamefield $
|
||||
renderBootstrap3 bootstrapFormLayout $ sshInputAForm hostnamefield $
|
||||
SshInput Nothing Nothing Nothing 22
|
||||
let showform status = inpage $
|
||||
$(widgetFile "configurators/rsync.net/add")
|
||||
|
|
|
@ -27,9 +27,9 @@ data UnusedForm = UnusedForm
|
|||
|
||||
unusedForm :: UnusedForm -> Hamlet.Html -> MkMForm UnusedForm
|
||||
unusedForm def msg = do
|
||||
(enableRes, enableView) <- mreq (selectFieldList enabledisable) ""
|
||||
(enableRes, enableView) <- mreq (selectFieldList enabledisable) (bfs "")
|
||||
(Just $ enableExpire def)
|
||||
(whenRes, whenView) <- mreq intField ""
|
||||
(whenRes, whenView) <- mreq intField (bfs "")
|
||||
(Just $ expireWhen def)
|
||||
let form = do
|
||||
webAppFormAuthToken
|
||||
|
|
|
@ -45,16 +45,16 @@ toCredPair input = (T.unpack $ user input, T.unpack $ password input)
|
|||
|
||||
boxComAForm :: Maybe CredPair -> MkAForm WebDAVInput
|
||||
boxComAForm defcreds = WebDAVInput
|
||||
<$> areq textField "Username or Email" (T.pack . fst <$> defcreds)
|
||||
<*> areq passwordField "Box.com Password" (T.pack . snd <$> defcreds)
|
||||
<*> areq checkBoxField "Share this account with other devices and friends?" (Just True)
|
||||
<*> areq textField "Directory" (Just "annex")
|
||||
<$> areq textField (bfs "Username or Email") (T.pack . fst <$> defcreds)
|
||||
<*> areq passwordField (bfs "Box.com Password") (T.pack . snd <$> defcreds)
|
||||
<*> areq checkBoxField (bfs "Share this account with other devices and friends?") (Just True)
|
||||
<*> areq textField (bfs "Directory") (Just "annex")
|
||||
<*> enableEncryptionField
|
||||
|
||||
webDAVCredsAForm :: Maybe CredPair -> MkAForm WebDAVInput
|
||||
webDAVCredsAForm defcreds = WebDAVInput
|
||||
<$> areq textField "Username or Email" (T.pack . fst <$> defcreds)
|
||||
<*> areq passwordField "Password" (T.pack . snd <$> defcreds)
|
||||
<$> areq textField (bfs "Username or Email") (T.pack . fst <$> defcreds)
|
||||
<*> areq passwordField (bfs "Password") (T.pack . snd <$> defcreds)
|
||||
<*> pure False
|
||||
<*> pure T.empty
|
||||
<*> pure NoEncryption -- not used!
|
||||
|
@ -66,7 +66,8 @@ postAddBoxComR :: Handler Html
|
|||
postAddBoxComR = boxConfigurator $ do
|
||||
defcreds <- liftAnnex $ previouslyUsedWebDAVCreds "box.com"
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $ boxComAForm defcreds
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout
|
||||
$ boxComAForm defcreds
|
||||
case result of
|
||||
FormSuccess input -> liftH $
|
||||
makeWebDavRemote initSpecialRemote "box.com" (toCredPair input) $ M.fromList
|
||||
|
@ -109,7 +110,8 @@ postEnableWebDAVR uuid = do
|
|||
maybe (pure Nothing) previouslyUsedWebDAVCreds $
|
||||
urlHost url
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $ webDAVCredsAForm defcreds
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $
|
||||
webDAVCredsAForm defcreds
|
||||
case result of
|
||||
FormSuccess input -> liftH $
|
||||
makeWebDavRemote enableSpecialRemote name (toCredPair input) M.empty
|
||||
|
|
|
@ -99,7 +99,7 @@ xmppform :: Route WebApp -> Handler Html
|
|||
xmppform next = xmppPage $ do
|
||||
((result, form), enctype) <- liftH $ do
|
||||
oldcreds <- liftAnnex getXMPPCreds
|
||||
runFormPostNoToken $ renderBootstrap $ xmppAForm $
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ xmppAForm $
|
||||
creds2Form <$> oldcreds
|
||||
let showform problem = $(widgetFile "configurators/xmpp")
|
||||
case result of
|
||||
|
@ -162,8 +162,8 @@ creds2Form c = XMPPForm (xmppJID c) (xmppPassword c)
|
|||
|
||||
xmppAForm :: (Maybe XMPPForm) -> MkAForm XMPPForm
|
||||
xmppAForm def = XMPPForm
|
||||
<$> areq jidField "Jabber address" (formJID <$> def)
|
||||
<*> areq passwordField "Password" Nothing
|
||||
<$> areq jidField (bfs "Jabber address") (formJID <$> def)
|
||||
<*> areq passwordField (bfs "Password") Nothing
|
||||
|
||||
jidField :: MkField Text
|
||||
jidField = checkBool (isJust . parseJID) bad textField
|
||||
|
|
|
@ -17,6 +17,8 @@ import Assistant.Gpg
|
|||
|
||||
import Yesod hiding (textField, passwordField)
|
||||
import Yesod.Form.Fields as F
|
||||
import Yesod.Form.Bootstrap3 hiding (bfs)
|
||||
import Data.String (IsString (..))
|
||||
import Data.Text (Text)
|
||||
|
||||
{- Yesod's textField sets the required attribute for required fields.
|
||||
|
@ -80,10 +82,27 @@ enableEncryptionField :: (RenderMessage site FormMessage) => AForm (HandlerT sit
|
|||
#else
|
||||
enableEncryptionField :: RenderMessage master FormMessage => AForm sub master EnableEncryption
|
||||
#endif
|
||||
enableEncryptionField = areq (selectFieldList choices) "Encryption" (Just SharedEncryption)
|
||||
enableEncryptionField = areq (selectFieldList choices) (bfs "Encryption") (Just SharedEncryption)
|
||||
where
|
||||
choices :: [(Text, EnableEncryption)]
|
||||
choices =
|
||||
[ ("Encrypt all data", SharedEncryption)
|
||||
, ("Disable encryption", NoEncryption)
|
||||
]
|
||||
|
||||
{- Defines the layout used by the Bootstrap3 form helper -}
|
||||
bootstrapFormLayout :: BootstrapFormLayout
|
||||
bootstrapFormLayout = BootstrapHorizontalForm (ColSm 0) (ColSm 2) (ColSm 0) (ColSm 5)
|
||||
|
||||
{- Adds the form-control class used by Bootstrap3 for layout to a field
|
||||
- This is the same as Yesod.Form.Bootstrap3.bfs except it takes just a Text
|
||||
- parameter as I couldn't get the original bfs to compile due to type ambiguities.
|
||||
-}
|
||||
bfs :: Text -> FieldSettings master
|
||||
bfs msg = FieldSettings
|
||||
{ fsLabel = SomeMessage msg
|
||||
, fsName = Nothing
|
||||
, fsId = Nothing
|
||||
, fsAttrs = [("class", "form-control")]
|
||||
, fsTooltip = Nothing
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ module Utility.Yesod
|
|||
|
||||
#if MIN_VERSION_yesod(1,2,0)
|
||||
import Yesod as Y
|
||||
import Yesod.Form.Bootstrap3 as Y hiding (bfs)
|
||||
#else
|
||||
import Yesod as Y hiding (Html)
|
||||
#endif
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Add repository
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Add repository
|
||||
<div .modal .fade #workingmodal>
|
||||
<div .modal-header>
|
||||
<h3>
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
<a .btn .btn-primary href="@{AddDriveR}">
|
||||
Rescan for removable drives
|
||||
$else
|
||||
<form method="post" enctype=#{enctype}>
|
||||
<form method="post" enctype=#{enctype} .form-horizontal>
|
||||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<button .btn .btn-primary type=submit>Use this drive</button> #
|
||||
<a .btn .btn-default href="@{AddDriveR}">
|
||||
Rescan for removable drives
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit>Use this drive</button> #
|
||||
<a .btn .btn-default href="@{AddDriveR}">
|
||||
Rescan for removable drives
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Add Glacier repository
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Add Glacier repository
|
||||
<div .modal .fade #workingmodal>
|
||||
<div .modal-header>
|
||||
<h3>
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Add Internet Archive item
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Add Internet Archive item
|
||||
<div .modal .fade #workingmodal>
|
||||
<div .modal-header>
|
||||
<h3>
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Add S3 repository
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Add S3 repository
|
||||
<div .modal .fade #workingmodal>
|
||||
<div .modal-header>
|
||||
<h3>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<div .col-md-2>
|
||||
<button .btn .btn-danger type=submit>
|
||||
<span .glyphicon .glyphicon-warning-sign></span> Delete this repository #
|
||||
<a .btn .btn-default href="@{DashboardR}">
|
||||
|
|
|
@ -20,11 +20,12 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit>
|
||||
Save Changes #
|
||||
<a .btn .btn-default href="@{DashboardR}">
|
||||
Cancel #
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit>
|
||||
Save Changes #
|
||||
<a .btn .btn-default href="@{DashboardR}">
|
||||
Cancel #
|
||||
$if new
|
||||
<p>
|
||||
In a hurry? Feel free to skip this step! You can always come back #
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Enable Amazon repository
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Enable Amazon repository
|
||||
<div .modal .fade #workingmodal>
|
||||
<div .modal-header>
|
||||
<h3>
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Enable Internet Archive repository
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Enable Internet Archive repository
|
||||
<div .modal .fade #workingmodal>
|
||||
<div .modal-header>
|
||||
<h3>
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Enable repository
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Enable repository
|
||||
<div .modal .fade #workingmodal>
|
||||
<div .modal-header>
|
||||
<h3>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
input[type=number]
|
||||
.form-inline input[type=number]
|
||||
width: 5em
|
||||
select
|
||||
width: 10em
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
#{msg}
|
||||
<p>
|
||||
<div .input-group>
|
||||
<div .form-group>
|
||||
Check ^{fvInput reposView} for #
|
||||
<div .form-group>
|
||||
^{fvInput durationView} minutes #
|
||||
<div .form-group>
|
||||
^{fvInput recurranceView} #
|
||||
starting at ^{fvInput timeView} #
|
||||
$if new
|
||||
<button type=submit .btn .btn-primary>
|
||||
Add
|
||||
$else
|
||||
<button type=submit .btn .btn-default>
|
||||
Save
|
||||
<a .btn .btn-default href="@{RemoveActivityR u activity}">
|
||||
Remove
|
||||
starting at ^{fvInput timeView} #
|
||||
$if new
|
||||
<button type=submit .btn .btn-primary>
|
||||
Add
|
||||
$else
|
||||
<button type=submit .btn .btn-default>
|
||||
Save
|
||||
<a .btn .btn-default href="@{RemoveActivityR u activity}">
|
||||
Remove
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<div .well>
|
||||
<form method="post" .form-horizontal action=@{ConfigFsckPreferencesR} enctype=#{enctype}>
|
||||
^{form}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit>
|
||||
Save
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit>
|
||||
Save
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
#{msg}
|
||||
<p>
|
||||
<div .input-group>
|
||||
<span .input-group-addon>
|
||||
<span .glyphicon .glyphicon-folder-open></span>
|
||||
^{fvInput pathView}
|
||||
<button type=submit .btn .btn-primary>
|
||||
Make Repository
|
||||
<div .form-group>
|
||||
<div .input-group>
|
||||
<span .input-group-addon>
|
||||
<span .glyphicon .glyphicon-folder-open></span>
|
||||
^{fvInput pathView}
|
||||
<span .input-group-btn>
|
||||
<button type=submit .btn .btn-primary>
|
||||
Make Repository
|
||||
$if err
|
||||
<div .alert .alert-danger>
|
||||
#{errmsg}
|
||||
|
|
|
@ -30,12 +30,13 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit>
|
||||
$if start
|
||||
Start pairing
|
||||
$else
|
||||
Finish pairing
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit>
|
||||
$if start
|
||||
Start pairing
|
||||
$else
|
||||
Finish pairing
|
||||
<div .alert .alert-info>
|
||||
$if start
|
||||
<p>
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit>
|
||||
Save Preferences
|
||||
<a .btn .btn-default href="@{ConfigurationR}">
|
||||
Cancel
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit>
|
||||
Save Preferences
|
||||
<a .btn .btn-default href="@{ConfigurationR}">
|
||||
Cancel
|
||||
|
|
|
@ -26,9 +26,10 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit onclick="$('#setupmodal').modal('show');">
|
||||
Use this rsync.net repository
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit onclick="$('#setupmodal').modal('show');">
|
||||
Use this rsync.net repository
|
||||
<div .modal .fade #setupmodal>
|
||||
<div .modal-header>
|
||||
<h3>
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit onclick="$('#testmodal').modal('show');">
|
||||
Check this server
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit onclick="$('#testmodal').modal('show');">
|
||||
Check this server
|
||||
^{sshTestModal}
|
||||
|
|
|
@ -8,9 +8,10 @@
|
|||
<p>
|
||||
<form method="post" .form-horizontal enctype=#{enctype}>
|
||||
<fieldset>
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit onclick="$('#testmodal').modal('show');">
|
||||
Check this server
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit onclick="$('#testmodal').modal('show');">
|
||||
Check this server
|
||||
$case status
|
||||
$of UnusableServer msg
|
||||
<div .alert .alert-danger>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#{msg}
|
||||
<p>
|
||||
<div .input-group>
|
||||
<div .form-group>
|
||||
^{fvInput enableView} after ^{fvInput whenView} days.
|
||||
<button type=submit .btn .btn-default >
|
||||
Save Changes
|
||||
|
|
|
@ -22,9 +22,10 @@
|
|||
<fieldset>
|
||||
^{form}
|
||||
^{webAppFormAuthToken}
|
||||
<div .form-actions>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Use this account
|
||||
<div .form-group>
|
||||
<div .col-sm-offset-2>
|
||||
<button .btn .btn-primary type=submit onclick="$('#workingmodal').modal('show');">
|
||||
Use this account
|
||||
<a .btn .btn-default href="@{DisconnectXMPPR}">
|
||||
Stop using this account
|
||||
<div .modal .fade #workingmodal>
|
||||
|
|
Loading…
Reference in a new issue