From 70d36ac41b7b16b2a77579f44ecaf6d8f6b4fe37 Mon Sep 17 00:00:00 2001 From: Andrea Fazzi Date: Fri, 14 Feb 2020 13:54:13 +0100 Subject: [PATCH] Better ui for response view as participant --- renderer/funcmap.go | 3 ++- templates/responses_show.html.tpl | 34 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/renderer/funcmap.go b/renderer/funcmap.go index ee907b37..bc136b4c 100644 --- a/renderer/funcmap.go +++ b/renderer/funcmap.go @@ -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 { diff --git a/templates/responses_show.html.tpl b/templates/responses_show.html.tpl index 985de506..aba19ade 100644 --- a/templates/responses_show.html.tpl +++ b/templates/responses_show.html.tpl @@ -28,6 +28,16 @@ La gara รจ sempre attiva. {{end}} + {{if not (.Data.Contest.Date|zeroTime)}} +
Prima visualizzazione
+
+ {{if not (.Data.StartTime|zeroTime)}} + Giorno {{.Data.StartTime|prettyDate}} alle ore {{.Data.StartTime|convertTime}} + {{else}} + Il partecipante non ha ancora visualizzato la prova. + {{end}} +
+ {{end}} {{if $isAdmin}}
Ordine delle domande
{{.Data.QuestionsOrder}}
@@ -50,6 +60,30 @@ {{end}} + {{if .Data.Contest.Description}} +

Descrizione della prova

+
+
+ {{.Data.Contest.Description|markdown|html}} +
+
+ {{end}} + + {{if or $isParticipant}} +
+
+

Suggerimenti

+

+ Per iniziare o riprendere la gara clicca sul pulsante a destra. + + + Vai alla gara! + +

+
+
+ {{end}} + {{if $isAdmin}}