Improve showing a single submission
This commit is contained in:
parent
4f6ba50156
commit
ff2112a745
@ -4,6 +4,7 @@ import Import
|
||||
|
||||
import Handler.SubmissionView
|
||||
import Handler.Shared
|
||||
import Handler.TagUtils
|
||||
|
||||
import Database.Persist.Sql
|
||||
|
||||
@ -72,6 +73,9 @@ postQueryFormR = do
|
||||
getQueryResultsR :: Text -> Handler Html
|
||||
getQueryResultsR = processQuery
|
||||
|
||||
isFullQuery :: Text -> Bool
|
||||
isFullQuery query = length query == 40
|
||||
|
||||
processQuery :: Text -> Handler Html
|
||||
processQuery query = do
|
||||
submissions <- findSubmissions query
|
||||
|
@ -3,6 +3,7 @@ module Handler.SubmissionView where
|
||||
import Import
|
||||
import Handler.Shared
|
||||
import PersistSHA1
|
||||
import Handler.TagUtils
|
||||
|
||||
import Data.Text as T(pack)
|
||||
|
||||
@ -13,7 +14,8 @@ data FullSubmissionInfo = FullSubmissionInfo {
|
||||
fsiRepo :: Repo,
|
||||
fsiChallenge :: Challenge,
|
||||
fsiChallengeRepo :: Repo,
|
||||
fsiScheme :: RepoScheme}
|
||||
fsiScheme :: RepoScheme,
|
||||
fsiTags :: [(Entity Tag, Entity SubmissionTag)] }
|
||||
|
||||
getFullInfo :: Entity Submission -> Handler FullSubmissionInfo
|
||||
getFullInfo (Entity submissionId submission) = do
|
||||
@ -22,6 +24,8 @@ getFullInfo (Entity submissionId submission) = do
|
||||
challenge <- runDB $ get404 $ submissionChallenge submission
|
||||
challengeRepo <- runDB $ get404 $ challengePublicRepo challenge
|
||||
|
||||
tags <- runDB $ getTags submissionId
|
||||
|
||||
app <- getYesod
|
||||
let scheme = appRepoScheme $ appSettings app
|
||||
|
||||
@ -32,7 +36,8 @@ getFullInfo (Entity submissionId submission) = do
|
||||
fsiRepo = repo,
|
||||
fsiChallenge = challenge,
|
||||
fsiChallengeRepo = challengeRepo,
|
||||
fsiScheme = scheme}
|
||||
fsiScheme = scheme,
|
||||
fsiTags = tags }
|
||||
|
||||
|
||||
queryResult submission = do
|
||||
|
@ -1,7 +1,9 @@
|
||||
<div .subm-commit>#{commitSha1AsText}
|
||||
<div .subm-description>#{submissionDescription $ fsiSubmission submission}
|
||||
<div .subm-description>^{fragmentWithTags (submissionDescription $ fsiSubmission submission) (map fst $ fsiTags submission)}
|
||||
<p> </p>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>challenge
|
||||
<dd><a href="@{ShowChallengeR $ challengeName $ fsiChallenge submission}">#{challengeTitle $ fsiChallenge submission}</a>
|
||||
<dt>submitter
|
||||
<dd>#{submitter}
|
||||
<dt>submitted
|
||||
|
@ -1,3 +1,4 @@
|
||||
$if not (isFullQuery query) || null submissions
|
||||
<h2>Query results
|
||||
|
||||
$if null submissions
|
||||
|
Loading…
Reference in New Issue
Block a user