linkify git URLs, minor fixes on the main page

This commit is contained in:
Filip Gralinski 2016-01-10 20:32:11 +01:00
parent 51e1d584cd
commit bdbc55f450
5 changed files with 30 additions and 7 deletions

View File

@ -4,6 +4,8 @@ import Import
import Yesod.Form.Bootstrap3 (BootstrapFormLayout (..), renderBootstrap3,
withSmallInput)
import Handler.Shared
-- This is a handler function for the GET request method on the HomeR
-- resource pattern. All of your resource patterns are defined in
-- config/routes

View File

@ -39,6 +39,14 @@ arena = do
gitPath :: FilePath
gitPath = "/usr/bin/git"
browsableGitSite :: Text
browsableGitSite = "http://gonito.net/gitlist/"
browsableGitRepo :: Text -> Text
browsableGitRepo bareRepoName
| ".git" `isSuffixOf` bareRepoName = browsableGitSite ++ bareRepoName
| otherwise = browsableGitSite ++ bareRepoName ++ ".git"
runViewProgress :: (Channel -> Handler ()) -> Handler TypedContent
runViewProgress action = do
App {..} <- getYesod

View File

@ -47,6 +47,17 @@ getChallengeReadmeR name = do
showChallengeWidget challenge repo leaderboard = $(widgetFile "show-challenge")
where leaderboardWithRanks = zip [1..] leaderboard
maybeRepoLink = getRepoLink repo
getRepoLink :: Repo -> Maybe Text
getRepoLink repo
| sitePrefix `isPrefixOf` url = Just $ (browsableGitRepo bareRepoName) ++ "/" ++ (repoBranch repo)
| otherwise = Nothing
where sitePrefix = "git://gonito.net/" :: Text
sitePrefixLen = length sitePrefix
url = repoUrl repo
bareRepoName = drop sitePrefixLen url
getChallengeHowToR :: Text -> Handler Html
getChallengeHowToR name = do

View File

@ -1,12 +1,12 @@
<h1>Welcome to Gonito.net!
<p>Gonito (pronounced <i>ɡɔ̃ˈɲitɔ</i>) is a Kaggle-like platform for machine learning competitions (disclaimer: Gonito is neither affiliated with nor endorsed by <a href="https://www.kaggle.com">Kaggle</a>)
<p>Gonito (pronounced <i>ɡɔ̃ˈɲitɔ</i>) is a Kaggle<sup><u><a href="#disclaimer">*</a></u></sup>-like platform for machine learning competitions.
<p>What's so special about Gonito:
<ul>
<li>free & open-source (AGPL), you can use it your own, in your company, at your university, etc. (git repo: <tt>git://gonito.net/gonito</tt>)
<li>git-based (challenges and solutions are submitted only with git)
<li>free & open-source (AGPL), you can use it your own, in your company, at your university, etc. (git repo: <tt><a href="#{browsableGitRepo "gonito"}">git://gonito.net/gonito</a></tt>),
<li>git-based (challenges and solutions are submitted only with git).
$maybe _ <- maybeUser
$maybe _ <- maybeLocalId
@ -20,3 +20,5 @@ $nothing
<p>Gonito uses <a href="https://developer.mozilla.org/en-US/Persona">Persona</a> authentication system available in Mozilla Firefox. Other authentication systems are on the way, but for the time being you need to use Firefox.
<p>So, just click <a href="@{AuthR LoginR}">log in</a>, then "Sign in with Persona" button and Firefox will guide you!
<p><sup>*</sup>Disclaimer: Gonito is neither affiliated with nor endorsed by <a href="https://www.kaggle.com">Kaggle</a>.

View File

@ -1,7 +1,7 @@
<p>Repo:
<tt> #{repoUrl repo}
\ Branch:
<tt> #{repoBranch repo}
$maybe repoLink <- maybeRepoLink
<p> Repo: <tt><a href="#{repoLink}">#{repoUrl repo}</a></tt> Branch: <tt> #{repoBranch repo}</tt>
$nothing
<p> Repo: <tt>#{repoUrl repo}</tt> Branch: <tt> #{repoBranch repo}</tt>
<h2>Leaderboard