oef/templates/responses_show.html.tpl

113 lines
3.6 KiB
Smarty
Raw Normal View History

2019-11-18 17:04:07 +01:00
{{ define "content" }}
2019-12-13 12:55:11 +01:00
{{$isAdmin := .Claims|isAdmin}}
{{$isParticipant := .Claims|isParticipant}}
2019-11-18 17:04:07 +01:00
<div class="container">
2019-12-18 13:00:45 +01:00
{{if $isAdmin}}
2019-12-13 12:55:11 +01:00
{{template "breadcrumb" toSlice "Prove dei partecipanti" (all "Response") (.Data|string) "current"}}
2019-11-18 17:04:07 +01:00
{{template "show_header" dict "title" (.Data|string) "updatePath" (.Data.ID|update "Response") "deletePath" (.Data.ID|delete "Response")}}
2019-12-18 13:00:45 +01:00
{{end}}
{{if $isParticipant}}
2019-12-29 17:23:50 +01:00
{{if .Data.IsActive}}
2019-12-19 07:38:10 +01:00
{{$options := `{updateButtonTitle: "Vai alla gara!"}`}}
{{template "show_header" dict "options" ($options|yaml) "title" (.Data|string) "updatePath" (.Data.ID|update "Response")}}
2019-12-18 13:00:45 +01:00
{{end}}
2019-12-29 17:23:50 +01:00
{{end}}
2019-11-18 17:04:07 +01:00
2019-12-13 12:55:11 +01:00
<h2 class="karmen-relation-header">Informazioni generali</h2>
<dl class="row">
2019-12-18 13:00:45 +01:00
<dt class="col-sm-3">Periodo di attività</dt>
<dd class="col-sm-9">
{{if not (.Data.Contest.Date|zeroTime)}}
2019-12-29 17:23:50 +01:00
Giorno {{.Data.Contest.Date|prettyDate}} dalle ore {{.Data.Contest.StartTime|convertTime}} alle ore {{.Data.Contest.EndTime|convertTime}}
2020-02-03 12:52:56 +01:00
{{- if not .Data.IsActive -}}<strong> [Scaduta o non ancora attiva]</strong>{{- end -}}
2019-12-18 13:00:45 +01:00
{{else}}
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}}
2019-12-13 12:55:11 +01:00
{{if $isAdmin}}
2019-12-16 18:05:12 +01:00
<dt class="col-sm-3">Ordine delle domande</dt>
<dd class="col-sm-9">{{.Data.QuestionsOrder}}</dd>
2019-12-18 09:47:37 +01:00
<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>
2019-12-13 12:55:11 +01:00
{{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>
2019-12-18 13:00:45 +01:00
{{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 $isParticipant}}
<div class="row">
<div class="col-md-12">
<h2 class="karmen-relation-header">Suggerimenti</h2>
{{if .Data.IsActive}}
<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>
{{else}}
<p>
La gara è scaduta o non è ancora attiva.
</p>
{{end}}
</div>
</div>
{{end}}
2019-12-18 13:00:45 +01:00
{{if $isAdmin}}
2019-11-18 17:04:07 +01:00
<div class="row">
<div class="col-md-12">
{{$options := `
2019-12-13 12:55:11 +01:00
title: "Domande"
model: "Question"
icon: "fa fa-question-circle"
2019-11-18 17:04:07 +01:00
`}}
2019-12-13 12:55:11 +01:00
{{$noElements := "La prova del partecipante non contiene alcuna domanda."}}
{{template "relation_list" dict "options" ($options|yaml) "data" .Data.Questions "noElements" $noElements}}
2019-11-18 17:04:07 +01:00
</div>
</div>
2019-12-18 13:00:45 +01:00
{{end}}
2019-11-18 17:04:07 +01:00
</div>
{{ end }}