From e3a3f28da047b51f8492a805891d8c988d85cb0d Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Sat, 23 Sep 2017 15:04:40 +0200 Subject: [PATCH] use tooltips instead of a list --- Handler/YourAccount.hs | 13 ++++++++----- messages/en.msg | 3 +++ templates/your-account.hamlet | 9 ++------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Handler/YourAccount.hs b/Handler/YourAccount.hs index 1e99ce1..03e3e81 100644 --- a/Handler/YourAccount.hs +++ b/Handler/YourAccount.hs @@ -48,15 +48,18 @@ checkPassword Nothing = True checkPassword (Just "") = True checkPassword (Just passwd) = isPasswordAcceptable passwd -autocompleteOff name = setts { fsAttrs = (fsAttrs setts) ++ [("autocomplete", "nope")]} - where setts = (bfs name) +autocompleteOff name tooltip = setts { fsAttrs = (fsAttrs setts) ++ [("autocomplete", "nope")]} + where setts = (bfs name) { fsTooltip = Just $ SomeMessage tooltip } + +fieldWithTooltip :: forall master msg msg1. (RenderMessage master msg, RenderMessage master msg1) => msg -> msg1 -> FieldSettings master +fieldWithTooltip name tooltip = (bfs name) { fsTooltip = Just $ SomeMessage tooltip } yourAccountForm :: Maybe Text -> Maybe Text -> Maybe Text -> Bool -> Form (Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe FileInfo, Bool) yourAccountForm maybeName maybeLocalId maybeSshPubKey anonimised = renderBootstrap3 BootstrapBasicForm $ (,,,,,) - <$> aopt textField (bfs MsgAccountName) (Just maybeName) - <*> aopt textField (autocompleteOff MsgId) (Just maybeLocalId) + <$> aopt textField (fieldWithTooltip MsgAccountName MsgAccountNameTooltip) (Just maybeName) + <*> aopt textField (autocompleteOff MsgId MsgIdTooltip) (Just maybeLocalId) <*> aopt passwordConfirmField (bfs MsgPassword) Nothing - <*> aopt textField (bfs MsgSshPubKey) (Just maybeSshPubKey) + <*> aopt textField (fieldWithTooltip MsgSshPubKey MsgSshPubKeyTooltip) (Just maybeSshPubKey) <*> fileAFormOpt (bfs MsgAvatar) <*> areq checkBoxField (bfs MsgWantToBeAnonimised) (Just anonimised) diff --git a/messages/en.msg b/messages/en.msg index c8efede..50a12fc 100644 --- a/messages/en.msg +++ b/messages/en.msg @@ -17,8 +17,11 @@ SubmissionTags: Submission tags YourAccount: your account AboutMe: about me AccountName: name +AccountNameTooltip: your human-readable name (to be shown on the leaderboard) Id: ID +IdTooltip: to be used in the URLs for your repos (only lower-case letters, digits or hyphens, must start with a lower-case letter), once set cannot be changed! SshPubKey: your SSH public key +SshPubKeyTooltip: needed if you want to access repos hosted on Gonito.net (usually ".ssh/id_rsa.pub" in your home directory after you generated private/public key pair) Home: home Search: search GitCommitSha1: Git commit SHA1 hash diff --git a/templates/your-account.hamlet b/templates/your-account.hamlet index 44ed996..47a3d24 100644 --- a/templates/your-account.hamlet +++ b/templates/your-account.hamlet @@ -6,7 +6,7 @@ $nothing