{{ define "content" }}

<div class="container">
  
  <div class="karmen-info-header">
    <div class="row">
      <div class="col-md-8">
	<h1>Materie</h1>
      </div>
      <div class="col-md-4">

	<div class="btn-group pull-right">
	  
	  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
	    <span class="glyphicon glyphicon-floppy-open" aria-hidden="true"></span>
	    Importa<span class="caret"></span>
	  </button>
	  
	  <div class="dropdown-menu">
	    <div class="container">  
	      <form role="form" id="form_subjects_upload" action="/subjects/import" method="post" enctype="multipart/form-data">
		<div class="form-group">
		  <label class="control-label">Seleziona il file</label>
		  <input id="input-1" type="file" class="file" data-show-preview="false" name="subjects_import">
		</div>
	      </form>
	    </div>  
	  </div>
	</div>

	<a href="/subjects/add" class="btn btn-primary pull-right">
	  <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
	  Crea nuova materia
	</a>
	
      </div>
      
    </div>
  </div>

  <div class="input-group" style="margin-bottom: 20px">
    <span class="input-group-addon" id="search-query"><span class="glyphicon glyphicon-search"></span></span>
    <input type="text" id="myInput" class="form-control" aria-describedby="search-query">
  </div>

  {{if not .}}
  <p>Non c'è alcun elemento da visualizzare.</p>
  {{else}}
  <div class="list-group" id="myUL">
    {{range $subject := .}}
    <a class="list-group-item clearfix" href="/subjects/{{$subject.ID}}">
      <span class="glyphicon glyphicon-book"></span>
      {{$subject.Name}}
      <div class="text-right">
	{{range $teacher := $subject.Teachers}}
	<small>{{$teacher.Surname}}</small>
	{{end}}
      </div>

    </a>
    {{end}}
    {{end}}
  </div>
  
</div>
  
{{ end }}
