Working on contest description

This commit is contained in:
Andrea Fazzi 2020-02-05 14:12:08 +01:00
parent 7f0819fc81
commit 4965ccf0f9
5 changed files with 48 additions and 4 deletions

View file

@ -19,8 +19,9 @@ import (
type Contest struct {
gorm.Model
Name string
Category string
Name string
Category string
Description string
Date time.Time
StartTime time.Time

View file

@ -22,6 +22,9 @@
{{$options := ` { name: "Name",id: "contest_name",label: "Nome della gara",placeholder: "Inserire il nome della gara",type: "text",required: "true"} `}}
{{template "input" dict "options" ($options|yaml) "value" (.Data|field "Name") "update" $update}}
{{$options := ` { name: "Description",id: "contest_description",label: "Descrizione della gara",placeholder: "Inserire una breve descrizione della gara",type: "text",required: "true"} `}}
{{template "textarea" dict "options" ($options|yaml) "value" (.Data|field "Description") "update" $update}}
<div class="form-row">
<div class="col">
{{$options := ` { name: "Date",id: "contest_date",label: "La gara si svolgerà il giorno",type: "date" } `}}

View file

@ -24,6 +24,13 @@
</dl>
<div class="row">
<div class="col-md-12">
<h2 class="karmen-relation-header">Descrizione</h2>
{{.Data.Description}}
</div>
</div>
<div class="row">
<div class="col-md-12">

View file

@ -0,0 +1,14 @@
{{define "textarea"}}
<div class="{{if .options.formClass}}{{.options.formClass}}{{else}}form-group{{end}}">
<label class="control-label" for="{{.options.id}}">{{.options.label}}</label>
<textarea
rows="5"
name="{{.options.name}}"
class="{{if .options.inputClass}}{{.options.inputClass}}{{else}}form-control{{end}}"
id="{{.options.id}}"
placeholder="{{.options.placeholder}}" {{if .options.otherAttrs}}{{.options.otherAttrs|attr}}{{end}} {{if .options.required}}required{{end}}>
{{- if .update -}}{{- .value -}}{{- end -}}
</textarea>
{{if .options.help}}<small class="form-text text-muted">{{.options.help}}</small>{{end}}
</div>
{{end}}

View file

@ -86,8 +86,27 @@
</div>
</div>
{{end}}
{{if or $isAdmin $isParticipant}}
{{if $isParticipant}}
<div class="row">
<div class="col-md-12">
<h2 class="karmen-relation-header">Prove del partecipante</h2>
{{range $response := .Data.Responses}}
<div class="card">
<div class="card-header">
{{$response}}
</div>
<div class="card-body">
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="{{$response.ID|show "Response"|html}}" class="btn btn-primary">Apri la prova</a>
</div>
</div>
{{end}}
</div>
</div>
{{end}}
{{if $isAdmin}}
<div class="row">
<div class="col-md-12">