Better ui for response view as participant

This commit is contained in:
Andrea Fazzi 2020-02-14 13:54:13 +01:00
parent f0b31bc0a1
commit 70d36ac41b
2 changed files with 36 additions and 1 deletions

View file

@ -85,7 +85,8 @@ func genCaptcha() string {
}
func markdown(text string) string {
unsafe := blackfriday.Run([]byte(text))
sanitized := strings.Replace(text, "\r\n", "\n", -1)
unsafe := blackfriday.Run([]byte(sanitized))
return string(bluemonday.UGCPolicy().SanitizeBytes(unsafe))
}
func version() string {

View file

@ -28,6 +28,16 @@
La gara è sempre attiva.
{{end}}
</dd>
{{if not (.Data.Contest.Date|zeroTime)}}
<dt class="col-sm-3">Prima visualizzazione</dt>
<dd class="col-sm-9">
{{if not (.Data.StartTime|zeroTime)}}
Giorno {{.Data.StartTime|prettyDate}} alle ore {{.Data.StartTime|convertTime}}
{{else}}
Il partecipante non ha ancora visualizzato la prova.
{{end}}
</dd>
{{end}}
{{if $isAdmin}}
<dt class="col-sm-3">Ordine delle domande</dt>
<dd class="col-sm-9">{{.Data.QuestionsOrder}}</dd>
@ -50,6 +60,30 @@
{{end}}
</dl>
{{if .Data.Contest.Description}}
<h2 class="karmen-relation-header">Descrizione della prova</h2>
<div class="row">
<div class="col-md-12">
{{.Data.Contest.Description|markdown|html}}
</div>
</div>
{{end}}
{{if or $isParticipant}}
<div class="row">
<div class="col-md-12">
<h2 class="karmen-relation-header">Suggerimenti</h2>
<p>
Per iniziare o riprendere la gara clicca sul pulsante a destra.
<a id="new_participant_subscribe" href="{{.Data.ID | update "Response"}}" class="float-right btn btn-primary btn-sm">
<span class="fa fa-edit" aria-hidden="true"></span>
Vai alla gara!
</a>
</p>
</div>
</div>
{{end}}
{{if $isAdmin}}
<div class="row">
<div class="col-md-12">