Show phases

This commit is contained in:
Filip Gralinski 2021-09-25 21:14:54 +02:00
parent d15264b904
commit 32d00b5ec3
2 changed files with 14 additions and 2 deletions

View File

@ -183,9 +183,9 @@ formatSubmittingEntityInLeaderboard entry =
Just teamEnt -> teamIdent $ entityVal teamEnt
Nothing -> formatSubmitter $ leaderboardUser entry
versionCell :: (a -> ((Int, Int, Int), (Maybe Import.Tag))) -> Table site a
versionCell fun = Table.text "ver." (formatVersion . fst . fun)
versionCell fun = Table.widget "ver." (
\e -> fragmentWithTag (formatVersion $ fst $ fun e) (snd $ fun e))
leaderboardTable :: Maybe UserId -> Text -> RepoScheme -> Repo -> [Entity Test] -> Table App (Int, LeaderboardEntry)
leaderboardTable mauthId challengeName repoScheme challengeRepo tests = mempty

View File

@ -50,6 +50,18 @@ $forall ((Entity _ v), (Entity sid s)) <- tagEnts
\ <span class="label #{tagClass $ submissionTagAccepted s}" onclick="t=$(this); $.get('/toggle-submission-tag/#{toPathPiece sid}', function(data){ if (!(data == 'BLOCKED')) {t.removeClass('#{allTagClasses}'); t.addClass(data);} }); ">#{tagName v}</span>
|]
fragmentWithTag :: Text.Blaze.ToMarkup a => a -> Maybe Import.Tag -> WidgetFor site ()
fragmentWithTag t mTag = [whamlet|
#{t}
$maybe tag <- mTag
$maybe color <- tagColor tag
\ <span style="background-color: #{color};" class="label label-default">#{tagName tag}</span>
$nothing
\ <span class="label label-default">#{tagName tag}</span>
|]
allTagClasses :: Text
allTagClasses = (tagClass $ Just True) <> " " <> (tagClass $ Just False) <> " " <> (tagClass $ Nothing);