oef/templates/responses_show.html.tpl
2019-12-29 17:23:50 +01:00

72 lines
2.5 KiB
Smarty

{{ define "content" }}
{{$isAdmin := .Claims|isAdmin}}
{{$isParticipant := .Claims|isParticipant}}
<div class="container">
{{if $isAdmin}}
{{template "breadcrumb" toSlice "Prove dei partecipanti" (all "Response") (.Data|string) "current"}}
{{template "show_header" dict "title" (.Data|string) "updatePath" (.Data.ID|update "Response") "deletePath" (.Data.ID|delete "Response")}}
{{end}}
{{if $isParticipant}}
{{if .Data.IsActive}}
{{$options := `{updateButtonTitle: "Vai alla gara!"}`}}
{{template "show_header" dict "options" ($options|yaml) "title" (.Data|string) "updatePath" (.Data.ID|update "Response")}}
{{end}}
{{end}}
<h2 class="karmen-relation-header">Informazioni generali</h2>
<dl class="row">
<dt class="col-sm-3">Periodo di attività</dt>
<dd class="col-sm-9">
{{if not (.Data.Contest.Date|zeroTime)}}
Giorno {{.Data.Contest.Date|prettyDate}} dalle ore {{.Data.Contest.StartTime|convertTime}} alle ore {{.Data.Contest.EndTime|convertTime}}
{{- if not .Data.IsActive -}}<strong> [Scaduta]</strong>{{- end -}}
{{else}}
La gara è sempre attiva.
{{end}}
</dd>
{{if $isAdmin}}
<dt class="col-sm-3">Ordine delle domande</dt>
<dd class="col-sm-9">{{.Data.QuestionsOrder}}</dd>
<dt class="col-sm-3">Risposte fornite (IDs)</dt>
{{if .Data.AnswersIDs}}
<dd class="col-sm-9">{{printf "[%v]" .Data.AnswersIDs}}</dd>
{{else}}
<dd class="col-sm-9">nessuna risposta fornita</dd>
{{end}}
<dt class="col-sm-3">Punteggio</dt>
<dd class="col-sm-9">{{.Data.Score}}</dd>
{{if $creatorUser:=.Data.CreatedBy}}
<dt class="col-sm-3">Creato da</dt>
<dd class="col-sm-9">{{$creatorUser.Username}}[{{$creatorUser.Role}}] {{$.Data.CreatedAt|prettyDateTime}} da {{.Data.CreatorIP}}</dd>
{{end}}
{{if $updaterUser:=.Data.UpdatedBy}}
<dt class="col-sm-3">Modificato da</dt>
<dd class="col-sm-9">{{$updaterUser.Username}}[{{$updaterUser.Role}}] {{$.Data.UpdatedAt|prettyDateTime}} da {{.Data.UpdaterIP}}</dd>
{{end}}
{{end}}
</dl>
{{if $isAdmin}}
<div class="row">
<div class="col-md-12">
{{$options := `
title: "Domande"
model: "Question"
icon: "fa fa-question-circle"
`}}
{{$noElements := "La prova del partecipante non contiene alcuna domanda."}}
{{template "relation_list" dict "options" ($options|yaml) "data" .Data.Questions "noElements" $noElements}}
</div>
</div>
{{end}}
</div>
{{ end }}