oef/templates/contests.html.tpl
2020-01-27 15:22:11 +01:00

75 lines
1.7 KiB
Smarty

{{ define "content" }}
<div class="container">
{{$admin := (.Claims|isAdmin)}}
{{$options := ""}}
{{if $admin}}
{{$options = `
title: "Gare"
buttonTitle: "Crea nuova gara"
`}}
{{else}}
{{$options = `
title: "Gare a cui sei iscritto"
`}}
{{end}}
{{if $admin}}
{{template "read_all_header" dict "options" ($options | yaml) "lengthData" (len .Data) "modelPath" (create "Contest")}}
{{template "search_input" .Data}}
{{if not .}}
{{template "display_no_elements"}}
{{else}}
<div class="list-group" id="myUL">
{{range $element := .Data}}
<a class="list-group-item list-group-item-action" href={{$element.ID|show "Contest"}}>
<span class="fa fa-hourglass-start"></span>
{{$element|string}}
<div class="text-right">
{{$options := `noElements: "nessuna data"`}}
{{template "small" dict "options" ($options | yaml) "data" ($element.Date|prettyDate)}}
</div>
</a>
{{end}}
{{end}}
</div>
{{else}}
{{template "read_all_header" dict "options" ($options | yaml) "lengthData" (len .Data) "modelPath" (create "Contest")}}
{{template "search_input"}}
{{if not .}}
{{template "display_no_elements"}}
{{else}}
<div class="list-group" id="myUL">
{{range $element := .Data}}
<a class="list-group-item list-group-item-action" href={{$element.ID|show "Contest"}}>
<span class="fa fa-hourglass-start"></span>
{{$element|string}}
<div class="text-right">
{{$options := `noElements: "nessuna data"`}}
{{template "small" dict "options" ($options | yaml) "data" ($element.Date|prettyDate)}}
</div>
</a>
{{end}}
{{end}}
</div>
{{end}}
</div>
{{ end }}