diff --git a/Handler/Tables.hs b/Handler/Tables.hs index a905dca..03309bf 100644 --- a/Handler/Tables.hs +++ b/Handler/Tables.hs @@ -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 diff --git a/Handler/TagUtils.hs b/Handler/TagUtils.hs index 80cddb2..4bfaa5b 100644 --- a/Handler/TagUtils.hs +++ b/Handler/TagUtils.hs @@ -50,6 +50,18 @@ $forall ((Entity _ v), (Entity sid s)) <- tagEnts \ #{tagName v} |] + +fragmentWithTag :: Text.Blaze.ToMarkup a => a -> Maybe Import.Tag -> WidgetFor site () +fragmentWithTag t mTag = [whamlet| + #{t} + $maybe tag <- mTag + $maybe color <- tagColor tag + \ #{tagName tag} + $nothing + \ #{tagName tag} +|] + + allTagClasses :: Text allTagClasses = (tagClass $ Just True) <> " " <> (tagClass $ Just False) <> " " <> (tagClass $ Nothing);