oef/templates/layout/base.html.tpl
2023-11-26 19:31:46 +01:00

105 lines
4.8 KiB
Smarty

{{- define "base" -}}
{{- $isAdmin := .Claims|isAdmin -}}
{{- $isSubscriber := .Claims|isSubscriber -}}
{{- $isSchool := .Claims|isSchool -}}
{{- $isParticipant := .Claims|isParticipant -}}
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous">
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.css">
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/css/bootstrap-select.min.css">
<link rel="stylesheet" href="/styles.css" />
<title>Campionati Italiani di Economia e Finanza - Piattaforma di gara</title>
</head>
<body data-spy="scroll">
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
{{- $homeURL := "" -}}
{{- if $isAdmin}}{{$homeURL = all "Contest"}}{{end}}
{{- if $isSubscriber}}{{$homeURL = "#"}}{{end}}
{{- if $isParticipant}}{{$homeURL = "#"}}{{end}}
{{- if $isSchool}}{{$homeURL = "#"}}{{end -}}
<a class="navbar-brand" {{if $isAdmin}}href="{{$homeURL}}"{{end}}>
<span class="fa fa-landmark"></span>
CEF 2024
</a>
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse">
<ul class="navbar-nav mr-auto">
{{- if (.Claims|isAdmin) -}}
<a class="nav-item nav-link {{.Options|active "Contest"}}" href="{{all "Contest"}}">Gare</a>
<a class="nav-item nav-link {{.Options|active "Question"}}" href="{{all "Question"}}">Domande</a>
<a class="nav-item nav-link {{.Options|active "Answer"}}" href="{{all "Answer"}}">Risposte</a>
<a id="schools_navbar_link" class="nav-item nav-link {{.Options|active "School"}}" href="{{all "School"}}">Scuole</a>
<a id="participants_navbar_link" class="nav-item nav-link {{.Options|active "Participant"}}" href="{{all "Participant"}}">Partecipanti</a>
<a id="responses_navbar_link" class="nav-item nav-link {{.Options|active "Response"}}" href="{{all "Response"}}">Prove</a>
{{- end -}}
{{- if $isSchool -}}
<a id="school_navbar_link" class="nav-item nav-link {{.Options|active "School"}}" href="{{.Claims|modelId|show "School"}}">Scuola</a>
<a id="participant_navbar_link" class="nav-item nav-link {{.Options|active "Participant"}}" href="{{all "Participant"}}">Partecipanti</a>
{{- end -}}
</ul>
<ul class="nav navbar-nav navbar-right">
{{- if .Claims|isSubscriber -}}
<li><a id="logout" class="nav-link" href="/logout">Esci</a></li>
{{- else -}}
<li><a id="logout" class="nav-link" href="/logout">Disconnetti {{.Claims|username}}</a></li>
{{- end -}}
</ul>
</div><!--/.nav-collapse -->
</nav>
<div class="base-template">
{{ template "content" . }}
</div>
<div class="modal fade" id="karmen-modal-remove" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Richiesta di conferma eliminazione</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Stai per eliminare l'elemento. Ne sei sicuro?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Annulla</button>
<button type="button" class="btn btn-primary" id="karmen-modal-btn-confirm">Conferma</button>
</div>
</div>
</div>
</div>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous">
</script>
<script
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous">
</script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>
<script src="/main.bundle.js"></script>
</body>
</html>
{{end}}