{{template "header.html" .S}}

{{range .News}}
<div class="row">
<div class="offset2 span8 alert alert-info">
    <a href="/news/"><strong>News!</strong></a> {{.Text}}
</div>
</div>
{{end}}

<div class="row">
	<p class="centered">There are {{.Count}} books on the library.</p>
</div>
<div class="row">
	<h4>Last books added:
	<span class="pull-right">
		<small>(<a href="/search/?q=">more</a>)</small>
		<a href="/search/?fmt=rss&q="><img src="/img/feed.png"/></a>
    </span>
	</h4>
</div>

<ul class="row thumbnails">
{{with .Books}}
	{{range .}}
	<li class="span2">
		<div class="thumbnail centered" style="border:none;">
		<a href="/book/{{.Id}}">
		{{if .Cover}}<div class="down"><img  class="img-rounded" src="/cover/{{.Id}}/small/{{.Title}}.jpg" alt="{{.Title}}" /></div>{{end}}
		<p><strong>{{.Title}}</strong></p>
		</a>
		</div>
	</li>
	{{end}}
{{end}}
</ul>

<div class="row">
	<h4>Most visited books:</h4>
</div>
<ul class="row thumbnails">
{{with .VisitedBooks}}
	{{range .}}
	<li class="span2">
		<div class="thumbnail centered" style="border:none;">
		<a href="/book/{{.Id}}">
		{{if .Cover}}<div class="down"><img  class="img-rounded" src="/cover/{{.Id}}/small/{{.Title}}.jpg" alt="{{.Title}}" /></div>{{end}}
		<p><strong>{{.Title}}</strong></p>
		</a>
		</div>
	</li>
	{{end}}
{{end}}
</ul>

<div class="row">
	<h4>Most downloaded books:</h4>
</div>
<ul class="row thumbnails">
{{with .DownloadedBooks}}
	{{range .}}
	<li class="span2">
		<div class="thumbnail centered" style="border:none;">
		<a href="/book/{{.Id}}">
		{{if .Cover}}<div class="down"><img  class="img-rounded" src="/cover/{{.Id}}/small/{{.Title}}.jpg" alt="{{.Title}}" /></div>{{end}}
		<p><strong>{{.Title}}</strong></p>
		</a>
		</div>
	</li>
	{{end}}
{{end}}
</ul>

<div class="row">
	<p class="centered">{{range .Tags}}<a class="label" href="/search/?q=subject:{{.}}">{{.}}</a> {{end}}</p>
</div>

{{template "footer.html"}}