Sfoglia il codice sorgente

Working on add_update form template

Andrea Fazzi 5 anni fa
parent
commit
f319df7be8

+ 20 - 0
orm/activity.go

@@ -1,7 +1,9 @@
 package orm
 package orm
 
 
 import (
 import (
+	"fmt"
 	"net/http"
 	"net/http"
+	"strconv"
 
 
 	"github.com/jinzhu/gorm"
 	"github.com/jinzhu/gorm"
 	"gogs.carducci-dante.gov.it/karmen/core/renderer"
 	"gogs.carducci-dante.gov.it/karmen/core/renderer"
@@ -56,6 +58,24 @@ type ActivityForAdd struct {
 
 
 func (a *Activity) GetID() uint { return a.ID }
 func (a *Activity) GetID() uint { return a.ID }
 
 
+func (a *Activity) String() string {
+	var result string
+
+	result = a.Subject.Name
+
+	if a.Class != nil {
+		result += " " + a.Class.Name
+	}
+
+	if a.SupplyTeacher != nil {
+		result += fmt.Sprintf(" (S %s)", a.SupplyTeacher.String())
+	}
+
+	result += " " + strconv.Itoa(a.Hours) + "h"
+
+	return result
+}
+
 func GetActivity(args map[string]string) (interface{}, error) {
 func GetActivity(args map[string]string) (interface{}, error) {
 	var activity Activity
 	var activity Activity
 	if err := DB().First(&activity, args["id"]).Error; err != nil {
 	if err := DB().First(&activity, args["id"]).Error; err != nil {

+ 2 - 1
orm/class.go

@@ -49,7 +49,8 @@ type ClassForAdd struct {
 	AllTeachers []*Teacher
 	AllTeachers []*Teacher
 }
 }
 
 
-func (t *Class) GetID() uint { return t.ID }
+func (t *Class) GetID() uint    { return t.ID }
+func (c *Class) String() string { return c.Name }
 
 
 func GetClass(args map[string]string) (interface{}, error) {
 func GetClass(args map[string]string) (interface{}, error) {
 	var class Class
 	var class Class

+ 2 - 1
orm/group.go

@@ -34,7 +34,8 @@ type GroupForUpdate struct {
 	SelectedTeacher map[uint]string
 	SelectedTeacher map[uint]string
 }
 }
 
 
-func (g *Group) GetID() uint { return g.ID }
+func (g *Group) GetID() uint    { return g.ID }
+func (g *Group) String() string { return g.Name }
 
 
 func GetGroups(args map[string]string) (interface{}, error) {
 func GetGroups(args map[string]string) (interface{}, error) {
 	return GetGroupsAll(args)
 	return GetGroupsAll(args)

+ 2 - 1
orm/student.go

@@ -45,7 +45,8 @@ WHERE student_id=?
 `
 `
 )
 )
 
 
-func (s *Student) GetID() uint { return s.ID }
+func (s *Student) GetID() uint    { return s.ID }
+func (s *Student) String() string { return s.CompleteName() }
 
 
 func GetStudent(args map[string]string) (interface{}, error) {
 func GetStudent(args map[string]string) (interface{}, error) {
 	var student Student
 	var student Student

+ 2 - 1
orm/subject.go

@@ -37,7 +37,8 @@ type SubjectForAdd struct {
 	AllDepartments []*Department
 	AllDepartments []*Department
 }
 }
 
 
-func (s *Subject) GetID() uint { return s.ID }
+func (s *Subject) GetID() uint    { return s.ID }
+func (s *Subject) String() string { return s.Name }
 
 
 func GetSubject(args map[string]string) (interface{}, error) {
 func GetSubject(args map[string]string) (interface{}, error) {
 	var subject Subject
 	var subject Subject

+ 30 - 1
renderer/funcmap.go

@@ -30,9 +30,34 @@ var (
 		"string":      callString,
 		"string":      callString,
 		"incr":        incr,
 		"incr":        incr,
 		"mod2":        mod2,
 		"mod2":        mod2,
+		"toLower":     toLower,
+		"anchor":      anchor,
+		"html":        html,
+		"field":       field,
 	}
 	}
 )
 )
 
 
+func field(name string, value interface{}) interface{} {
+	if value != nil {
+		s := reflect.ValueOf(value).Elem()
+		return s.FieldByName(name).Interface()
+	} else {
+		return nil
+	}
+}
+
+func html(content string) template.HTML {
+	return template.HTML(content)
+}
+
+func anchor(text, url string) template.HTML {
+	return template.HTML(fmt.Sprintf("<a href=\"%s\">%s</a>", url, text))
+}
+
+func toLower(text string) string {
+	return strings.ToLower(text)
+}
+
 func mod2(value int) bool {
 func mod2(value int) bool {
 	return value%2 == 0
 	return value%2 == 0
 }
 }
@@ -42,7 +67,11 @@ func incr(value int) int {
 }
 }
 
 
 func callString(value interface{}) string {
 func callString(value interface{}) string {
-	return reflect.ValueOf(value).MethodByName("String").Interface().(func() string)()
+	if value != nil {
+		return reflect.ValueOf(value).MethodByName("String").Interface().(func() string)()
+	} else {
+		return ""
+	}
 }
 }
 
 
 func isSlice(value interface{}) bool {
 func isSlice(value interface{}) bool {

+ 13 - 0
templates/layout/add_update_header.html.tpl

@@ -0,0 +1,13 @@
+{{define "add_update_header"}}
+<div class="karmen-info-header">
+  <div class="row">
+    <div class="col-md-12">
+      {{if .update}}
+      <h1>{{.updateTitle}}</h1>
+      {{else}}
+      <h1>{{.addTitle}}</h1>
+      {{end}}
+    </div>
+  </div>
+</div>
+{{end}}

+ 10 - 0
templates/layout/input.html.tpl

@@ -0,0 +1,10 @@
+{{define "input"}}
+<div class="form-group">
+  <label class="control-label" for="{{.options.id}}">{{.options.label}}</label>
+  <input type="{{.options.type}}"
+         name="{{.options.name}}"
+         class="form-control"
+         id="{{.options.id}}"
+         placeholder="{{.options.placeholder}}" {{if .update}} value="{{.value}}" {{end}} {{.options.required}}>
+</div>
+{{end}}

+ 8 - 11
templates/layout/relation_list.html.tpl

@@ -1,18 +1,15 @@
 {{define "relation_list"}}
 {{define "relation_list"}}
-<h2 class="karmen-relation-header">{{.options.title}}</h2>
-{{if .Data.Subjects}}
-<div class="list-group" id="materie_list_group">
-  {{range $subject := .Data.Subjects}}
-  <a href="{{$subject.ID | show "Subject"}}" class="list-group-item list-group-item-action">
-    <span class="fa fa-book"></span>
-    {{$subject.Name}}
+<h2 class="karmen-relation-header">{{$title := .options.title}}{{if .title}}{{$title = .title}}{{end}}{{$title}}</h2>
+{{if gt (len .data) 0}}
+<div class="list-group" id="{{$title|toLower}}_list_group">
+  {{range $el := .data}}
+  <a href="{{$el.ID | show $.options.model}}" class="list-group-item list-group-item-action">
+    <span class="{{$.options.icon}}"></span>
+    {{$el | string}}
     {{end}}
     {{end}}
   </a>
   </a>
 </div>
 </div>
 {{else}}
 {{else}}
-<p>Al docente non è associata alcuna attività
-  didattica. Clicca <a href="{{modelPath "Activity" "create" 0}}">qui</a> per
-  creare una nuova attività didattica da associare al docente.</p>
+<p>{{.noElements}}</p>
 {{end}}
 {{end}}
-</div>
 {{end}}
 {{end}}

+ 54 - 78
templates/teachers_add_update.html.tpl

@@ -2,101 +2,77 @@
 
 
 <div class="container">
 <div class="container">
 
 
-  {{if .Options.Get "update"}}
-  <nav aria-label="breadcrumb">
-    <ol class="breadcrumb">
-      <li class="breadcrumb-item"><a href="/teachers?{{query "tpl_layout" "base" "tpl_content" "teachers"}}">Docenti</a></li>
-      <li class="breadcrumb-item"><a href="/teachers/{{.Data.ID}}?{{query "tpl_layout" "base" "tpl_content" "teachers_show"}}">{{.Data.Name}} {{.Data.Surname}}</a></li>
-      <li class="breadcrumb-item active"><a href="#">Aggiorna</a></li>
-    </ol>
-  </nav>
-  {{else}}
-  <nav aria-label="breadcrumb">
-    <ol class="breadcrumb">
-      <li class="breadcrumb-item"><a href="/teachers/?{{query "tpl_layout" "base" "tpl_content" "teachers"}}">Docenti</a></li>
-      <li class="breadcrumb-item active"><a href="#">Aggiungi</a></li>
-    </ol>
-  </nav>
-  {{end}}
-
-  {{if .Options.Get "update"}}
-  <h1 class="karmen-info-header">Aggiorna il docente "{{.Data.Name}} {{.Data.Surname}}"</h1>
+  {{$update := .Options.Get "update"}}
+  
+  {{if $update}}
+  {{template "breadcrumb" toSlice "Docenti" (all "Teacher") (.Data|string) (.Data.ID|show "Teacher") "Aggiorna" "current"}}
   {{else}}
   {{else}}
-  <h1 class="karmen-info-header">Crea un nuovo docente</h1>
+  {{template "breadcrumb" toSlice "Docenti" (all "Teacher") "Aggiungi" "current"}}
   {{end}}
   {{end}}
+  
+  {{template "add_update_header" dict "update" $update "addTitle" "Crea nuovo docente" "updateTitle" (printf "Aggiorna docente %s" (.Data|string))}}
 
 
-  {{if .Options.Get "update"}}
+  {{if $update}}
   <form class="needs-validation" action="/teachers/{{.Data.ID}}/update" method="POST" role="form">
   <form class="needs-validation" action="/teachers/{{.Data.ID}}/update" method="POST" role="form">
   {{else}}
   {{else}}
   <form action="/teachers/create/" method="POST" role="form" class="needs-validation">
   <form action="/teachers/create/" method="POST" role="form" class="needs-validation">
-  {{end}}  
-    <div class="form-group">
-      <label class="control-label" for="teacher_name">Nome</label>
-      <input type="text" name="Name" class="form-control" id="teacher_name" placeholder="Nome" {{if .Options.Get "update"}} value="{{.Data.Name}}" {{end}} required>
-    </div>
-    
-    <div class="form-group">
-      <label class="control-label" for="teacher_surname">Cognome</label>
-      <input type="text" name="Surname" class="form-control" id="teacher_surname" placeholder="Cognome" {{if .Options.Get "update"}} value="{{.Data.Surname}}" {{end}} required>
-    </div>
+  {{end}}
 
 
-    <div class="form-group">
-      <label class="control-label has-feedback" for="teacher_hours">Numero di ore</label>
-      <input type="number" name="Hours" class="form-control" id="teacher_hours" {{if .Options.Get "update"}}value="{{.Data.Hours}}"{{else}}value="18"{{end}} required>
-    </div>
+  {{$options := ` { name: "Name",id: "teacher_name",label: "Nome",placeholder: "Nome",type: "text" } `}}
+  {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Name") "update" $update}}
 
 
-    <div class="form-row">
-      
-      <div class="col">
-	<input type="email" name="AltEmail" class="form-control" id="teacher_altemail" placeholder="Email alternativa" {{if .Options.Get "update"}} value="{{.Data.AltEmail}}" {{end}}>
-      </div>
-      <div class="col">
-	<div class="form-check">
-	  <input type="checkbox" name="Regenerate" class="form-check-input" id="teacher_regenerate" {{if .Options.Get "update"}}{{if .Data.Regenerate}}checked{{end}}{{end}}>
-	  <label class="form-check-label has-feedback" for="teacher_regenerate">Rigenerare/inviare le credenziali</label>
-	</div>
-      </div>
-      <div class="col">
-	<div class="form-check">
-	  <input type="checkbox" name="Exclude" class="form-check-input" id="teacher_exclude" {{if .Options.Get "update"}}{{if .Data.Exclude}}checked{{end}}{{end}}>
-	  <label class="form-check-label has-feedback" for="teacher_exclude">Escludere dalle utenze</label>
-	</div>
-      </div>
-      <div class="col">
-	<div class="form-check">
-	  <input type="checkbox" name="NotInvited" class="form-check-input" id="teacher_not_invited" {{if .Options.Get "update"}}{{if .Data.NotInvited}}checked{{end}}{{end}}>
-	  <label class="form-check-label has-feedback" for="teacher_not_invited">Escludere dagli inviti</label>
-	</div>
-      </div>
+  {{$options := ` { name: "Surname",id: "teacher_surname",label: "Cognome",placeholder: "Cognome",type: "text" } `}}
+  {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Surname") "update" $update}}
 
 
+  {{$options := ` { name: "Hours",id: "teacher_hours",label: "Numero di ore",placeholder: "",type: "number" } `}}
+  {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Hours") "update" $update}}
 
 
-    </div>
+  {{$options := ` { name: "AltEmail",id: "teacher_altemail",label: "Email alternativa",placeholder: "Inserire indirizzo email",type: "email" } `}}
+  {{template "input" dict "options" ($options|yaml) "value" (.Data|field "AltEmail") "update" $update}}
 
 
-    <div class="form-row">
-      <div class="col">
-	<label class="control-label" for="teacher_date_from">In servizio dal</label>
-	<input type="date" name="DateFrom" class="form-control" id="teacher_date_from" {{if .Options.Get "update"}} value="{{convertDate .Data.DateFrom}}" {{end}}>
+  <div class="form-row">
+    <div class="col">
+      <div class="form-check form-check-inline">
+	<input type="checkbox" name="Regenerate" class="form-check-input" id="teacher_regenerate" {{if .Options.Get "update"}}{{if .Data.Regenerate}}checked{{end}}{{end}}>
+	<label class="form-check-label has-feedback" for="teacher_regenerate">Rigenerare/inviare le credenziali</label>
+      </div>
+      <div class="form-check form-check-inline">
+	<input type="checkbox" name="Exclude" class="form-check-input" id="teacher_exclude" {{if .Options.Get "update"}}{{if .Data.Exclude}}checked{{end}}{{end}}>
+	<label class="form-check-label has-feedback" for="teacher_exclude">Escludere dalle utenze</label>
       </div>
       </div>
-      <div class="col">
-	<label class="control-label" for="teacher_date_to">In servizio fino al</label>
-	<input type="date" name="DateTo" class="form-control" id="teacher_date_to" {{if .Options.Get "update"}} value="{{convertDate .Data.DateTo}}" {{end}}>
+      <div class="form-check form-check-inline">
+        <input type="checkbox" name="NotInvited" class="form-check-input" id="teacher_not_invited" {{if .Options.Get "update"}}{{if .Data.NotInvited}}checked{{end}}{{end}}>
+	<label class="form-check-label has-feedback" for="teacher_not_invited">Escludere dagli inviti</label>
       </div>
       </div>
+      
     </div>
     </div>
+  </div>
 
 
-    <div class="form-group">
-      <label class="control-label has-feedback" for="teacher_ldapdnfmt">Stringa DN per LDAP</label>
-      <input type="text" name="LdapDNFmt" class="form-control" id="teacher_ldapdnfmt" placeholder="cn=%s %s,ou=People,dc=foo,dc=org" {{if .Options.Get "update"}}value="{{.Data.LdapDNFmt}}"{{end}}>
+  <div class="form-row">
+    <div class="col">
+      <label class="control-label" for="teacher_date_from">In servizio dal</label>
+      <input type="date" name="DateFrom" class="form-control" id="teacher_date_from" {{if .Options.Get "update"}} value="{{convertDate .Data.DateFrom}}" {{end}}>
     </div>
     </div>
-
-    <div class="form-group">
-      <button type="submit" class="btn btn-primary">Salva</button>
-      {{if .Options.Get "update"}}
-      <a href="/teachers/{{.Data.ID}}?{{query "tpl_layout" "base" "tpl_content" "teachers_show"}}" class="btn btn-default">Annulla</a>
-      {{else}}
-      <a href="/teachers/?{{query "tpl_layout" "base" "tpl_content" "teachers"}}" class="btn btn-default">Annulla</a>
-      {{end}}
+    <div class="col">
+      <label class="control-label" for="teacher_date_to">In servizio fino al</label>
+      <input type="date" name="DateTo" class="form-control" id="teacher_date_to" {{if .Options.Get "update"}} value="{{convertDate .Data.DateTo}}" {{end}}>
     </div>
     </div>
-    
+  </div>
+  
+  <div class="form-group">
+    <label class="control-label has-feedback" for="teacher_ldapdnfmt">Stringa DN per LDAP</label>
+    <input type="text" name="LdapDNFmt" class="form-control" id="teacher_ldapdnfmt" placeholder="cn=%s %s,ou=People,dc=foo,dc=org" {{if .Options.Get "update"}}value="{{.Data.LdapDNFmt}}"{{end}}>
+  </div>
+
+  <div class="form-group">
+    <button type="submit" class="btn btn-primary">Salva</button>
+    {{if .Options.Get "update"}}
+    <a href="/teachers/{{.Data.ID}}?{{query "tpl_layout" "base" "tpl_content" "teachers_show"}}" class="btn btn-default">Annulla</a>
+    {{else}}
+    <a href="/teachers/?{{query "tpl_layout" "base" "tpl_content" "teachers"}}" class="btn btn-default">Annulla</a>
+    {{end}}
+  </div>
+  
   </form>
   </form>
 
 
   
   

+ 72 - 102
templates/teachers_show.html.tpl

@@ -8,49 +8,30 @@
   <div class="row">
   <div class="row">
     <div class="col-md-12">
     <div class="col-md-12">
 
 
-      {{$options := '
+      {{$options := `
       title: "Materie"
       title: "Materie"
       model: "Subject"
       model: "Subject"
-      noElements: "Nessuna materia associata"
-      }}
-      {{template "relation_list" dict "options" ($options|yaml) "data" .Data.Subjects}}
-      <h2 class="karmen-relation-header">Materie</h2>
-      {{if .Data.Subjects}}
-      <div class="list-group" id="materie_list_group">
-    	{{range $subject := .Data.Subjects}}
-    	<a href="{{$subject.ID | show "Subject"}}" class="list-group-item list-group-item-action">
-    	  <span class="fa fa-book"></span>
-    	  {{$subject.Name}}
-    	  {{end}}
-    	</a>
-      </div>
-      {{else}}
-      <p>Al docente non è associata alcuna attività
-    	didattica. Clicca <a href="{{modelPath "Activity" "create" 0}}">qui</a> per
-    	creare una nuova attività didattica da associare al docente.</p>
-      {{end}}
-    </div>
+      icon: "fa fa-book"
+      `}}
+      
+      {{$noElements := "Nessuna materia associata."}}
+      {{template "relation_list" dict "options" ($options|yaml) "data" .Data.Subjects "noElements" $noElements}}
     
     
+    </div>
   </div>
   </div>
-
+  
   <div class="row">
   <div class="row">
     <div class="col-md-12">
     <div class="col-md-12">
+
+      {{$options := `
+      title: "Classi"
+      model: "Class"
+      icon: "fa fa-users"
+      `}}
       
       
-      <h2 class="karmen-relation-header">Classi</h2>
-      {{if .Data.Classes}}
-      <div class="list-group" id="classes_list_group">
-	{{range $class := .Data.Classes}}
-	<a href="{{$class.ID | modelPath "Class" "show"}}" class="list-group-item list-group-item-action">
-	  <span class="fa fa-users"></span>
-	  {{$class.Name}}
-	  {{end}}
-	</a>
-      </div>
-      {{else}}
-      <p>Al docente non è associata alcuna attività
-	didattica. Clicca <a href="{{modelPath "Activity" "create" 0}}">qui</a> per
-	creare una nuova attività didattica da associare al docente.</p>
-      {{end}}
+      {{$noElements := "Nessuna classe associata."}}
+      {{template "relation_list" dict "options" ($options|yaml) "data" .Data.Classes "noElements" $noElements}}
+
     </div>
     </div>
     
     
   </div>
   </div>
@@ -58,92 +39,81 @@
   <div class="row">
   <div class="row">
     <div class="col-md-12">
     <div class="col-md-12">
       
       
-      <h2 class="karmen-relation-header">Studenti</h2>
-      {{if .Data.Students}}
-      <div class="list-group" id="students_list_group">
-	{{range $student := .Data.Students}}
-	<a href="{{$student.ID | modelPath "Student" "show"}}" class="list-group-item list-group-item-action">
-	  <span class="fa fa-user"></span>
-	  {{$student.Surname}} {{$student.Name}}
-	  {{end}}
-	</a>
-      </div>
-      {{else}}
-      <p>Al docente non è associata alcuna attività
-	didattica. Clicca <a href="{{modelPath "Activity" "create" 0}}">qui</a> per
-	creare una nuova attività didattica da associare al docente.</p>
-      {{end}}
+      {{$options := `
+      title: "Studenti"
+      model: "Student"
+      icon: "fa fa-user"
+      `}}
+      
+      {{$noElements := (printf "Nessuna attività associata. Clicca %s per creare una nuova attività." (create "Activity"|anchor "qui"))|html}}
+      {{template "relation_list" dict "options" ($options|yaml) "data" .Data.Students "noElements" $noElements}}
+      
     </div>
     </div>
     
     
   </div>
   </div>
 
 
   <div class="row">
   <div class="row">
     <div class="col-md-12">
     <div class="col-md-12">
+
+      {{$options := `
+      title: "Gruppi a cui il docente appartiene"
+      model: "Group"
+      icon: "fa fa-users"
+      `}}
+      
+      {{$noElements := (printf "Nessun gruppo associato. Clicca %s per associare il docente ad un gruppo." (all "Group"|anchor "qui"))|html}}
+      {{template "relation_list" dict "options" ($options|yaml) "data" .Data.Groups "noElements" $noElements}}
       
       
-      <h2 class="karmen-relation-header">Gruppi a cui il docente appartiene</h2>
-      {{if .Data.Groups}}
-      <div class="list-group" id="groups_list_group">
-    	{{range $group := .Data.Groups}}
-    	<a href="/groups/{{$group.ID}}?{{query "tpl_layout" "base" "tpl_content" "groups_show"}}" class="list-group-item list-group-item-action">
-    	  <span class="fa fa-book"></span>
-    	  {{$group.Name}}
-    	  {{end}}
-    	</a>
-      </div>
-      {{else}}
-      <p>Il docente non è associato ad alcun gruppo. Clicca <a href="/groups?{{query "tpl_layout" "base" "tpl_content" "groups"}}">qui</a> per creare un nuovo gruppo.</p>{{end}}
     </div>
     </div>
     
     
   </div>
   </div>
 
 
   <div class="row">
   <div class="row">
     <div class="col-md-12">
     <div class="col-md-12">
-   
-      <h2 class="karmen-relation-header">Attività del docente ({{.Data.ActualHours}}h)</h2>
-      {{if .Data.Activities}}
-      <div class="list-group" id="classes_list_group">
-	{{range $activity := .Data.Activities}}
-	<a href="{{$activity.ID | modelPath "Activity" "show"}}" class="list-group-item list-group-item-action">
-	  <span class="fa fa-business-time"></span>
-	  {{$activity.Subject.Name}}{{if $activity.Class}}{{$activity.Class.Name}}{{else}}no classe{{end}} {{$activity.Hours}}h{{if $activity.SupplyTeacher}}{{if ne $.Data.Surname $activity.SupplyTeacher.Surname}} (sostituito da {{$activity.SupplyTeacher.Surname}}){{else}} (sostituisce {{$activity.Teacher.Surname}}){{end}}{{end}}
-	  {{end}}
-	</a>
-      </div>
       
       
-      {{if $classes := .Data.CoordinatorClasses}}
-      <p>Il docente è <strong>coordinatore</strong> nelle seguenti classi</p>
-      <div class="list-group" id="coord_classes_list_group">
-	{{range $class := $classes}}
-	<a href="{{$class.ID | modelPath "Class" "show"}}" class="list-group-item list-group-item-action">
-	  <span class="fa fa-users"></span>
-	  {{$class.Name}}
-	  {{end}}
-	</a>
-      </div>
-      {{end}}
+      {{$options := `
+      model: "Activity"
+      icon: "fa fa-business-time"
+      `}}
 
 
-      {{if $classes := .Data.MinuterClasses}}
-      <p>Il docente è <strong>verbalizzante</strong> nelle seguenti classi</p>
-      <div class="list-group" id="coord_classes_list_group">
-	{{range $class := $classes}}
-	<a href="{{$class.ID|modelPath "Class" "show"}}" class="list-group-item list-group-item-action">
-	  <span class="fa fa-users"></span>
-	  {{$class.Name}}
-	  {{end}}
-	</a>
-      </div>
-      {{end}}
+      {{$noElements := (printf "Nessuna attività associata. Clicca %s per creare una nuova attività." (create "Activity"|anchor "qui"))|html}}
+      {{template "relation_list" dict "options" ($options|yaml) "data" .Data.Activities "noElements" $noElements "title" (printf "Attività del docente (%dh)" .Data.ActualHours)}}
 
 
-      
-      {{else}}
-      <p>Al docente non è associata alcuna attività
-	didattica. Clicca <a href="{{modelPath "Activity" "create" 0}}">qui</a> per
-	creare una nuova attività didattica da associare al docente.</p>
-      {{end}}
     </div>
     </div>
   </div>
   </div>
 
 
+  {{if $classes := .Data.CoordinatorClasses}}
+  <div class="row">
+    <div class="col-md-12">
+      
+      {{$options := `
+      title: "Coordinatore nelle seguenti classi"
+      model: "Class"
+      icon: "fa fa-users"
+      `}}
+  
+      {{$noElements := "Nessuna classe associata."}}
+      {{template "relation_list" dict "options" ($options|yaml) "data" .Data.CoordinatorClasses "noElements" $noElements}}
+    </div>
+  </div>
+  {{end}}
 
 
+  {{if $classes := .Data.MinuterClasses}}
+  <div class="row">
+    <div class="col-md-12">
+      
+      {{$options := `
+      title: "Verbalizzante nelle seguenti classi"
+      model: "Class"
+      icon: "fa fa-users"
+      `}}
+  
+      {{$noElements := "Nessuna classe associata."}}
+      {{template "relation_list" dict "options" ($options|yaml) "data" .Data.MinuterClasses "noElements" $noElements}}
+    </div>
+  </div>
+  {{end}}
+  
 </div>    
 </div>    
 
 
 {{ end }}
 {{ end }}