forked from filipg/gonito
starred challenges
This commit is contained in:
parent
ae2d28ceff
commit
828ae71006
@ -92,7 +92,8 @@ addChallenge name publicRepoId privateRepoId chan = do
|
||||
challengeTitle=(T.pack $ title),
|
||||
challengeDescription=(T.pack $ description),
|
||||
challengeStamp=time,
|
||||
challengeImage=mImage }
|
||||
challengeImage=mImage,
|
||||
challengeStarred=Just False}
|
||||
updateTests challengeId chan
|
||||
return ()
|
||||
|
||||
|
@ -3,6 +3,7 @@ module Handler.Home where
|
||||
import Import
|
||||
|
||||
import Handler.Shared
|
||||
import Handler.ListChallenges
|
||||
|
||||
-- This is a handler function for the GET request method on the HomeR
|
||||
-- resource pattern. All of your resource patterns are defined in
|
||||
@ -15,6 +16,9 @@ getHomeR :: Handler Html
|
||||
getHomeR = do
|
||||
maybeUser <- maybeAuth
|
||||
master <- getYesod
|
||||
|
||||
starredChallenges <- runDB $ selectList [ChallengeStarred ==. Just True] [Asc ChallengeStarred, Desc ChallengeStamp]
|
||||
|
||||
let maybeLocalId = case maybeUser of
|
||||
Just user -> userLocalId $ entityVal user
|
||||
Nothing -> Nothing
|
||||
|
@ -4,7 +4,7 @@ import Import
|
||||
|
||||
getListChallengesR :: Handler Html
|
||||
getListChallengesR = do
|
||||
challenges <- runDB $ selectList [] [Desc ChallengeStamp]
|
||||
challenges <- runDB $ selectList [] [Asc ChallengeStarred, Desc ChallengeStamp]
|
||||
defaultLayout $ do
|
||||
setTitle "List challenges"
|
||||
$(widgetFile "list-challenges")
|
||||
|
@ -37,6 +37,7 @@ Challenge
|
||||
description Text
|
||||
stamp UTCTime default=now()
|
||||
image ByteString Maybe
|
||||
starred Bool Maybe
|
||||
Test
|
||||
challenge ChallengeId
|
||||
metric Metric
|
||||
|
@ -29,3 +29,9 @@
|
||||
<strong>How to log in?</strong> If you already have an account, just click <a href="@{AuthR LoginR}">log in</a>. Otherwise, please get in touch with the site admin#{contactEmailLabel master}.
|
||||
|
||||
<p class="text-muted text-right"><sup>*</sup>Disclaimer: Gonito is neither affiliated with nor endorsed by <a href="https://www.kaggle.com">Kaggle</a>.
|
||||
|
||||
$if not (null starredChallenges)
|
||||
<h2>Challenges
|
||||
^{listChallengesCore starredChallenges}
|
||||
|
||||
<p>… and <a href="@{ListChallengesR}">many more</a>!
|
||||
|
@ -1,6 +1,8 @@
|
||||
$forall (Entity challengeId challenge) <- challenges
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading"><a .challenge-link href="@{ShowChallengeR (challengeName challenge)}">#{challengeTitle challenge}</a>
|
||||
$if challengeStarred challenge == Just True
|
||||
\ <span class="glyphicon glyphicon-star-empty"></span>
|
||||
$if isJust (challengeImage challenge)
|
||||
<div class="panel-body" style="background-image:url(@{ChallengeImageR challengeId}); background-color:lightgrey; background-blend-mode:screen;background-size: 100%;">#{challengeDescription challenge}
|
||||
$else
|
||||
|
Loading…
Reference in New Issue
Block a user