improve HowTo

This commit is contained in:
Filip Gralinski 2017-09-25 12:47:01 +02:00
parent 5752bf9471
commit 2949ce3a8a
2 changed files with 19 additions and 3 deletions

View File

@ -70,7 +70,15 @@ getChallengeHowToR :: Text -> Handler Html
getChallengeHowToR name = do getChallengeHowToR name = do
(Entity _ challenge) <- runDB $ getBy404 $ UniqueName name (Entity _ challenge) <- runDB $ getBy404 $ UniqueName name
maybeUser <- maybeAuth maybeUser <- maybeAuth
challengeLayout False challenge (challengeHowTo challenge (idToBeShown challenge maybeUser)) let isIDSet = case maybeUser of
Just (Entity _ user) -> isJust $ userLocalId user
Nothing -> False
isSSHUploaded <- case maybeUser of
Just (Entity userId _) -> do
keys <- runDB $ selectList [PublicKeyUser ==. userId] []
return $ not (null keys)
Nothing -> return False
challengeLayout False challenge (challengeHowTo challenge (idToBeShown challenge maybeUser) isIDSet isSSHUploaded)
idToBeShown challenge maybeUser = idToBeShown challenge maybeUser =
case maybeUser of case maybeUser of
@ -82,7 +90,7 @@ idToBeShown challenge maybeUser =
defaultRepo challenge maybeUser = "ssh://gitolite@gonito.net/" ++ (idToBeShown challenge maybeUser) ++ "/" ++ (challengeName challenge) defaultRepo challenge maybeUser = "ssh://gitolite@gonito.net/" ++ (idToBeShown challenge maybeUser) ++ "/" ++ (challengeName challenge)
challengeHowTo challenge idToBeShown = $(widgetFile "challenge-how-to") challengeHowTo challenge idToBeShown isIDSet isSSHUploaded = $(widgetFile "challenge-how-to")
getChallengeSubmissionR :: Text -> Handler Html getChallengeSubmissionR :: Text -> Handler Html
getChallengeSubmissionR name = do getChallengeSubmissionR name = do

View File

@ -19,7 +19,15 @@
<h2>Get your repo <h2>Get your repo
<p>You need to upload your SSH public key (see <a href="@{YourAccountR}">your account</a>) if you want to have a repo hosted on Gonito.net, then: $if not isIDSet || not isSSHUploaded
<p>You need to
$if not isIDSet
\ set up your ID
$if not isSSHUploaded
\ and
$if not isSSHUploaded
\ upload your SSH public key
\ (see <a href="@{YourAccountR}">your account</a>) if you want to have a repo hosted on Gonito.net, then:
<pre> <pre>
git clone ssh://gitolite@gonito.net/#{idToBeShown}/#{challengeName challenge} git clone ssh://gitolite@gonito.net/#{idToBeShown}/#{challengeName challenge}