New layout for participant response

This commit is contained in:
Andrea Fazzi 2020-02-03 11:51:48 +01:00
parent 4e9ffa5c89
commit 8c7b476bdb
5 changed files with 38 additions and 22 deletions

2
dist/main.bundle.js vendored

File diff suppressed because one or more lines are too long

5
dist/styles.css vendored
View file

@ -4,6 +4,7 @@ html {
body {
padding-top: 60px;
position: relative;
}
div.login {
@ -103,7 +104,7 @@ ul.karmen-related-elements {
}
.sticky-offset {
top: 56px;
top: 60px;
}
.oef-anchor-selection:target {
@ -121,7 +122,7 @@ ul.karmen-related-elements {
div.oef-anchor {
display: block;
position: relative;
top: -56px;
top: -60px;
visibility: hidden;
}

View file

@ -4,6 +4,7 @@ html {
body {
padding-top: 60px;
position: relative;
}
div.login {
@ -103,7 +104,7 @@ ul.karmen-related-elements {
}
.sticky-offset {
top: 56px;
top: 60px;
}
.oef-anchor-selection:target {
@ -121,6 +122,6 @@ ul.karmen-related-elements {
div.oef-anchor {
display: block;
position: relative;
top: -56px;
top: -60px;
visibility: hidden;
}

View file

@ -23,7 +23,7 @@
<link rel="stylesheet" href="/styles.css" />
<title>Olimpiadi di Economia e Finanza - Piattaforma di gara</title>
</head>
<body>
<body data-spy="scroll">
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
{{- $homeURL := "" -}}
{{- if $isAdmin}}{{$homeURL = all "Contest"}}{{end}}

View file

@ -17,16 +17,16 @@
{{- end -}}
{{- $form := "form_add_update" -}}
<div class="row">
<div class="col-2 border-right">
<div class="col-2">
<div class="sticky-top sticky-offset">
<nav class="nav flex-column">
{{- if and $isParticipant .Data.TimeLeft}}
<h5 class="mt-1 badge badge-info sticky-top sticky-offset">Tempo rimanente <span id="timeleft">{{.Data.TimeLeft.Minutes|toInt}}</span> min</h5>
{{- end -}}
{{range $n, $question := .Data.Questions -}}
<a class="nav-link" href="#question_{{$n}}">Domanda {{$n|incr}}</a>
{{end -}}
</nav>
<div class="card">
<div class="card-header">Explorer delle domande</div>
<div id="navbar_questions" class="list-group">
{{range $n, $question := .Data.Questions -}}
<a class="list-group-item list-group-item-action" href="#question_{{$n}}">Domanda {{$n|incr}}</a>
{{end -}}
</div>
</div>
</div>
</div>
<div class="col">
@ -36,6 +36,7 @@
method="POST"
role="form"
id={{$form}}>
<div data-spy="scroll" data-target="#navbar_questions" data-offset="0">
{{range $id,$question := .Data.Questions -}}
<div class="oef-anchor" id="question_{{$id}}"></div>
<div class="oef-anchor-selection">
@ -57,15 +58,28 @@
</div>
<hr>
{{end}}
{{- if $isAdmin -}}
{{- $options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Response" } ` -}}
{{- template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update -}}
{{- else -}}
{{- $options := ` { saveTitle: "Invia le risposte", model: "Response" } ` -}}
{{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
{{end -}}
</div>
</form>
</div>
<div class="col-2">
<div class="sticky-top sticky-offset">
<div class="card">
<div class="card-header">
Informazioni sulla gara
</div>
<div class="card-body">
<dl>
<dt>Gara</dt><dd>{{.Data.Contest}}</dd>
<dt>Partecipante</dt><dd>{{.Data.Participant}}</dd>
<dt>Tempo rimanente</dt>{{if and $isParticipant .Data.TimeLeft}}<dd><span id="timeleft">{{.Data.TimeLeft.Minutes|toInt}}</span> minuti rimanenti</dd>{{else}}<dd>La gara è sempre attiva</dd>{{end}}
</dl>
<button type="submit" class="btn btn-primary" form="{{$form}}">Salva</button>
</div>
</div>
</div>
</div>
</div>
</div>
{{ end -}}