Merge branch 'master' of ssh://git.andreafazzi.eu:10022/andrea/oef

This commit is contained in:
Andrea Fazzi 2020-02-03 11:55:26 +01:00
commit 233b3248dc
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 { body {
padding-top: 60px; padding-top: 60px;
position: relative;
} }
div.login { div.login {
@ -103,7 +104,7 @@ ul.karmen-related-elements {
} }
.sticky-offset { .sticky-offset {
top: 56px; top: 60px;
} }
.oef-anchor-selection:target { .oef-anchor-selection:target {
@ -121,7 +122,7 @@ ul.karmen-related-elements {
div.oef-anchor { div.oef-anchor {
display: block; display: block;
position: relative; position: relative;
top: -56px; top: -60px;
visibility: hidden; visibility: hidden;
} }

View file

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

View file

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

View file

@ -17,16 +17,16 @@
{{- end -}} {{- end -}}
{{- $form := "form_add_update" -}} {{- $form := "form_add_update" -}}
<div class="row"> <div class="row">
<div class="col-2 border-right"> <div class="col-2">
<div class="sticky-top sticky-offset"> <div class="sticky-top sticky-offset">
<nav class="nav flex-column"> <div class="card">
{{- if and $isParticipant .Data.TimeLeft}} <div class="card-header">Explorer delle domande</div>
<h5 class="mt-1 badge badge-info sticky-top sticky-offset">Tempo rimanente <span id="timeleft">{{.Data.TimeLeft.Minutes|toInt}}</span> min</h5> <div id="navbar_questions" class="list-group">
{{- end -}} {{range $n, $question := .Data.Questions -}}
{{range $n, $question := .Data.Questions -}} <a class="list-group-item list-group-item-action" href="#question_{{$n}}">Domanda {{$n|incr}}</a>
<a class="nav-link" href="#question_{{$n}}">Domanda {{$n|incr}}</a> {{end -}}
{{end -}} </div>
</nav> </div>
</div> </div>
</div> </div>
<div class="col"> <div class="col">
@ -36,6 +36,7 @@
method="POST" method="POST"
role="form" role="form"
id={{$form}}> id={{$form}}>
<div data-spy="scroll" data-target="#navbar_questions" data-offset="0">
{{range $id,$question := .Data.Questions -}} {{range $id,$question := .Data.Questions -}}
<div class="oef-anchor" id="question_{{$id}}"></div> <div class="oef-anchor" id="question_{{$id}}"></div>
<div class="oef-anchor-selection"> <div class="oef-anchor-selection">
@ -57,15 +58,28 @@
</div> </div>
<hr> <hr>
{{end}} {{end}}
{{- if $isAdmin -}} </div>
{{- $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 -}}
</form> </form>
</div> </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>
</div> </div>
{{ end -}} {{ end -}}